summaryrefslogtreecommitdiff
path: root/plugins/HistoryStats/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-05 12:52:30 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-05 12:52:30 +0000
commit3576b67db9fa0a3d8d5c1747cc3560504d31d125 (patch)
treef6a6cb9916cbf1aab83bac572fec8822f6ad065e /plugins/HistoryStats/src
parent73e6231455372205e912963083624aaa371bab0b (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')
-rw-r--r--plugins/HistoryStats/src/_consts.h12
-rw-r--r--plugins/HistoryStats/src/_format.h8
-rw-r--r--plugins/HistoryStats/src/_globals.h107
-rw-r--r--plugins/HistoryStats/src/_strfunc.h40
-rw-r--r--plugins/HistoryStats/src/bandctrl.cpp6
-rw-r--r--plugins/HistoryStats/src/bandctrl.h2
-rw-r--r--plugins/HistoryStats/src/bandctrldefs.h4
-rw-r--r--plugins/HistoryStats/src/bandctrlimpl.cpp573
-rw-r--r--plugins/HistoryStats/src/bandctrlimpl.h4
-rw-r--r--plugins/HistoryStats/src/canvas.cpp69
-rw-r--r--plugins/HistoryStats/src/canvas.h2
-rw-r--r--plugins/HistoryStats/src/colbase_words.cpp187
-rw-r--r--plugins/HistoryStats/src/column.cpp65
-rw-r--r--plugins/HistoryStats/src/column.h20
-rw-r--r--plugins/HistoryStats/src/column_chatduration.cpp89
-rw-r--r--plugins/HistoryStats/src/column_chatduration.h6
-rw-r--r--plugins/HistoryStats/src/column_events.cpp46
-rw-r--r--plugins/HistoryStats/src/column_events.h6
-rw-r--r--plugins/HistoryStats/src/column_group.cpp8
-rw-r--r--plugins/HistoryStats/src/column_group.h6
-rw-r--r--plugins/HistoryStats/src/column_inout.cpp92
-rw-r--r--plugins/HistoryStats/src/column_inout.h6
-rw-r--r--plugins/HistoryStats/src/column_inoutgraph.cpp132
-rw-r--r--plugins/HistoryStats/src/column_inoutgraph.h6
-rw-r--r--plugins/HistoryStats/src/column_nick.cpp49
-rw-r--r--plugins/HistoryStats/src/column_nick.h6
-rw-r--r--plugins/HistoryStats/src/column_protocol.cpp12
-rw-r--r--plugins/HistoryStats/src/column_protocol.h6
-rw-r--r--plugins/HistoryStats/src/column_rank.cpp18
-rw-r--r--plugins/HistoryStats/src/column_rank.h6
-rw-r--r--plugins/HistoryStats/src/column_split.cpp162
-rw-r--r--plugins/HistoryStats/src/column_split.h6
-rw-r--r--plugins/HistoryStats/src/column_splittimeline.cpp130
-rw-r--r--plugins/HistoryStats/src/column_splittimeline.h6
-rw-r--r--plugins/HistoryStats/src/column_timeline.cpp178
-rw-r--r--plugins/HistoryStats/src/column_timeline.h6
-rw-r--r--plugins/HistoryStats/src/column_wordcount.cpp78
-rw-r--r--plugins/HistoryStats/src/column_wordcount.h6
-rw-r--r--plugins/HistoryStats/src/column_words.cpp78
-rw-r--r--plugins/HistoryStats/src/column_words.h6
-rw-r--r--plugins/HistoryStats/src/contact.cpp98
-rw-r--r--plugins/HistoryStats/src/dlgconfigure.cpp138
-rw-r--r--plugins/HistoryStats/src/dlgfilterwords.cpp218
-rw-r--r--plugins/HistoryStats/src/dlgoption.cpp221
-rw-r--r--plugins/HistoryStats/src/dlgoption.h10
-rw-r--r--plugins/HistoryStats/src/dlgoption_subbase.cpp34
-rw-r--r--plugins/HistoryStats/src/dlgoption_subcolumns.cpp475
-rw-r--r--plugins/HistoryStats/src/dlgoption_subexclude.cpp220
-rw-r--r--plugins/HistoryStats/src/dlgoption_subglobal.cpp416
-rw-r--r--plugins/HistoryStats/src/dlgoption_subinput.cpp203
-rw-r--r--plugins/HistoryStats/src/dlgoption_suboutput.cpp315
-rw-r--r--plugins/HistoryStats/src/iconlib.cpp87
-rw-r--r--plugins/HistoryStats/src/iconlib.h6
-rw-r--r--plugins/HistoryStats/src/main.cpp104
-rw-r--r--plugins/HistoryStats/src/message.cpp168
-rw-r--r--plugins/HistoryStats/src/message.h10
-rw-r--r--plugins/HistoryStats/src/mirandacontact.cpp166
-rw-r--r--plugins/HistoryStats/src/mirandahistory.cpp75
-rw-r--r--plugins/HistoryStats/src/mirandasettings.cpp38
-rw-r--r--plugins/HistoryStats/src/mirandasettings.h36
-rw-r--r--plugins/HistoryStats/src/mu_common.cpp229
-rw-r--r--plugins/HistoryStats/src/mu_common.h163
-rw-r--r--plugins/HistoryStats/src/optionsctrl.cpp70
-rw-r--r--plugins/HistoryStats/src/optionsctrl.h26
-rw-r--r--plugins/HistoryStats/src/optionsctrldefs.h32
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl.cpp804
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl.h54
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl_button.cpp4
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl_check.cpp2
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl_color.cpp4
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl_combo.cpp10
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp210
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl_edit.cpp12
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl_group.cpp2
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl_item.cpp4
-rw-r--r--plugins/HistoryStats/src/optionsctrlimpl_radio.cpp2
-rw-r--r--plugins/HistoryStats/src/protocol.cpp12
-rw-r--r--plugins/HistoryStats/src/settings.cpp336
-rw-r--r--plugins/HistoryStats/src/settings.h32
-rw-r--r--plugins/HistoryStats/src/settingsserializer.cpp237
-rw-r--r--plugins/HistoryStats/src/settingsserializer.h4
-rw-r--r--plugins/HistoryStats/src/settingstree.cpp140
-rw-r--r--plugins/HistoryStats/src/settingstree.h20
-rw-r--r--plugins/HistoryStats/src/statistic.cpp699
-rw-r--r--plugins/HistoryStats/src/statistic.h4
-rw-r--r--plugins/HistoryStats/src/themeapi.cpp53
-rw-r--r--plugins/HistoryStats/src/themeapi.h50
-rw-r--r--plugins/HistoryStats/src/utf8buffer.h52
-rw-r--r--plugins/HistoryStats/src/utils.cpp689
-rw-r--r--plugins/HistoryStats/src/utils.h60
-rw-r--r--plugins/HistoryStats/src/version.h6
91 files changed, 3797 insertions, 5512 deletions
diff --git a/plugins/HistoryStats/src/_consts.h b/plugins/HistoryStats/src/_consts.h
index d805314873..9d3816c355 100644
--- a/plugins/HistoryStats/src/_consts.h
+++ b/plugins/HistoryStats/src/_consts.h
@@ -4,13 +4,13 @@
#include "_globals.h"
#if defined(HISTORYSTATS_CONST_DEFINE)
-#define CONST_T(nam, txt) extern const mu_text* nam = muT(txt);
-#define CONST_A(nam, txt) extern const mu_ansi* nam = muA(txt);
-#define CONST_W(nam, txt) extern const mu_wide* nam = muW(txt);
+#define CONST_T(nam, txt) extern const TCHAR* nam = _T(txt);
+#define CONST_A(nam, txt) extern const char* nam = txt;
+#define CONST_W(nam, txt) extern const WCHAR* nam = L#txt;
#else
-#define CONST_T(nam, txt) extern const mu_text* nam;
-#define CONST_A(nam, txt) extern const mu_ansi* nam;
-#define CONST_W(nam, txt) extern const mu_wide* nam;
+#define CONST_T(nam, txt) extern const TCHAR* nam;
+#define CONST_A(nam, txt) extern const char* nam;
+#define CONST_W(nam, txt) extern const WCHAR* nam;
#endif
/*
diff --git a/plugins/HistoryStats/src/_format.h b/plugins/HistoryStats/src/_format.h
index 9e53e21e8b..cecf23feca 100644
--- a/plugins/HistoryStats/src/_format.h
+++ b/plugins/HistoryStats/src/_format.h
@@ -22,7 +22,7 @@ namespace ext
size_type m_NextPos;
public:
- explicit basic_format(const str_type& str, char_type sep = muC('|'))
+ explicit basic_format(const str_type& str, char_type sep = '|')
: m_Str(str), m_Sep(sep), m_NextPos(0)
{
}
@@ -99,7 +99,7 @@ namespace ext
public:
explicit basic_kformat(const str_type& str)
- : m_Str(str), m_Mask(str.length(), muC('_'))
+ : m_Str(str), m_Mask(str.length(), '_')
{
}
@@ -125,11 +125,11 @@ namespace ext
while ((pos = m_Str.find(m_CurKey, pos)) != ext::string::npos)
{
- if (m_Mask.substr(pos, key_len).find(muC('X')) == ext::string::npos)
+ if (m_Mask.substr(pos, key_len).find('X') == ext::string::npos)
{
// replace since we didn't replace here before
m_Str.replace(pos, key_len, szValue, value_len);
- m_Mask.replace(pos, key_len, value_len, muC('X'));
+ m_Mask.replace(pos, key_len, value_len, 'X');
pos += value_len;
}
else
diff --git a/plugins/HistoryStats/src/_globals.h b/plugins/HistoryStats/src/_globals.h
index 0b9e033a63..2eeb39fe3e 100644
--- a/plugins/HistoryStats/src/_globals.h
+++ b/plugins/HistoryStats/src/_globals.h
@@ -12,15 +12,18 @@
#pragma warning(disable:4267)
-#include "mu_common.h"
+#define _WIN32_WINDOWS 0x0500 // for WM_MOUSEWHEEL
+#define _WIN32_WINNT 0x0501 // for WM_THEMECHANGED
-#include "version.h"
+#include <windows.h>
+#include <commctrl.h>
+#include <Uxtheme.h>
+#include <vsstyle.h>
-/*
- * essential includes
- */
+#pragma comment(lib, "UxTheme.lib")
-#include <commctrl.h>
+#include <tchar.h>
+#include <stdio.h>
#include <cstdio>
#include <cassert>
@@ -30,6 +33,54 @@
#include <fstream>
#include <sstream>
+#define MIRANDA_VER 0x0A00
+
+#include <newpluginapi.h>
+
+#include <m_awaymsg.h> // not used
+#include <m_button.h> // not used
+#include <m_chat.h> // not used
+#include <m_clc.h>
+#include <m_clist.h>
+#include <m_clistint.h> // not used
+#include <m_clui.h> // not used
+#include <m_contacts.h>
+#include <m_database.h>
+#include <m_email.h> // not used
+#include <m_file.h> // not used
+#include <m_findadd.h> // not used
+#include <m_fontservice.h> // not used
+#include <m_genmenu.h> // not used
+#include <m_history.h> // not used
+#include <m_icolib.h>
+#include <m_idle.h> // not used
+#include <m_ignore.h> // not used
+#include <m_langpack.h>
+#include <m_message.h> // not used
+#include <m_netlib.h> // not used
+#include <m_options.h>
+#include <m_png.h>
+#include <m_popup.h> // not used
+#include <m_protocols.h>
+#include <m_protomod.h> // not used
+#include <m_protosvc.h>
+#include <m_skin.h>
+#include <m_system.h>
+#include <m_system_cpp.h> // not used
+#include <m_url.h> // not used
+#include <m_userinfo.h> // not used
+#include <m_utils.h>
+
+#include <m_addcontact.h> // not used, depends on m_protosvc.h
+#include <m_icq.h> // depends on m_protosvc.h
+
+#include <m_metacontacts.h>
+#include <m_historystats.h> // our own header
+
+#include "mu_common.h"
+
+#include "version.h"
+
/*
* some patterns and similar stuff we want to use everywhere
*/
@@ -52,43 +103,33 @@ namespace ext
{
namespace w
{
- const mu_wide* const endl = muW("\n");
-
- typedef std::basic_string <mu_wide> string;
- typedef std::basic_ofstream<mu_wide> ofstream;
- typedef std::basic_ostream <mu_wide> ostream;
- typedef ext::basic_strfunc <mu_wide> strfunc;
- typedef ext::basic_format <mu_wide> format;
- typedef ext::basic_kformat <mu_wide> kformat;
+ const WCHAR* const endl = L"\n";
+
+ typedef std::basic_string <WCHAR> string;
+ typedef std::basic_ofstream<WCHAR> ofstream;
+ typedef std::basic_ostream <WCHAR> ostream;
+ typedef ext::basic_strfunc <WCHAR> strfunc;
+ typedef ext::basic_format <WCHAR> format;
+ typedef ext::basic_kformat <WCHAR> kformat;
}
namespace a
{
- const mu_ansi* const endl = muA("\n");
-
- typedef std::basic_string <mu_ansi> string;
- typedef std::basic_ofstream<mu_ansi> ofstream;
- typedef std::basic_ostream <mu_ansi> ostream;
- typedef ext::basic_strfunc <mu_ansi> strfunc;
- typedef ext::basic_format <mu_ansi> format;
- typedef ext::basic_kformat <mu_ansi> kformat;
+ const char* const endl = "\n";
+
+ typedef std::basic_string <char> string;
+ typedef std::basic_ofstream<char> ofstream;
+ typedef std::basic_ostream <char> ostream;
+ typedef ext::basic_strfunc <char> strfunc;
+ typedef ext::basic_format <char> format;
+ typedef ext::basic_kformat <char> kformat;
}
// choose the right T-style namespace for this compilation
- namespace t = MU_DO_BOTH(a, w);
+ namespace t = w;
// import T-style classes for easier access
using namespace t;
-
- // helper functions
- inline const mu_text* i18n(const mu_text* str) { return mu::langpack::translateString(str); }
}
-/*
- * translation stuff
- */
-
-#define I18N(x) x
-using ext::i18n;
-
#endif // HISTORYSTATS_GUARD__GLOABLS_H
diff --git a/plugins/HistoryStats/src/_strfunc.h b/plugins/HistoryStats/src/_strfunc.h
index 6ff5d61237..b65c6a7384 100644
--- a/plugins/HistoryStats/src/_strfunc.h
+++ b/plugins/HistoryStats/src/_strfunc.h
@@ -9,33 +9,33 @@ namespace ext
};
template<>
- class basic_strfunc<mu_ansi>
+ class basic_strfunc<char>
{
public:
- static const mu_ansi* chr(const mu_ansi* string, mu_ansi c) { return strchr(string, c); }
- static int cmp(const mu_ansi* string1, const mu_ansi* string2) { return strcmp(string1, string2); }
- static int icmp(const mu_ansi* string1, const mu_ansi* string2) { return _stricmp(string1, string2); }
- static int coll(const mu_ansi* string1, const mu_ansi* string2) { return strcoll(string1, string2); }
- static int icoll(const mu_ansi* string1, const mu_ansi* string2) { return _stricoll(string1, string2); }
- static const mu_ansi* str(const mu_ansi* string, const mu_ansi* strSearch) { return strstr(string, strSearch); }
- static size_t len(const mu_ansi* string) { return strlen(string); }
- static size_t ftime(mu_ansi* strDest, size_t maxsize, const mu_ansi* format, const struct tm* timeptr) { return strftime(strDest, maxsize, format, timeptr); }
- static int sprintf(mu_ansi* buffer, const mu_ansi* format, ...) { va_list args; va_start(args, format); return vsprintf(buffer, format, args); }
+ static const char* chr(const char* string, char c) { return strchr(string, c); }
+ static int cmp(const char* string1, const char* string2) { return strcmp(string1, string2); }
+ static int icmp(const char* string1, const char* string2) { return _stricmp(string1, string2); }
+ static int coll(const char* string1, const char* string2) { return strcoll(string1, string2); }
+ static int icoll(const char* string1, const char* string2) { return _stricoll(string1, string2); }
+ static const char* str(const char* string, const char* strSearch) { return strstr(string, strSearch); }
+ static size_t len(const char* string) { return strlen(string); }
+ static size_t ftime(char* strDest, size_t maxsize, const char* format, const struct tm* timeptr) { return strftime(strDest, maxsize, format, timeptr); }
+ static int sprintf(char* buffer, const char* format, ...) { va_list args; va_start(args, format); return vsprintf(buffer, format, args); }
};
template<>
- class basic_strfunc<mu_wide>
+ class basic_strfunc<WCHAR>
{
public:
- static const mu_wide* chr(const mu_wide* string, mu_wide c) { return wcschr(string, c); }
- static int cmp(const mu_wide* string1, const mu_wide* string2) { return wcscmp(string1, string2); }
- static int icmp(const mu_wide* string1, const mu_wide* string2) { return _wcsicmp(string1, string2); }
- static int coll(const mu_wide* string1, const mu_wide* string2) { return wcscoll(string1, string2); }
- static int icoll(const mu_wide* string1, const mu_wide* string2) { return _wcsicoll(string1, string2); }
- static const mu_wide* str(const mu_wide* string, const mu_wide* strSearch) { return wcsstr(string, strSearch); }
- static size_t len(const mu_wide* string) { return wcslen(string); }
- static size_t ftime(mu_wide* strDest, size_t maxsize, const mu_wide* format, const struct tm* timeptr) { return wcsftime(strDest, maxsize, format, timeptr); }
- static int sprintf(mu_wide* buffer, const mu_wide* format, ...) { va_list args; va_start(args, format); return vswprintf(buffer, format, args); }
+ static const WCHAR* chr(const WCHAR* string, WCHAR c) { return wcschr(string, c); }
+ static int cmp(const WCHAR* string1, const WCHAR* string2) { return wcscmp(string1, string2); }
+ static int icmp(const WCHAR* string1, const WCHAR* string2) { return _wcsicmp(string1, string2); }
+ static int coll(const WCHAR* string1, const WCHAR* string2) { return wcscoll(string1, string2); }
+ static int icoll(const WCHAR* string1, const WCHAR* string2) { return _wcsicoll(string1, string2); }
+ static const WCHAR* str(const WCHAR* string, const WCHAR* strSearch) { return wcsstr(string, strSearch); }
+ static size_t len(const WCHAR* string) { return wcslen(string); }
+ static size_t ftime(WCHAR* strDest, size_t maxsize, const WCHAR* format, const struct tm* timeptr) { return wcsftime(strDest, maxsize, format, timeptr); }
+ static int sprintf(WCHAR* buffer, const WCHAR* format, ...) { va_list args; va_start(args, format); return vswprintf(buffer, format, args); }
};
}
diff --git a/plugins/HistoryStats/src/bandctrl.cpp b/plugins/HistoryStats/src/bandctrl.cpp
index 677ab9d90e..1629c6a638 100644
--- a/plugins/HistoryStats/src/bandctrl.cpp
+++ b/plugins/HistoryStats/src/bandctrl.cpp
@@ -10,15 +10,15 @@ void BandCtrl::setLayout(int nLayout)
SendMessage(m_hBandWnd, BCM_SETLAYOUT, nLayout, 0);
}
-HANDLE BandCtrl::addButton(DWORD dwFlags, HICON hIcon, DWORD dwData, const mu_text* szTooltip /* = NULL */, const mu_text* szText /* = NULL */)
+HANDLE BandCtrl::addButton(DWORD dwFlags, HICON hIcon, DWORD dwData, const TCHAR* szTooltip /* = NULL */, const TCHAR* szText /* = NULL */)
{
BCBUTTON bcb;
bcb.dwFlags = dwFlags | BCF_ICON | BCF_DATA | (szTooltip ? BCF_TOOLTIP : 0) | (szText ? BCF_TEXT : 0);
bcb.hIcon = hIcon;
bcb.dwData = dwData;
- bcb.szTooltip = const_cast<mu_text*>(szTooltip);
- bcb.szText = const_cast<mu_text*>(szText);
+ bcb.szTooltip = const_cast<TCHAR*>(szTooltip);
+ bcb.szText = const_cast<TCHAR*>(szText);
return reinterpret_cast<HANDLE>(SendMessage(m_hBandWnd, BCM_ADDBUTTON, 0, reinterpret_cast<LPARAM>(&bcb)));
}
diff --git a/plugins/HistoryStats/src/bandctrl.h b/plugins/HistoryStats/src/bandctrl.h
index db3c5c81f7..b5bda28340 100644
--- a/plugins/HistoryStats/src/bandctrl.h
+++ b/plugins/HistoryStats/src/bandctrl.h
@@ -25,7 +25,7 @@ public:
public:
void setLayout(int nLayout);
- HANDLE addButton(DWORD dwFlags, HICON hIcon, DWORD dwData, const mu_text* szTooltip = NULL, const mu_text* szText = NULL);
+ HANDLE addButton(DWORD dwFlags, HICON hIcon, DWORD dwData, const TCHAR* szTooltip = NULL, const TCHAR* szText = NULL);
bool isButtonChecked(HANDLE hButton);
void checkButton(HANDLE hButton, bool bCheck);
DWORD getButtonData(HANDLE hButton);
diff --git a/plugins/HistoryStats/src/bandctrldefs.h b/plugins/HistoryStats/src/bandctrldefs.h
index 2109696a77..60d6bbbc76 100644
--- a/plugins/HistoryStats/src/bandctrldefs.h
+++ b/plugins/HistoryStats/src/bandctrldefs.h
@@ -44,8 +44,8 @@ public:
struct BCBUTTON {
DWORD dwFlags;
HICON hIcon;
- mu_text* szText;
- mu_text* szTooltip;
+ TCHAR* szText;
+ TCHAR* szTooltip;
DWORD dwData;
};
diff --git a/plugins/HistoryStats/src/bandctrlimpl.cpp b/plugins/HistoryStats/src/bandctrlimpl.cpp
index 675077d7b4..dd9b28dead 100644
--- a/plugins/HistoryStats/src/bandctrlimpl.cpp
+++ b/plugins/HistoryStats/src/bandctrlimpl.cpp
@@ -8,155 +8,151 @@
* BandCtrlImpl
*/
-const mu_text* BandCtrlImpl::m_ClassName = muT("HistoryStatsBand");
-const int BandCtrlImpl::m_PollId = 100;
-const int BandCtrlImpl::m_PollDelay = 50;
+const TCHAR* BandCtrlImpl::m_ClassName = _T("HistoryStatsBand");
+const int BandCtrlImpl::m_PollId = 100;
+const int BandCtrlImpl::m_PollDelay = 50;
LRESULT CALLBACK BandCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
BandCtrlImpl* pCtrl = reinterpret_cast<BandCtrlImpl*>(GetWindowLong(hWnd, 0));
- switch (msg)
- {
- case WM_NCCREATE:
- pCtrl = new BandCtrlImpl(hWnd, reinterpret_cast<int>(reinterpret_cast<CREATESTRUCT*>(lParam)->hMenu));
- SetWindowLong(hWnd, 0, reinterpret_cast<LONG>(pCtrl));
- return TRUE;
-
- case WM_DESTROY:
- delete pCtrl;
- SetWindowLong(hWnd, 0, 0);
- return 0;
-
- case WM_GETDLGCODE:
- return DLGC_WANTARROWS;
-
- case WM_SETFOCUS:
- pCtrl->onWMSetFocus();
- return 0;
-
- case WM_KILLFOCUS:
- if (pCtrl->m_nCurFocused != -1)
- {
- pCtrl->m_nCurFocused = -1;
- InvalidateRect(pCtrl->m_hWnd, NULL, TRUE);
- }
- return 0;
+ switch (msg) {
+ case WM_NCCREATE:
+ pCtrl = new BandCtrlImpl(hWnd, reinterpret_cast<int>(reinterpret_cast<CREATESTRUCT*>(lParam)->hMenu));
+ SetWindowLong(hWnd, 0, reinterpret_cast<LONG>(pCtrl));
+ return TRUE;
- case WM_ENABLE:
- InvalidateRect(pCtrl->m_hWnd, NULL, TRUE);
- return 0;
+ case WM_DESTROY:
+ delete pCtrl;
+ SetWindowLong(hWnd, 0, 0);
+ return 0;
- case WM_GETFONT:
- return reinterpret_cast<LRESULT>(pCtrl->m_hFont);
+ case WM_GETDLGCODE:
+ return DLGC_WANTARROWS;
- case WM_SETFONT:
- pCtrl->m_hFont = reinterpret_cast<HFONT>(wParam);
- return 0;
+ case WM_SETFOCUS:
+ pCtrl->onWMSetFocus();
+ return 0;
- case WM_WINDOWPOSCHANGED:
- pCtrl->recalcButtonRects();
+ case WM_KILLFOCUS:
+ if (pCtrl->m_nCurFocused != -1) {
+ pCtrl->m_nCurFocused = -1;
InvalidateRect(pCtrl->m_hWnd, NULL, TRUE);
- return 0;
+ }
+ return 0;
- case WM_KEYDOWN:
- pCtrl->onWMKeyDown(wParam);
- return 0;
+ case WM_ENABLE:
+ InvalidateRect(pCtrl->m_hWnd, NULL, TRUE);
+ return 0;
- case WM_KEYUP:
- pCtrl->onWMKeyUp(wParam);
- return 0;
+ case WM_GETFONT:
+ return reinterpret_cast<LRESULT>(pCtrl->m_hFont);
- case WM_MOUSEMOVE:
- pCtrl->onWMMouseMove(MAKEPOINTS(lParam));
- return 0;
+ case WM_SETFONT:
+ pCtrl->m_hFont = reinterpret_cast<HFONT>(wParam);
+ return 0;
- case WM_MOUSELEAVE:
- pCtrl->onWMMouseLeave();
- return 0;
+ case WM_WINDOWPOSCHANGED:
+ pCtrl->recalcButtonRects();
+ InvalidateRect(pCtrl->m_hWnd, NULL, TRUE);
+ return 0;
- case WM_TIMER:
- if (wParam == m_PollId)
- {
- RECT rect;
- POINT pt;
+ case WM_KEYDOWN:
+ pCtrl->onWMKeyDown(wParam);
+ return 0;
- GetWindowRect(pCtrl->m_hWnd, &rect);
- GetCursorPos(&pt);
+ case WM_KEYUP:
+ pCtrl->onWMKeyUp(wParam);
+ return 0;
- if (!PtInRect(&rect, pt))
- {
- PostMessage(pCtrl->m_hWnd, WM_MOUSELEAVE, 0, 0);
- KillTimer(pCtrl->m_hWnd, m_PollId);
- }
+ case WM_MOUSEMOVE:
+ pCtrl->onWMMouseMove(MAKEPOINTS(lParam));
+ return 0;
+
+ case WM_MOUSELEAVE:
+ pCtrl->onWMMouseLeave();
+ return 0;
+
+ case WM_TIMER:
+ if (wParam == m_PollId) {
+ RECT rect;
+ POINT pt;
+
+ GetWindowRect(pCtrl->m_hWnd, &rect);
+ GetCursorPos(&pt);
+
+ if (!PtInRect(&rect, pt)) {
+ PostMessage(pCtrl->m_hWnd, WM_MOUSELEAVE, 0, 0);
+ KillTimer(pCtrl->m_hWnd, m_PollId);
}
- return 0;
+ }
+ return 0;
- case WM_LBUTTONDOWN:
- pCtrl->onWMLButtonDown(MAKEPOINTS(lParam));
- return 0;
+ case WM_LBUTTONDOWN:
+ pCtrl->onWMLButtonDown(MAKEPOINTS(lParam));
+ return 0;
- case WM_LBUTTONUP:
- pCtrl->onWMLButtonUp(MAKEPOINTS(lParam));
- return 0;
+ case WM_LBUTTONUP:
+ pCtrl->onWMLButtonUp(MAKEPOINTS(lParam));
+ return 0;
- case WM_PAINT:
- pCtrl->onWMPaint();
- return 0;
+ case WM_PAINT:
+ pCtrl->onWMPaint();
+ return 0;
- case WM_ERASEBKGND:
- return TRUE;
+ case WM_ERASEBKGND:
+ return TRUE;
- case WM_THEMECHANGED:
- pCtrl->reloadTheme();
- return 0;
+ case WM_THEMECHANGED:
+ pCtrl->reloadTheme();
+ return 0;
- case BCM_ADDBUTTON:
- return pCtrl->onBCMAddButton(reinterpret_cast<BCBUTTON*>(lParam));
+ case BCM_ADDBUTTON:
+ return pCtrl->onBCMAddButton(reinterpret_cast<BCBUTTON*>(lParam));
- case BCM_ISBUTTONCHECKED:
- assert(wParam >= 1 && wParam <= pCtrl->m_Items.size());
- return BOOL_(pCtrl->m_Items[wParam - 1].bChecked);
+ case BCM_ISBUTTONCHECKED:
+ assert(wParam >= 1 && wParam <= pCtrl->m_Items.size());
+ return BOOL_(pCtrl->m_Items[wParam - 1].bChecked);
- case BCM_CHECKBUTTON:
- pCtrl->onBCMCheckButton(wParam - 1, bool_(lParam));
- return 0;
+ case BCM_CHECKBUTTON:
+ pCtrl->onBCMCheckButton(wParam - 1, bool_(lParam));
+ return 0;
- case BCM_GETBUTTONDATA:
- assert(wParam >= 1 && wParam <= pCtrl->m_Items.size());
- return pCtrl->m_Items[wParam - 1].dwData;
+ case BCM_GETBUTTONDATA:
+ assert(wParam >= 1 && wParam <= pCtrl->m_Items.size());
+ return pCtrl->m_Items[wParam - 1].dwData;
- case BCM_SETBUTTONDATA:
- assert(wParam >= 1 && wParam <= pCtrl->m_Items.size());
- pCtrl->m_Items[wParam - 1].dwData = static_cast<DWORD>(lParam);
- return 0;
+ case BCM_SETBUTTONDATA:
+ assert(wParam >= 1 && wParam <= pCtrl->m_Items.size());
+ pCtrl->m_Items[wParam - 1].dwData = static_cast<DWORD>(lParam);
+ return 0;
- case BCM_ISBUTTONVISIBLE:
- assert(wParam >= 1 && wParam <= pCtrl->m_Items.size());
- return BOOL_(pCtrl->m_Items[wParam - 1].bVisible);
+ case BCM_ISBUTTONVISIBLE:
+ assert(wParam >= 1 && wParam <= pCtrl->m_Items.size());
+ return BOOL_(pCtrl->m_Items[wParam - 1].bVisible);
- case BCM_SHOWBUTTON:
- pCtrl->onBCMShowButton(wParam - 1, bool_(lParam));
- return 0;
+ case BCM_SHOWBUTTON:
+ pCtrl->onBCMShowButton(wParam - 1, bool_(lParam));
+ return 0;
- case BCM_SETLAYOUT:
- assert(static_cast<int>(wParam) >= 0);
- pCtrl->m_nLayout = wParam;
- pCtrl->recalcButtonRects();
- InvalidateRect(pCtrl->m_hWnd, NULL, TRUE);
- return 0;
+ case BCM_SETLAYOUT:
+ assert(static_cast<int>(wParam) >= 0);
+ pCtrl->m_nLayout = wParam;
+ pCtrl->recalcButtonRects();
+ InvalidateRect(pCtrl->m_hWnd, NULL, TRUE);
+ return 0;
- case BCM_GETBUTTONRECT:
- pCtrl->onBCMGetButtonRect(wParam - 1, reinterpret_cast<RECT*>(lParam));
- return 0;
+ case BCM_GETBUTTONRECT:
+ pCtrl->onBCMGetButtonRect(wParam - 1, reinterpret_cast<RECT*>(lParam));
+ return 0;
- case BCM_ISBUTTONENABLED:
- assert(wParam >= 1 && wParam <= pCtrl->m_Items.size());
- return BOOL_(pCtrl->m_Items[wParam - 1].bEnabled);
+ case BCM_ISBUTTONENABLED:
+ assert(wParam >= 1 && wParam <= pCtrl->m_Items.size());
+ return BOOL_(pCtrl->m_Items[wParam - 1].bEnabled);
- case BCM_ENABLEBUTTON:
- pCtrl->onBCMEnableButton(wParam - 1, bool_(lParam));
- return 0;
+ case BCM_ENABLEBUTTON:
+ pCtrl->onBCMEnableButton(wParam - 1, bool_(lParam));
+ return 0;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
@@ -179,8 +175,7 @@ bool BandCtrlImpl::registerClass()
NULL // hIconSm
};
- if (!RegisterClassEx(&wcx))
- {
+ if (!RegisterClassEx(&wcx)) {
return false;
}
@@ -193,10 +188,10 @@ void BandCtrlImpl::unregisterClass()
}
BandCtrlImpl::BandCtrlImpl(HWND hWnd, int nOwnId)
- : m_hWnd(hWnd), m_nOwnId(nOwnId), m_hFont(NULL),
- m_hTheme(NULL), m_hImageList(NULL), m_hImageListD(NULL), m_hTooltip(NULL),
- m_nCurHot(-1), m_nCurFocused(-1), m_nCurPressed(-1), m_bCurPressedDD(false),
- m_nLayout(0), m_nDDWidth(12), m_hDDIcon(NULL)
+: m_hWnd(hWnd), m_nOwnId(nOwnId), m_hFont(NULL),
+m_hTheme(NULL), m_hImageList(NULL), m_hImageListD(NULL), m_hTooltip(NULL),
+m_nCurHot(-1), m_nCurFocused(-1), m_nCurPressed(-1), m_bCurPressedDD(false),
+m_nLayout(0), m_nDDWidth(12), m_hDDIcon(NULL)
{
m_IconSize.cx = m_IconSize.cy;
m_hDDIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(IDI_DROPDOWN), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0));
@@ -206,32 +201,27 @@ BandCtrlImpl::BandCtrlImpl(HWND hWnd, int nOwnId)
BandCtrlImpl::~BandCtrlImpl()
{
- if (m_hTooltip)
- {
+ if (m_hTooltip) {
DestroyWindow(m_hTooltip);
m_hTooltip = NULL;
}
- if (m_hImageList)
- {
+ if (m_hImageList) {
ImageList_Destroy(m_hImageList);
m_hImageList = NULL;
}
- if (m_hImageListD)
- {
+ if (m_hImageListD) {
ImageList_Destroy(m_hImageListD);
m_hImageListD = NULL;
}
- if (m_hTheme)
- {
- ThemeAPI::CloseThemeData(m_hTheme);
+ if (m_hTheme) {
+ CloseThemeData(m_hTheme);
m_hTheme = NULL;
}
- if (m_hDDIcon)
- {
+ if (m_hDDIcon) {
DestroyIcon(m_hDDIcon);
m_hDDIcon;
}
@@ -243,8 +233,7 @@ void BandCtrlImpl::onWMPaint()
PAINTSTRUCT ps;
HDC hRealDC;
- if (!(hRealDC = BeginPaint(m_hWnd, &ps)))
- {
+ if (!(hRealDC = BeginPaint(m_hWnd, &ps))) {
return;
}
@@ -256,7 +245,7 @@ void BandCtrlImpl::onWMPaint()
// setup memory DC for bufferd drawing
HDC hDC;
HBITMAP hMemBitmap, hOldBitmap;
-
+
hDC = CreateCompatibleDC(hRealDC);
hMemBitmap = CreateCompatibleBitmap(hRealDC, ps.rcPaint.right - ps.rcPaint.left, ps.rcPaint.bottom - ps.rcPaint.top);
hOldBitmap = reinterpret_cast<HBITMAP>(SelectObject(hDC, hMemBitmap));
@@ -269,8 +258,7 @@ void BandCtrlImpl::onWMPaint()
ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rOut, NULL, 0, NULL);
// draw top and bottom line
- if (bBandEnabled)
- {
+ if (bBandEnabled) {
RECT rLine = { rOut.left, rOut.top, rOut.right, rOut.top + 1 };
SetBkColor(hDC, GetSysColor(COLOR_3DSHADOW));
@@ -284,14 +272,13 @@ void BandCtrlImpl::onWMPaint()
HGDIOBJ hOldFont = SelectObject(hDC, m_hFont);
SIZE textSize;
- GetTextExtentPoint32(hDC, muT("X"), 1, &textSize);
+ GetTextExtentPoint32(hDC, _T("X"), 1, &textSize);
SetBkMode(hDC, TRANSPARENT);
SetTextColor(hDC, GetSysColor(bBandEnabled ? COLOR_BTNTEXT : COLOR_GRAYTEXT));
vector_each_(i, m_Items)
{
- if (m_Items[i].bVisible)
- {
+ if (m_Items[i].bVisible) {
drawButton(hDC, i, textSize.cy, bBandEnabled);
}
}
@@ -323,37 +310,30 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab
RECT rItem = item.rItem;
- if (item.bDropDown)
- {
+ if (item.bDropDown) {
RECT rDropDown = rItem;
rDropDown.left = rDropDown.right - m_nDDWidth;
rItem.right -= m_nDDWidth;
- if (m_hTheme)
- {
+ if (m_hTheme) {
int state = TS_DISABLED;
if (bEnabled)
- {
state = bPressed ? (m_bCurPressedDD ? TS_PRESSED : TS_HOT) : (item.bChecked ? (bHot ? TS_HOTCHECKED : TS_CHECKED) : (bHot ? TS_HOT : TS_NORMAL));
- }
- ThemeAPI::DrawThemeBackground(m_hTheme, hDC, TP_SPLITBUTTONDROPDOWN, state, &rDropDown, NULL);
+ DrawThemeBackground(m_hTheme, hDC, TP_SPLITBUTTONDROPDOWN, state, &rDropDown, NULL);
}
- else
- {
+ else {
--rDropDown.left;
UINT state = 0;
- if (bEnabled)
- {
+ if (bEnabled) {
state = bPressed ? (m_bCurPressedDD ? DFCS_FLAT | DFCS_PUSHED : DFCS_FLAT) : (bHot ? DFCS_FLAT : (item.bChecked ? DFCS_FLAT | DFCS_CHECKED : 0));
}
- if (state != 0)
- {
+ if (state != 0) {
DrawFrameControl(hDC, &rDropDown, DFC_BUTTON, DFCS_BUTTONPUSH | state);
}
@@ -364,37 +344,31 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab
}
}
- if (m_hTheme)
- {
+ if (m_hTheme) {
int state = TS_DISABLED;
int part = item.bDropDown ? TP_SPLITBUTTON : TP_BUTTON;
- if (bEnabled)
- {
+ if (bEnabled) {
state = bPressed ? (!m_bCurPressedDD ? TS_PRESSED : TS_HOT) : (item.bChecked ? (bHot ? TS_HOTCHECKED : TS_CHECKED) : (bHot ? TS_HOT : TS_NORMAL));
}
- ThemeAPI::DrawThemeBackground(m_hTheme, hDC, part, state, &rItem, NULL);
+ DrawThemeBackground(m_hTheme, hDC, part, state, &rItem, NULL);
}
- else
- {
+ else {
UINT state = 0;
- if (bEnabled)
- {
+ if (bEnabled) {
state = bPressed ? (!m_bCurPressedDD ? DFCS_FLAT | DFCS_PUSHED : DFCS_FLAT) : (bHot ? DFCS_FLAT : (item.bChecked ? DFCS_FLAT | DFCS_CHECKED : 0));
}
- if (state != 0)
- {
+ if (state != 0) {
DrawFrameControl(hDC, &rItem, DFC_BUTTON, DFCS_BUTTONPUSH | state);
}
}
InflateRect(&rItem, -3, -3);
- if (!item.text.empty())
- {
+ if (!item.text.empty()) {
RECT rText = rItem;
rText.top += (rItem.bottom - rItem.top + m_IconSize.cy - textHeight) / 2;
@@ -408,19 +382,16 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab
DT_TOP | DT_CENTER | DT_END_ELLIPSIS | DT_WORD_ELLIPSIS | DT_NOPREFIX | DT_SINGLELINE);
}
- if (item.nIcon != -1)
- {
+ if (item.nIcon != -1) {
int x = rItem.left + (rItem.right - rItem.left - m_IconSize.cx) / 2;
int y = rItem.top + (rItem.bottom - rItem.top - m_IconSize.cy) / 2;
- if (bPressed && !m_bCurPressedDD)
- {
+ if (bPressed && !m_bCurPressedDD) {
++x;
++y;
}
- if (bEnabled)
- {
+ if (bEnabled) {
ImageList_Draw(
m_hImageList,
item.nIcon,
@@ -429,8 +400,7 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab
y,
ILD_NORMAL);
}
- else if (item.nIconD != -1)
- {
+ else if (item.nIconD != -1) {
ImageList_Draw(
m_hImageListD,
item.nIconD,
@@ -439,8 +409,7 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab
y,
ILD_NORMAL);
}
- else
- {
+ else {
HICON hIcon = ImageList_GetIcon(m_hImageList, item.nIcon, 0);
DrawState(hDC, NULL, NULL, reinterpret_cast<LPARAM>(hIcon), 0, x, y, m_IconSize.cx, m_IconSize.cy, DST_ICON | DSS_DISABLED);
@@ -448,8 +417,7 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab
}
}
- if (bFocused)
- {
+ if (bFocused) {
rItem = item.rItem;
InflateRect(&rItem, -2, -2);
@@ -459,29 +427,14 @@ void BandCtrlImpl::drawButton(HDC hDC, int nItem, int textHeight, bool bBandEnab
void BandCtrlImpl::reloadTheme()
{
- if (m_hTheme)
- {
- ThemeAPI::CloseThemeData(m_hTheme);
+ if (m_hTheme) {
+ CloseThemeData(m_hTheme);
m_hTheme = NULL;
}
m_nDDWidth = 12;
- if (ThemeAPI::useTheme())
- {
- m_hTheme = ThemeAPI::OpenThemeData(0, muW("TOOLBAR"));
-
- /*
- SIZE sizeMin;
- HDC hDC = GetDC(NULL);
-
- ThemeAPI::GetThemePartSize(m_hTheme, hDC, TP_SPLITBUTTONDROPDOWN, TS_NORMAL, NULL, TS_DRAW, &sizeMin);
- ReleaseDC(NULL, hDC);
-
- m_nDDWidth = sizeMin.cx;
- */
- }
-
+ m_hTheme = OpenThemeData(0, L"TOOLBAR");
recalcButtonRects();
}
@@ -494,26 +447,21 @@ HICON BandCtrlImpl::convertToGray(HICON hIcon)
HICON hIconDisabled = NULL;
ICONINFO ii;
- if (!GetIconInfo(hIcon, &ii))
- {
+ if (!GetIconInfo(hIcon, &ii)) {
return NULL;
}
BITMAP bmp;
- if (GetObject(ii.hbmColor, sizeof(bmp), &bmp) && bmp.bmBitsPixel == 32)
- {
+ if (GetObject(ii.hbmColor, sizeof(bmp), &bmp) && bmp.bmBitsPixel == 32) {
int nSize = bmp.bmHeight * bmp.bmWidthBytes;
BYTE* pBits = new BYTE[nSize];
- if (GetBitmapBits(ii.hbmColor, nSize, pBits))
- {
- for (int y = 0; y < bmp.bmHeight; ++y)
- {
+ if (GetBitmapBits(ii.hbmColor, nSize, pBits)) {
+ for (int y = 0; y < bmp.bmHeight; ++y) {
BYTE* pLine = pBits + y * bmp.bmWidthBytes;
- for (int x = 0; x < bmp.bmWidth; ++x)
- {
+ for (int x = 0; x < bmp.bmWidth; ++x) {
DWORD color = reinterpret_cast<DWORD*>(pLine)[x];
BYTE gray = (77 * GetBValue(color) + 150 * GetGValue(color) + 28 * GetRValue(color)) / 255;
@@ -545,32 +493,28 @@ int BandCtrlImpl::onBCMAddButton(BCBUTTON* pButton)
ItemData& id = m_Items.back();
- id.bRight = bool_(pButton->dwFlags & BCF_RIGHT);
- id.bChecked = bool_(pButton->dwFlags & BCF_CHECKED);
- id.bVisible = !(pButton->dwFlags & BCF_HIDDEN);
+ id.bRight = bool_(pButton->dwFlags & BCF_RIGHT);
+ id.bChecked = bool_(pButton->dwFlags & BCF_CHECKED);
+ id.bVisible = !(pButton->dwFlags & BCF_HIDDEN);
id.bDropDown = bool_(pButton->dwFlags & BCF_DROPDOWN);
- id.text = (pButton->dwFlags & BCF_TEXT) ? pButton->szText : muT("");
- id.tooltip = (pButton->dwFlags & BCF_TOOLTIP) ? pButton->szTooltip : muT("");
- id.uTTId = -1;
- id.dwData = (pButton->dwFlags & BCF_DATA) ? pButton->dwData : 0;
- id.bEnabled = !(pButton->dwFlags & BCF_DISABLED);
- id.nIcon = -1;
- id.nIconD = -1;
-
- if (pButton->dwFlags & BCF_ICON)
- {
+ id.text = (pButton->dwFlags & BCF_TEXT) ? pButton->szText : _T("");
+ id.tooltip = (pButton->dwFlags & BCF_TOOLTIP) ? pButton->szTooltip : _T("");
+ id.uTTId = -1;
+ id.dwData = (pButton->dwFlags & BCF_DATA) ? pButton->dwData : 0;
+ id.bEnabled = !(pButton->dwFlags & BCF_DISABLED);
+ id.nIcon = -1;
+ id.nIconD = -1;
+
+ if (pButton->dwFlags & BCF_ICON) {
// create an image list, if needed
- if (!m_hImageList)
- {
+ if (!m_hImageList) {
// guess image size from first inserted icon
ICONINFO ii;
- if (GetIconInfo(pButton->hIcon, &ii))
- {
+ if (GetIconInfo(pButton->hIcon, &ii)) {
BITMAP bmp;
- if (GetObject(ii.hbmColor, sizeof(bmp), &bmp))
- {
+ if (GetObject(ii.hbmColor, sizeof(bmp), &bmp)) {
m_IconSize.cx = bmp.bmWidth;
m_IconSize.cy = bmp.bmHeight;
}
@@ -588,10 +532,8 @@ int BandCtrlImpl::onBCMAddButton(BCBUTTON* pButton)
// insert disabled icon into image list
HICON hIconDisabled = convertToGray(pButton->hIcon);
- if (hIconDisabled)
- {
- if (!m_hImageListD)
- {
+ if (hIconDisabled) {
+ if (!m_hImageListD) {
m_hImageListD = ImageList_Create(m_IconSize.cx, m_IconSize.cy, OS::imageListColor() | ILC_MASK, 5, 5);
}
@@ -604,8 +546,7 @@ int BandCtrlImpl::onBCMAddButton(BCBUTTON* pButton)
// atomatically adds tooltip, if needed
recalcButtonRects();
- if (id.bVisible)
- {
+ if (id.bVisible) {
InvalidateRect(m_hWnd, &id.rItem, TRUE);
}
@@ -618,8 +559,7 @@ void BandCtrlImpl::onBCMCheckButton(int nItem, bool bCheck)
ItemData& id = m_Items[nItem];
- if (bCheck != id.bChecked)
- {
+ if (bCheck != id.bChecked) {
id.bChecked = bCheck;
InvalidateRect(m_hWnd, &id.rItem, TRUE);
}
@@ -631,8 +571,7 @@ void BandCtrlImpl::onBCMShowButton(int nItem, bool bShow)
ItemData& id = m_Items[nItem];
- if (bShow != id.bVisible)
- {
+ if (bShow != id.bVisible) {
id.bVisible = bShow;
recalcButtonRects();
InvalidateRect(m_hWnd, NULL, TRUE);
@@ -653,8 +592,7 @@ void BandCtrlImpl::onBCMEnableButton(int nItem, bool bEnable)
ItemData& id = m_Items[nItem];
- if (bEnable != id.bEnabled)
- {
+ if (bEnable != id.bEnabled) {
id.bEnabled = bEnable;
InvalidateRect(m_hWnd, NULL, TRUE);
}
@@ -666,12 +604,11 @@ void BandCtrlImpl::recalcButtonRects()
GetClientRect(m_hWnd, &rOut);
InflateRect(&rOut, -2, -3);
-
+
int itemHeight = rOut.bottom - rOut.top;
int itemWidth = itemHeight;
- if (m_nLayout > 0)
- {
+ if (m_nLayout > 0) {
itemWidth = (rOut.right - rOut.left) / m_nLayout;
}
@@ -680,27 +617,23 @@ void BandCtrlImpl::recalcButtonRects()
vector_each_(i, m_Items)
{
- if (m_Items[i].bVisible)
- {
+ if (m_Items[i].bVisible) {
// visible: give it a rect and advance
int nDDWidth = (m_Items[i].bDropDown && m_nLayout == 0) ? m_nDDWidth : 0;
- if (m_Items[i].bRight)
- {
+ if (m_Items[i].bRight) {
m_Items[i].rItem = rItemR;
m_Items[i].rItem.left -= nDDWidth;
OffsetRect(&rItemR, -(itemWidth + nDDWidth), 0);
}
- else
- {
+ else {
m_Items[i].rItem = rItemL;
m_Items[i].rItem.right += nDDWidth;
OffsetRect(&rItemL, itemWidth + nDDWidth, 0);
}
}
- if (m_Items[i].uTTId != -1 && m_Items[i].bVisible)
- {
+ if (m_Items[i].uTTId != -1 && m_Items[i].bVisible) {
// update tooltip rect, if we have a tooltip and are still visible
TOOLINFO ti = {
sizeof(TOOLINFO), // cbSize
@@ -709,31 +642,25 @@ void BandCtrlImpl::recalcButtonRects()
m_Items[i].uTTId, // uId
m_Items[i].rItem, // rect
NULL, // hInstance
- const_cast<mu_text*>(m_Items[i].tooltip.c_str()), // lpszText
+ const_cast<TCHAR*>(m_Items[i].tooltip.c_str()), // lpszText
};
SendMessage(m_hTooltip, TTM_SETTOOLINFO, 0, reinterpret_cast<LPARAM>(&ti));
}
- else if (m_Items[i].uTTId != -1 && !m_Items[i].bVisible)
- {
+ else if (m_Items[i].uTTId != -1 && !m_Items[i].bVisible) {
// remove tooltip, if we have a tooltip but are no longer visible
TOOLINFO ti;
-
ti.cbSize = sizeof(TOOLINFO);
ti.hwnd = m_hWnd;
ti.uId = m_Items[i].uTTId;
-
- SendMessage(m_hTooltip , TTM_DELTOOL, 0, reinterpret_cast<LPARAM>(&ti));
+ SendMessage(m_hTooltip, TTM_DELTOOL, 0, reinterpret_cast<LPARAM>(&ti));
m_Items[i].uTTId = -1;
}
- else if (m_Items[i].uTTId == -1 && m_Items[i].bVisible && !m_Items[i].tooltip.empty())
- {
+ else if (m_Items[i].uTTId == -1 && m_Items[i].bVisible && !m_Items[i].tooltip.empty()) {
// add a tooltip, if we don't have a tooltip but are now visible
if (!m_hTooltip)
- {
- m_hTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, muT(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, g_hInst, NULL);
- }
+ m_hTooltip = CreateWindowEx(WS_EX_TOPMOST, TOOLTIPS_CLASS, _T(""), WS_POPUP, 0, 0, 0, 0, NULL, NULL, g_hInst, NULL);
TOOLINFO ti = {
sizeof(TOOLINFO), // cbSize
@@ -742,21 +669,18 @@ void BandCtrlImpl::recalcButtonRects()
i + 1, // uId
m_Items[i].rItem, // rect
NULL, // hInstance
- const_cast<mu_text*>(m_Items[i].tooltip.c_str()), // lpszText
+ const_cast<TCHAR*>(m_Items[i].tooltip.c_str()), // lpszText
};
if (SendMessage(m_hTooltip, TTM_ADDTOOL, 0, reinterpret_cast<LPARAM>(&ti)))
- {
m_Items[i].uTTId = ti.uId;
- }
}
}
}
int BandCtrlImpl::getNextButton(int nItem)
{
- if (nItem < 0 || nItem >= m_Items.size())
- {
+ if (nItem < 0 || nItem >= m_Items.size()) {
nItem = -1;
}
@@ -767,9 +691,7 @@ int BandCtrlImpl::getNextButton(int nItem)
vector_each_(i, m_Items)
{
if (m_Items[i].bVisible && !m_Items[i].bRight)
- {
nLastLeft = i;
- }
}
vector_each_(i, m_Items)
@@ -777,25 +699,18 @@ int BandCtrlImpl::getNextButton(int nItem)
if (!m_Items[i].bVisible)
continue;
- if (nItem == nLastLeft)
- {
+ if (nItem == nLastLeft) {
if (m_Items[i].bRight)
- {
nNext = i;
- }
}
- else if (!bLeft)
- {
- if (m_Items[i].bRight && i < nItem)
- {
+ else if (!bLeft) {
+ if (m_Items[i].bRight && i < nItem) {
nNext = i;
break;
}
}
- else
- {
- if (!m_Items[i].bRight && i > nNext)
- {
+ else {
+ if (!m_Items[i].bRight && i > nNext) {
nNext = i;
break;
}
@@ -808,9 +723,7 @@ int BandCtrlImpl::getNextButton(int nItem)
int BandCtrlImpl::getPrevButton(int nItem)
{
if (nItem < 0 || nItem >= m_Items.size())
- {
nItem = -1;
- }
int nPrev = nItem;
int nFirstRight = -1;
@@ -819,9 +732,7 @@ int BandCtrlImpl::getPrevButton(int nItem)
vector_each_(i, m_Items)
{
if (m_Items[i].bVisible && m_Items[i].bRight)
- {
nFirstRight = i;
- }
}
vector_each_(i, m_Items)
@@ -829,24 +740,16 @@ int BandCtrlImpl::getPrevButton(int nItem)
if (!m_Items[i].bVisible)
continue;
- if (!bRight)
- {
+ if (!bRight) {
if (!m_Items[i].bRight && i < nItem)
- {
nPrev = i;
- }
}
- else if (nItem == nFirstRight)
- {
+ else if (nItem == nFirstRight) {
if (!m_Items[i].bRight)
- {
nPrev = i;
- }
}
- else
- {
- if (m_Items[i].bRight && i > nPrev)
- {
+ else {
+ if (m_Items[i].bRight && i > nPrev) {
nPrev = i;
break;
}
@@ -859,72 +762,49 @@ int BandCtrlImpl::getPrevButton(int nItem)
void BandCtrlImpl::fireEvent(UINT code, int nItem)
{
NMBANDCTRL nmbc;
-
nmbc.hdr.code = code;
nmbc.hdr.hwndFrom = m_hWnd;
nmbc.hdr.idFrom = m_nOwnId;
nmbc.hButton = reinterpret_cast<HANDLE>(nItem + 1);
nmbc.dwData = m_Items[nItem].dwData;
-
SendMessage(GetParent(m_hWnd), WM_NOTIFY, nmbc.hdr.idFrom, reinterpret_cast<LPARAM>(&nmbc));
}
void BandCtrlImpl::onWMSetFocus()
{
- /*
- int nFirst = getNextItem(-1);
-
- if (nFirst != -1)
- {
- m_nCurFocused = nFirst;
- InvalidateRect(m_hWnd, NULL, TRUE);
- }
- */
-
m_nCurFocused = -1;
}
-
void BandCtrlImpl::onWMKeyDown(int nVirtKey)
{
if (GetKeyState(VK_CONTROL) & ~1 || GetKeyState(VK_SHIFT) & ~1)
- {
return;
- }
- if (nVirtKey == VK_RIGHT)
- {
+ if (nVirtKey == VK_RIGHT) {
int nNext = getNextButton(m_nCurFocused);
-
- if (nNext != -1 && nNext != m_nCurFocused)
- {
+
+ if (nNext != -1 && nNext != m_nCurFocused) {
m_nCurFocused = nNext;
InvalidateRect(m_hWnd, NULL, TRUE);
}
}
- else if (nVirtKey == VK_LEFT)
- {
+ else if (nVirtKey == VK_LEFT) {
int nPrev = getPrevButton(m_nCurFocused);
- if (nPrev != -1 && nPrev != m_nCurFocused)
- {
+ if (nPrev != -1 && nPrev != m_nCurFocused) {
m_nCurFocused = nPrev;
InvalidateRect(m_hWnd, NULL, TRUE);
}
}
- else if (nVirtKey == VK_SPACE)
- {
- if (m_nCurFocused != -1 && m_nCurFocused < m_Items.size() && m_Items[m_nCurFocused].bEnabled)
- {
+ else if (nVirtKey == VK_SPACE) {
+ if (m_nCurFocused != -1 && m_nCurFocused < m_Items.size() && m_Items[m_nCurFocused].bEnabled) {
m_nCurPressed = m_nCurFocused;
m_bCurPressedDD = false;
InvalidateRect(m_hWnd, &m_Items[m_nCurPressed].rItem, TRUE);
}
}
- else if (nVirtKey == VK_DOWN)
- {
- if (m_nCurFocused != -1 && m_nCurFocused < m_Items.size() && m_Items[m_nCurFocused].bDropDown && m_Items[m_nCurFocused].bEnabled)
- {
+ else if (nVirtKey == VK_DOWN) {
+ if (m_nCurFocused != -1 && m_nCurFocused < m_Items.size() && m_Items[m_nCurFocused].bDropDown && m_Items[m_nCurFocused].bEnabled) {
m_nCurPressed = m_nCurFocused;
m_bCurPressedDD = true;
InvalidateRect(m_hWnd, &m_Items[m_nCurPressed].rItem, TRUE);
@@ -941,16 +821,11 @@ void BandCtrlImpl::onWMKeyDown(int nVirtKey)
void BandCtrlImpl::onWMKeyUp(int nVirtKey)
{
if (GetKeyState(VK_CONTROL) & ~1 || GetKeyState(VK_SHIFT) & ~1)
- {
return;
- }
- if (nVirtKey == VK_SPACE && m_nCurPressed != -1 && m_nCurPressed < m_Items.size())
- {
+ if (nVirtKey == VK_SPACE && m_nCurPressed != -1 && m_nCurPressed < m_Items.size()) {
if (m_nCurFocused == m_nCurPressed)
- {
fireEvent(BCN_CLICKED, m_nCurPressed);
- }
InvalidateRect(m_hWnd, &m_Items[m_nCurPressed].rItem, TRUE);
m_nCurPressed = -1;
@@ -965,30 +840,24 @@ void BandCtrlImpl::onWMMouseLeave()
m_nCurHot = -1;
if (nOldHot != -1 && nOldHot < m_Items.size())
- {
InvalidateRect(m_hWnd, &m_Items[nOldHot].rItem, TRUE);
- }
}
void BandCtrlImpl::onWMMouseMove(POINTS pts)
{
POINT pt = { pts.x, pts.y };
- if (m_nCurHot != -1 && m_nCurHot < m_Items.size())
- {
- if (!PtInRect(&m_Items[m_nCurHot].rItem, pt))
- {
+ if (m_nCurHot != -1 && m_nCurHot < m_Items.size()) {
+ if (!PtInRect(&m_Items[m_nCurHot].rItem, pt)) {
InvalidateRect(m_hWnd, &m_Items[m_nCurHot].rItem, TRUE);
m_nCurHot = -1;
}
}
- if (m_nCurHot == -1)
- {
+ if (m_nCurHot == -1) {
vector_each_(i, m_Items)
{
- if (PtInRect(&m_Items[i].rItem, pt) && m_Items[i].bVisible)
- {
+ if (PtInRect(&m_Items[i].rItem, pt) && m_Items[i].bVisible) {
m_nCurHot = i;
InvalidateRect(m_hWnd, &m_Items[i].rItem, TRUE);
break;
@@ -996,8 +865,7 @@ void BandCtrlImpl::onWMMouseMove(POINTS pts)
}
}
- if (m_nCurHot != -1)
- {
+ if (m_nCurHot != -1) {
SetTimer(m_hWnd, m_PollId, m_PollDelay, NULL);
}
}
@@ -1006,23 +874,19 @@ void BandCtrlImpl::onWMLButtonDown(POINTS pts)
{
POINT pt = { pts.x, pts.y };
- if (m_nCurHot != -1 && m_nCurHot < m_Items.size() && m_Items[m_nCurHot].bEnabled)
- {
- if (PtInRect(&m_Items[m_nCurHot].rItem, pt))
- {
+ if (m_nCurHot != -1 && m_nCurHot < m_Items.size() && m_Items[m_nCurHot].bEnabled) {
+ if (PtInRect(&m_Items[m_nCurHot].rItem, pt)) {
m_nCurPressed = m_nCurHot;
m_bCurPressedDD = false;
InvalidateRect(m_hWnd, &m_Items[m_nCurPressed].rItem, TRUE);
SetCapture(m_hWnd);
- if (m_Items[m_nCurHot].bDropDown)
- {
+ if (m_Items[m_nCurHot].bDropDown) {
RECT rDropDown = m_Items[m_nCurHot].rItem;
rDropDown.left = rDropDown.right - m_nDDWidth;
- if (PtInRect(&rDropDown, pt))
- {
+ if (PtInRect(&rDropDown, pt)) {
ReleaseCapture();
m_bCurPressedDD = true;
@@ -1041,14 +905,11 @@ void BandCtrlImpl::onWMLButtonUp(POINTS pts)
{
POINT pt = { pts.x, pts.y };
- if (m_nCurPressed != -1 && m_nCurPressed < m_Items.size())
- {
+ if (m_nCurPressed != -1 && m_nCurPressed < m_Items.size()) {
ReleaseCapture();
if (PtInRect(&m_Items[m_nCurPressed].rItem, pt))
- {
fireEvent(BCN_CLICKED, m_nCurPressed);
- }
InvalidateRect(m_hWnd, &m_Items[m_nCurPressed].rItem, TRUE);
m_nCurPressed = -1;
diff --git a/plugins/HistoryStats/src/bandctrlimpl.h b/plugins/HistoryStats/src/bandctrlimpl.h
index 7aa9ce8abb..4696325246 100644
--- a/plugins/HistoryStats/src/bandctrlimpl.h
+++ b/plugins/HistoryStats/src/bandctrlimpl.h
@@ -6,8 +6,6 @@
#include <vector>
-#include "themeapi.h"
-
/*
* BandCtrlImpl
*/
@@ -33,7 +31,7 @@ private:
};
private:
- static const mu_text* m_ClassName;
+ static const TCHAR* m_ClassName;
static const int m_PollId;
static const int m_PollDelay;
diff --git a/plugins/HistoryStats/src/canvas.cpp b/plugins/HistoryStats/src/canvas.cpp
index 54f87dec45..9830e36f07 100644
--- a/plugins/HistoryStats/src/canvas.cpp
+++ b/plugins/HistoryStats/src/canvas.cpp
@@ -7,27 +7,21 @@ void Canvas::updateTrans(BYTE* pData)
assert(m_nChannels == 4);
// apply transparency, if any
- if (m_bTransColor)
- {
- for (int y = 0; y < m_nHeight; ++y)
- {
+ if (m_bTransColor) {
+ for (int y = 0; y < m_nHeight; ++y) {
COLORREF* pValue = reinterpret_cast<COLORREF*>(pData + y * m_nLineLength);
- for (int x = 0; x < m_nWidth; ++x)
- {
+ for (int x = 0; x < m_nWidth; ++x) {
*pValue = (*pValue & 0x00FFFFFF) | ((*pValue & 0x00FFFFFF) == m_TransColor ? 0x00000000 : 0xFF000000);
++pValue;
}
}
}
- else
- {
- for (int y = 0; y < m_nHeight; ++y)
- {
+ else {
+ for (int y = 0; y < m_nHeight; ++y) {
COLORREF* pValue = reinterpret_cast<COLORREF*>(pData + y * m_nLineLength);
- for (int x = 0; x < m_nWidth; ++x)
- {
+ for (int x = 0; x < m_nWidth; ++x) {
*pValue |= 0xFF000000;
++pValue;
}
@@ -35,33 +29,26 @@ void Canvas::updateTrans(BYTE* pData)
}
}
-Canvas::Canvas(int nWidth, int nHeight)
- : m_nChannels(4)
- , m_nWidth(nWidth)
- , m_nHeight(nHeight)
- , m_nLineLength((m_nChannels * m_nWidth + 3) & ~0x3)
- , m_bTransColor(false)
- , m_TransColor(0)
- , m_pBMIH(NULL)
-{
-}
+Canvas::Canvas(int nWidth, int nHeight) :
+ m_nChannels(4),
+ m_nWidth(nWidth),
+ m_nHeight(nHeight),
+ m_nLineLength((m_nChannels * m_nWidth + 3) & ~0x3),
+ m_bTransColor(false),
+ m_TransColor(0),
+ m_pBMIH(NULL)
+{}
Canvas::~Canvas()
{
if (m_hOldBmp)
- {
SelectObject(m_hDC, m_hOldBmp);
- }
if (m_hBmp)
- {
DeleteObject(m_hBmp);
- }
if (m_hDC)
- {
DeleteDC(m_hDC);
- }
delete m_pBMIH;
}
@@ -72,9 +59,7 @@ void Canvas::setTrans(COLORREF transColor, bool bFill /* = false */)
m_TransColor = transColor;
if (bFill)
- {
fillBackground(transColor);
- }
}
void Canvas::fillBackground(COLORREF bkColor)
@@ -91,8 +76,7 @@ void Canvas::fillBackground(COLORREF bkColor)
HDC Canvas::beginDraw()
{
- if (!m_pBMIH)
- {
+ if (!m_pBMIH) {
m_pBMIH = new BITMAPINFOHEADER;
m_pBMIH->biSize = sizeof(BITMAPINFOHEADER);
@@ -136,8 +120,7 @@ bool Canvas::getDigest(Digest& digest)
ZeroMemory(pData, nSize);
- if (GetDIBits(m_hDC, m_hBmp, 0, m_nHeight, pData, reinterpret_cast<BITMAPINFO*>(m_pBMIH), DIB_RGB_COLORS) != m_nHeight)
- {
+ if (GetDIBits(m_hDC, m_hBmp, 0, m_nHeight, pData, reinterpret_cast<BITMAPINFO*>(m_pBMIH), DIB_RGB_COLORS) != m_nHeight) {
delete[] pData;
return false;
}
@@ -152,15 +135,13 @@ bool Canvas::getDigest(Digest& digest)
return true;
}
-bool Canvas::writePNG(const mu_text* szFileName)
+bool Canvas::writePNG(const TCHAR* szFileName)
{
// read data from DIB
BYTE* pData = new BYTE[m_nLineLength * m_nHeight];
- if (GetDIBits(m_hDC, m_hBmp, 0, m_nHeight, pData, reinterpret_cast<BITMAPINFO*>(m_pBMIH), DIB_RGB_COLORS) != m_nHeight)
- {
+ if (GetDIBits(m_hDC, m_hBmp, 0, m_nHeight, pData, reinterpret_cast<BITMAPINFO*>(m_pBMIH), DIB_RGB_COLORS) != m_nHeight) {
delete[] pData;
-
return false;
}
@@ -170,10 +151,8 @@ bool Canvas::writePNG(const mu_text* szFileName)
// calculate resulting image size
long png_len = 0;
- if (!mu::png::dibToPng(m_pBMIH, pData, 0, &png_len) || png_len == 0)
- {
+ if (!mu::png::dibToPng(m_pBMIH, pData, 0, &png_len) || png_len == 0) {
delete[] pData;
-
return false;
}
@@ -182,8 +161,7 @@ bool Canvas::writePNG(const mu_text* szFileName)
png_len = 0;
- if (!mu::png::dibToPng(m_pBMIH, pData, pRawPNG, &png_len))
- {
+ if (!mu::png::dibToPng(m_pBMIH, pData, pRawPNG, &png_len)) {
delete[] pData;
delete[] pRawPNG;
@@ -191,10 +169,9 @@ bool Canvas::writePNG(const mu_text* szFileName)
}
// write image data to file
- FILE* fp = _tfopen(szFileName, muT("wb"));
+ FILE* fp = _tfopen(szFileName, _T("wb"));
- if (!fp)
- {
+ if (!fp) {
delete[] pData;
delete[] pRawPNG;
diff --git a/plugins/HistoryStats/src/canvas.h b/plugins/HistoryStats/src/canvas.h
index 6b3c40e70e..022b71dc8a 100644
--- a/plugins/HistoryStats/src/canvas.h
+++ b/plugins/HistoryStats/src/canvas.h
@@ -51,7 +51,7 @@ public:
void endDraw();
bool getDigest(Digest& digest);
- bool writePNG(const mu_text* szFileName);
+ bool writePNG(const TCHAR* szFileName);
};
#endif // HISTORYSTATS_GUARD_CANVAS_H
diff --git a/plugins/HistoryStats/src/colbase_words.cpp b/plugins/HistoryStats/src/colbase_words.cpp
index 9325d2a421..74e03ef290 100644
--- a/plugins/HistoryStats/src/colbase_words.cpp
+++ b/plugins/HistoryStats/src/colbase_words.cpp
@@ -83,63 +83,49 @@ void ColBaseWords::addWord(WordMap* pWords, const ext::string& word, bool bOutgo
void ColBaseWords::parseMsg(WordMap* pWords, const ext::string& msg, bool bOutgoing) const
{
// filter messages
- if (m_bFilterMessages)
- {
+ if (m_bFilterMessages) {
ext::string msgLC = utils::toLowerCase(msg);
upto_each_(i, m_ActiveMessageFilter.size())
{
const Filter* pFilter = m_ActiveMessageFilter[i];
- switch (pFilter->getMode())
- {
- case Settings::fwmMessagesMatching:
- {
- citer_each_(WordSet, j, pFilter->getWords())
- {
- if (msgLC == *j)
- {
- return;
- }
- }
+ switch (pFilter->getMode()) {
+ case Settings::fwmMessagesMatching:
+ citer_each_(WordSet, j, pFilter->getWords())
+ {
+ if (msgLC == *j) {
+ return;
}
- break;
-
- case Settings::fwmMessagesContaining:
- {
- citer_each_(WordSet, j, pFilter->getWords())
- {
- if (msgLC.find(*j) != ext::string::npos)
- {
- return;
- }
- }
+ }
+ break;
+
+ case Settings::fwmMessagesContaining:
+ citer_each_(WordSet, j, pFilter->getWords())
+ {
+ if (msgLC.find(*j) != ext::string::npos) {
+ return;
}
- break;
-
- case Settings::fwmMessagesStartingWith:
- {
- citer_each_(WordSet, j, pFilter->getWords())
- {
- if (msgLC.length() >= j->length() && msgLC.substr(0, j->length()) == *j)
- {
- return;
- }
- }
+ }
+ break;
+
+ case Settings::fwmMessagesStartingWith:
+ citer_each_(WordSet, j, pFilter->getWords())
+ {
+ if (msgLC.length() >= j->length() && msgLC.substr(0, j->length()) == *j) {
+ return;
}
- break;
-
- case Settings::fwmMessagesEndingWith:
- {
- citer_each_(WordSet, j, pFilter->getWords())
- {
- if (msgLC.length() >= j->length() && msgLC.substr(msgLC.length() - j->length(), j->length()) == *j)
- {
- return;
- }
- }
+ }
+ break;
+
+ case Settings::fwmMessagesEndingWith:
+ citer_each_(WordSet, j, pFilter->getWords())
+ {
+ if (msgLC.length() >= j->length() && msgLC.substr(msgLC.length() - j->length(), j->length()) == *j) {
+ return;
}
- break;
+ }
+ break;
}
}
}
@@ -148,25 +134,19 @@ void ColBaseWords::parseMsg(WordMap* pWords, const ext::string& msg, bool bOutgo
ext::string::size_type firstChar = 0;
ext::string::size_type nextSpace;
- while (firstChar < msg.length() && getCharMapper()->mapChar(msg[firstChar]) == muC(' '))
- {
+ while (firstChar < msg.length() && getCharMapper()->mapChar(msg[firstChar]) == ' ')
++firstChar;
- }
- while (firstChar < msg.length())
- {
+ while (firstChar < msg.length()) {
nextSpace = firstChar + 1;
- while (nextSpace < msg.length() && getCharMapper()->mapChar(msg[nextSpace]) != muC(' '))
- {
+ while (nextSpace < msg.length() && getCharMapper()->mapChar(msg[nextSpace]) != ' ')
++nextSpace;
- }
int wordLen = nextSpace - firstChar;
- if (wordLen >= m_nMinLength && (m_nMaxLength == 0 || wordLen <= m_nMaxLength))
- {
- ext::string word(wordLen, muC('_'));
+ if (wordLen >= m_nMinLength && (m_nMaxLength == 0 || wordLen <= m_nMaxLength)) {
+ ext::string word(wordLen, '_');
upto_each_(i, wordLen)
{
@@ -178,10 +158,8 @@ void ColBaseWords::parseMsg(WordMap* pWords, const ext::string& msg, bool bOutgo
firstChar = nextSpace + 1;
- while (firstChar < msg.length() && getCharMapper()->mapChar(msg[firstChar]) == muC(' '))
- {
+ while (firstChar < msg.length() && getCharMapper()->mapChar(msg[firstChar]) == ' ')
++firstChar;
- }
}
}
@@ -216,7 +194,7 @@ void ColBaseWords::impl_configRead(const SettingsTree& settings)
upto_each_(i, nCount)
{
- m_FilterWords.insert(settings.readStr((con::KeyFilterWords + utils::intToString(i)).c_str(), muT("")));
+ m_FilterWords.insert(settings.readStr((con::KeyFilterWords + utils::intToString(i)).c_str(), _T("")));
}
}
@@ -242,14 +220,14 @@ void ColBaseWords::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
{
OptionsCtrl::Group hTemp;
- /**/hTemp = Opt.insertGroup (hGroup, i18n(muT("Extract words from")));
- /**/ m_hSource = Opt.insertRadio (hTemp, NULL, i18n(muT("Incoming messages")));
- /**/ Opt.insertRadio (hTemp, m_hSource, i18n(muT("Outgoing messages")));
- /**/ Opt.insertRadio (hTemp, m_hSource, i18n(muT("All messages")));
- /**/m_hMinLength = Opt.insertEdit (hGroup, i18n(muT("Ignore words shorter than (chars)")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/m_hMaxLength = Opt.insertEdit (hGroup, i18n(muT("Ignore words longer than (chars, 0=no limit)")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/m_hFilterLinks = Opt.insertCheck (hGroup, i18n(muT("Filter URLs/e-mail addresses")));
- /**/ Opt.insertButton(hGroup, i18n(muT("Filter words/messages")), i18n(muT("Define...")), 0, Settings::biFilterWords);
+ hTemp = Opt.insertGroup (hGroup, TranslateT("Extract words from"));
+ m_hSource = Opt.insertRadio (hTemp, NULL, TranslateT("Incoming messages"));
+ Opt.insertRadio (hTemp, m_hSource, TranslateT("Outgoing messages"));
+ Opt.insertRadio (hTemp, m_hSource, TranslateT("All messages"));
+ m_hMinLength = Opt.insertEdit(hGroup, TranslateT("Ignore words shorter than (chars)"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hMaxLength = Opt.insertEdit(hGroup, TranslateT("Ignore words longer than (chars, 0=no limit)"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hFilterLinks = Opt.insertCheck(hGroup, TranslateT("Filter URLs/e-mail addresses"));
+ Opt.insertButton(hGroup, TranslateT("Filter words/messages"), TranslateT("Define..."), 0, Settings::biFilterWords);
Opt.setRadioChecked(m_hSource , m_nSource );
Opt.setEditNumber (m_hMinLength , m_nMinLength );
@@ -259,10 +237,10 @@ void ColBaseWords::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
void ColBaseWords::impl_configFromUI(OptionsCtrl& Opt)
{
- m_nSource = Opt.getRadioChecked(m_hSource );
- m_nMinLength = Opt.getEditNumber (m_hMinLength );
- m_nMaxLength = Opt.getEditNumber (m_hMaxLength );
- m_bFilterLinks = Opt.isItemChecked (m_hFilterLinks);
+ m_nSource = Opt.getRadioChecked(m_hSource);
+ m_nMinLength = Opt.getEditNumber(m_hMinLength);
+ m_nMaxLength = Opt.getEditNumber(m_hMaxLength);
+ m_bFilterLinks = Opt.isItemChecked(m_hFilterLinks);
// ensure constraints
utils::ensureRange(m_nMinLength, 1, 1000, 1);
@@ -271,15 +249,15 @@ void ColBaseWords::impl_configFromUI(OptionsCtrl& Opt)
ext::string ColBaseWords::impl_contactDataGetUID() const
{
- ext::string strUID = ext::str(ext::format(muT("words-|-|-|-|"))
- % m_nSource
- % m_nMinLength
- % m_nMaxLength
- % (m_bFilterLinks ? 1 : 0));
+ ext::string strUID = ext::str(ext::format(_T("words-|-|-|-|"))
+ % m_nSource
+ % m_nMinLength
+ % m_nMaxLength
+ % (m_bFilterLinks ? 1 : 0));
citer_each_(ColFilterSet, i, m_FilterWords)
{
- strUID += muT("-");
+ strUID += _T("-");
strUID += *i;
}
@@ -297,25 +275,23 @@ void ColBaseWords::impl_contactDataBeginAcquire()
{
const Filter* pFilter = getSettings()->getFilter(*i);
- if (pFilter && !pFilter->getWords().empty())
- {
- switch (pFilter->getMode())
- {
- case Settings::fwmMessagesMatching:
- case Settings::fwmMessagesContaining:
- case Settings::fwmMessagesStartingWith:
- case Settings::fwmMessagesEndingWith:
- m_ActiveMessageFilter.push_back(pFilter);
- m_bFilterMessages = true;
- break;
-
- case Settings::fwmWordsMatching:
- case Settings::fwmWordsContaining:
- case Settings::fwmWordsStartingWith:
- case Settings::fwmWordsEndingWith:
- m_ActiveWordFilter.push_back(pFilter);
- m_bFilterWords = true;
- break;
+ if (pFilter && !pFilter->getWords().empty()) {
+ switch (pFilter->getMode()) {
+ case Settings::fwmMessagesMatching:
+ case Settings::fwmMessagesContaining:
+ case Settings::fwmMessagesStartingWith:
+ case Settings::fwmMessagesEndingWith:
+ m_ActiveMessageFilter.push_back(pFilter);
+ m_bFilterMessages = true;
+ break;
+
+ case Settings::fwmWordsMatching:
+ case Settings::fwmWordsContaining:
+ case Settings::fwmWordsStartingWith:
+ case Settings::fwmWordsEndingWith:
+ m_ActiveWordFilter.push_back(pFilter);
+ m_bFilterWords = true;
+ break;
}
}
}
@@ -324,16 +300,13 @@ void ColBaseWords::impl_contactDataBeginAcquire()
void ColBaseWords::impl_contactDataPrepare(Contact& contact) const
{
WordMap* pData = new WordMap;
-
contact.setSlot(contactDataSlotGet(), pData);
}
void ColBaseWords::impl_contactDataFree(Contact& contact) const
{
WordMap* pData = reinterpret_cast<WordMap*>(contact.getSlot(contactDataSlotGet()));
-
- if (pData)
- {
+ if (pData) {
delete pData;
contact.setSlot(contactDataSlotGet(), NULL);
}
@@ -341,10 +314,8 @@ void ColBaseWords::impl_contactDataFree(Contact& contact) const
void ColBaseWords::impl_contactDataAcquireMessage(Contact& contact, Message& msg)
{
- if (m_nSource == 2 || m_nSource == 1 && msg.isOutgoing() || m_nSource == 0 && !msg.isOutgoing())
- {
+ if (m_nSource == 2 || m_nSource == 1 && msg.isOutgoing() || m_nSource == 0 && !msg.isOutgoing()) {
WordMap* pData = reinterpret_cast<WordMap*>(contact.getSlot(contactDataSlotGet()));
-
parseMsg(pData, m_bFilterLinks ? msg.getWithoutLinks() : msg.getRaw(), msg.isOutgoing());
}
}
@@ -357,12 +328,8 @@ void ColBaseWords::impl_contactDataMerge(Contact& contact, const Contact& includ
citer_each_(WordMap, j, *pIncData)
{
if (pData->find(j->first) != pData->end())
- {
(*pData)[j->first] += j->second;
- }
else
- {
pData->insert(*j);
- }
}
}
diff --git a/plugins/HistoryStats/src/column.cpp b/plugins/HistoryStats/src/column.cpp
index 82429700bf..f44aa5c890 100644
--- a/plugins/HistoryStats/src/column.cpp
+++ b/plugins/HistoryStats/src/column.cpp
@@ -33,18 +33,18 @@ Column::FactoryList::~FactoryList()
void Column::FactoryList::initList()
{
- registerUID(new Factory<ColRank> );
- registerUID(new Factory<ColNick> );
- registerUID(new Factory<ColProtocol> );
- registerUID(new Factory<ColGroup> );
- registerUID(new Factory<ColInOut> );
- registerUID(new Factory<ColInOutGraph> );
- registerUID(new Factory<ColChatDuration> );
- registerUID(new Factory<ColWords> );
- registerUID(new Factory<ColWordCount> );
- registerUID(new Factory<ColEvents> );
- registerUID(new Factory<ColSplit> );
- registerUID(new Factory<ColTimeline> );
+ registerUID(new Factory<ColRank>);
+ registerUID(new Factory<ColNick>);
+ registerUID(new Factory<ColProtocol>);
+ registerUID(new Factory<ColGroup>);
+ registerUID(new Factory<ColInOut>);
+ registerUID(new Factory<ColInOutGraph>);
+ registerUID(new Factory<ColChatDuration>);
+ registerUID(new Factory<ColWords>);
+ registerUID(new Factory<ColWordCount>);
+ registerUID(new Factory<ColEvents>);
+ registerUID(new Factory<ColSplit>);
+ registerUID(new Factory<ColTimeline>);
registerUID(new Factory<ColSplitTimeline>);
}
@@ -54,22 +54,17 @@ void Column::FactoryList::initList()
ext::string Column::IDProvider::getID()
{
- ext::string s = muT("q");
+ ext::string s = _T("q");
int val = m_nNextID++;
- while (val > 0)
- {
+ while (val > 0) {
int digit = val % 36;
if (digit < 10)
- {
- s += (muC('0') + digit);
- }
+ s += ('0' + digit);
else
- {
- s += (muC('a') + digit - 10);
- }
-
+ s += ('a' + digit - 10);
+
val /= 36;
}
@@ -87,9 +82,7 @@ Column* Column::fromUID(const ext::string& guid)
upto_each_(i, countColInfo())
{
if (getColInfo(i).m_UID == guid)
- {
return getColInfo(i).m_pFactory->makeInstance();
- }
}
return NULL;
@@ -100,12 +93,10 @@ void Column::registerUID(FactoryBase* pFactory)
Column* pDummy = pFactory->makeInstance();
ColumnInfo ci;
-
ci.m_UID = pDummy->getUID();
ci.m_Title = pDummy->getTitle();
ci.m_Description = pDummy->getDescription();
ci.m_pFactory = pFactory;
-
m_Factories.m_List.push_back(ci);
delete pDummy;
@@ -115,26 +106,22 @@ void Column::writeRowspanTD(ext::ostream& tos, const ext::string& innerHTML, int
{
int curRowSpan = (row < numRows) ? 1 : (rowSpan - numRows + 1);
- tos << muT("<td");
+ tos << _T("<td");
if (colSpan > 1)
- {
- tos << muT(" colspan=\"") << colSpan << muT("\"");
- }
+ tos << _T(" colspan=\"") << colSpan << _T("\"");
if (curRowSpan > 1)
- {
- tos << muT(" rowspan=\"") << curRowSpan << muT("\"");
- }
+ tos << _T(" rowspan=\"") << curRowSpan << _T("\"");
- tos << muT(">") << innerHTML << muT("</td>") << ext::endl;
+ tos << _T(">") << innerHTML << _T("</td>") << ext::endl;
}
void Column::copyAttrib(const Column* pSource)
{
- m_bEnabled = pSource->m_bEnabled;
- m_CustomTitle = pSource->m_CustomTitle;
- m_nContactDataSlot = pSource->m_nContactDataSlot;
+ m_bEnabled = pSource->m_bEnabled;
+ m_CustomTitle = pSource->m_CustomTitle;
+ m_nContactDataSlot = pSource->m_nContactDataSlot;
m_nContactDataTransformSlot = pSource->m_nContactDataTransformSlot;
}
@@ -143,9 +130,7 @@ const ext::string Column::getCustomTitle(const ext::string& strShort, const ext:
ext::string strTitle = utils::htmlEscape(m_CustomTitle.empty() ? (m_pSettings->m_TableHeaderVerbose ? strLong : strShort) : m_CustomTitle);
if (m_pSettings->m_HeaderTooltips && (!m_pSettings->m_HeaderTooltipsIfCustom || !m_CustomTitle.empty() || (!m_pSettings->m_TableHeaderVerbose && strShort != strLong)))
- {
- strTitle = muT("<span title=\"") + utils::htmlEscape(strLong) + muT("\">") + strTitle + muT("</span>");
- }
+ strTitle = _T("<span title=\"") + utils::htmlEscape(strLong) + _T("\">") + strTitle + _T("</span>");
return strTitle;
}
diff --git a/plugins/HistoryStats/src/column.h b/plugins/HistoryStats/src/column.h
index 74bfc2a073..4f29e71a2f 100644
--- a/plugins/HistoryStats/src/column.h
+++ b/plugins/HistoryStats/src/column.h
@@ -38,8 +38,8 @@ private:
{
public:
ext::string m_UID;
- const mu_text* m_Title;
- const mu_text* m_Description;
+ const TCHAR* m_Title;
+ const TCHAR* m_Description;
FactoryBase* m_pFactory;
};
@@ -137,7 +137,7 @@ protected:
public:
Column()
- : m_bEnabled(true), m_CustomTitle(muT("")),
+ : m_bEnabled(true), m_CustomTitle(_T("")),
m_nContactDataSlot(-1), m_nContactDataTransformSlot(-1),
m_pStatistic(NULL), m_pSettings(NULL), m_pCharMapper(NULL),
m_bUsePNG(false)
@@ -155,7 +155,7 @@ public:
void setCustomTitle(const ext::string& customTitle) { m_CustomTitle = customTitle; }
const ext::string getCustomTitle() const { return m_CustomTitle; }
const ext::string getCustomTitle(const ext::string& strShort, const ext::string& strLong) const;
- ext::string getTitleForOptions() { return m_CustomTitle.empty() ? getTitle() : (m_CustomTitle + muT(" (") + getTitle() + muT(")")); }
+ ext::string getTitleForOptions() { return m_CustomTitle.empty() ? getTitle() : (m_CustomTitle + _T(" (") + getTitle() + _T(")")); }
void setHelpers(Statistic* pStatistic, Settings* pSettings, Settings::CharMapper* pCharMapper) { m_pStatistic = pStatistic; m_pSettings = pSettings; m_pCharMapper = pCharMapper; }
Statistic* getStatistic() const { return m_pStatistic; }
@@ -170,9 +170,9 @@ public:
/*
* public interface for virtual functions
*/
- const mu_text* getUID() const { return impl_getUID(); }
- const mu_text* getTitle() const { return impl_getTitle(); }
- const mu_text* getDescription() const { return impl_getDescription(); }
+ const TCHAR* getUID() const { return impl_getUID(); }
+ const TCHAR* getTitle() const { return impl_getTitle(); }
+ const TCHAR* getDescription() const { return impl_getDescription(); }
void copyConfig(const Column* pSource) { impl_copyConfig(pSource); }
int getFeatures() const { return impl_getFeatures(); }
void configRead(const SettingsTree& settings) { impl_configRead(settings); }
@@ -206,19 +206,19 @@ protected:
* Returns a unique ID for column.
* [virtual/abstract]
*/
- virtual const mu_text* impl_getUID() const = 0;
+ virtual const TCHAR* impl_getUID() const = 0;
/*
* Returns the title for the column.
* [virtual/abstract]
*/
- virtual const mu_text* impl_getTitle() const = 0;
+ virtual const TCHAR* impl_getTitle() const = 0;
/*
* Returns the description for the column.
* [virtual/abstract]
*/
- virtual const mu_text* impl_getDescription() const = 0;
+ virtual const TCHAR* impl_getDescription() const = 0;
/*
* Creates a exact copy of the column.
diff --git a/plugins/HistoryStats/src/column_chatduration.cpp b/plugins/HistoryStats/src/column_chatduration.cpp
index b21dc451b4..9965686fab 100644
--- a/plugins/HistoryStats/src/column_chatduration.cpp
+++ b/plugins/HistoryStats/src/column_chatduration.cpp
@@ -38,13 +38,13 @@ void ColChatDuration::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup
{
OptionsCtrl::Item hTemp;
- /**/hTemp = Opt.insertGroup(hGroup, i18n(muT("Chat duration type")));
- /**/ m_hVisMode = Opt.insertRadio(hTemp, NULL, i18n(muT("Minimum")));
- /**/ Opt.insertRadio(hTemp, m_hVisMode, i18n(muT("Average")));
- /**/ Opt.insertRadio(hTemp, m_hVisMode, i18n(muT("Maximum")));
- /**/ Opt.insertRadio(hTemp, m_hVisMode, i18n(muT("Total (sum of all chats)")));
- /**/m_hGraph = Opt.insertCheck(hGroup, i18n(muT("Show bar graph for chat duration type")));
- /**/m_hDetail = Opt.insertCheck(hGroup, i18n(muT("Other information in tooltip")));
+ hTemp = Opt.insertGroup(hGroup, TranslateT("Chat duration type"));
+ m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Minimum"));
+ Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Average"));
+ Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Maximum"));
+ Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Total (sum of all chats)"));
+ m_hGraph = Opt.insertCheck(hGroup, TranslateT("Show bar graph for chat duration type"));
+ m_hDetail = Opt.insertCheck(hGroup, TranslateT("Other information in tooltip"));
Opt.setRadioChecked(m_hVisMode, m_nVisMode);
Opt.checkItem (m_hGraph , m_bGraph );
@@ -66,13 +66,13 @@ Column::StyleList ColChatDuration::impl_outputGetAdditionalStyles(IDProvider& id
{
m_CSS = idp.getID();
- l.push_back(StylePair(muT("td.") + m_CSS, muT("vertical-align: middle; padding: 2px 2px 2px 2px;")));
- l.push_back(StylePair(muT("td.") + m_CSS + muT(" div.n"), muT("text-align: center;")));
+ l.push_back(StylePair(_T("td.") + m_CSS, _T("vertical-align: middle; padding: 2px 2px 2px 2px;")));
+ l.push_back(StylePair(_T("td.") + m_CSS + _T(" div.n"), _T("text-align: center;")));
if (!usePNG())
{
- l.push_back(StylePair(muT("div.") + m_CSS, muT("position: relative; left: 50%; margin-left: -35px; width: 70px; height: 15px; background-color: ") + utils::colorToHTML(con::ColorBarBack) + muT(";")));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div"), muT("position: absolute; top: 0px; left: 0px; height: 15px; overflow: hidden; background-color: ") + utils::colorToHTML(con::ColorBar) + muT(";")));
+ l.push_back(StylePair(_T("div.") + m_CSS, _T("position: relative; left: 50%; margin-left: -35px; width: 70px; height: 15px; background-color: ") + utils::colorToHTML(con::ColorBarBack) + _T(";")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div"), _T("position: absolute; top: 0px; left: 0px; height: 15px; overflow: hidden; background-color: ") + utils::colorToHTML(con::ColorBar) + _T(";")));
}
}
@@ -81,16 +81,17 @@ Column::StyleList ColChatDuration::impl_outputGetAdditionalStyles(IDProvider& id
void ColChatDuration::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
- static const mu_text* szVisModeDesc[] = {
- I18N(muT("Minimum chat duration")),
- I18N(muT("Average chat duration")),
- I18N(muT("Maximum chat duration")),
- I18N(muT("Total chat duration")),
+ static const TCHAR* szVisModeDesc[] = {
+ LPGENT("Minimum chat duration"),
+ LPGENT("Average chat duration"),
+ LPGENT("Maximum chat duration"),
+ LPGENT("Total chat duration"),
};
if (row == 1)
{
- writeRowspanTD(tos, getCustomTitle(i18n(muT("Chat duration")), i18n(szVisModeDesc[m_nVisMode])) + (m_bGraph ? muT("<div style=\"width: 70px;\"></div>") : muT("")), row, 1, rowSpan);
+ ext::string szLong = TranslateTS(szVisModeDesc[m_nVisMode]);
+ writeRowspanTD(tos, getCustomTitle(TranslateT("Chat duration"), szLong + (m_bGraph ? _T("<div style=\"width: 70px;\"></div>") : _T(""))), row, 1, rowSpan);
}
}
@@ -98,8 +99,7 @@ void ColChatDuration::impl_columnDataAfterOmit()
{
// AFTER, i.e. contacts are trimmed to what user will see
- if (m_bGraph)
- {
+ if (m_bGraph) {
static DWORD (Contact::*getChatDurX[4])() const = {
&Contact::getChatDurMin,
&Contact::getChatDurAvg,
@@ -114,22 +114,15 @@ void ColChatDuration::impl_columnDataAfterOmit()
const Contact& cur = getStatistic()->getContact(i);
if (cur.isChatDurValid())
- {
m_nMaxForGraph = max(m_nMaxForGraph, (cur.*getChatDurX[m_nVisMode])());
- }
}
- if (m_nVisMode != 3)
- {
+ if (m_nVisMode != 3) {
if (getStatistic()->hasOmitted() && getStatistic()->getOmitted().isChatDurValid())
- {
m_nMaxForGraph = max(m_nMaxForGraph, (getStatistic()->getOmitted().*getChatDurX[m_nVisMode])());
- }
if (getStatistic()->hasTotals() && getStatistic()->getTotals().isChatDurValid())
- {
m_nMaxForGraph = max(m_nMaxForGraph, (getStatistic()->getTotals().*getChatDurX[m_nVisMode])());
- }
}
}
}
@@ -146,18 +139,18 @@ void ColChatDuration::impl_outputRenderRow(ext::ostream& tos, const Contact& con
// begin output
if (m_bGraph)
{
- tos << muT("<td class=\"") << m_CSS;
+ tos << _T("<td class=\"") << m_CSS;
}
else
{
- tos << muT("<td class=\"num");
+ tos << _T("<td class=\"num");
}
// read and format data
ext::string strAll[4] = {
- i18n(muT("(unknown)")), // min
- i18n(muT("(unknown)")), // avg
- i18n(muT("(unknown)")), // max
+ TranslateT("(unknown)"), // min
+ TranslateT("(unknown)"), // avg
+ TranslateT("(unknown)"), // max
utils::durationToString(contact.getChatDurSum()), // sum
};
@@ -171,11 +164,11 @@ void ColChatDuration::impl_outputRenderRow(ext::ostream& tos, const Contact& con
// output tooltip
if (m_bDetail)
{
- static const mu_text* szPrefixes[] = {
- I18N(muT("[Min] #{amount}")),
- I18N(muT("[Avg] #{amount}")),
- I18N(muT("[Max] #{amount}")),
- I18N(muT("[Sum] #{amount}")),
+ static const TCHAR* szPrefixes[] = {
+ LPGENT("[Min] #{amount}"),
+ LPGENT("[Avg] #{amount}"),
+ LPGENT("[Max] #{amount}"),
+ LPGENT("[Sum] #{amount}"),
};
ext::string strTooltip;
@@ -185,26 +178,26 @@ void ColChatDuration::impl_outputRenderRow(ext::ostream& tos, const Contact& con
{
if (i != m_nVisMode)
{
- strTooltip += ext::str(ext::kformat(i18n(szPrefixes[i])) % muT("#{amount}") * strAll[i]);
+ strTooltip += ext::str(ext::kformat(TranslateTS(szPrefixes[i])) % _T("#{amount}") * strAll[i]);
++nSegments;
if (nSegments < 3)
{
- strTooltip += muT(" / ");
+ strTooltip += _T(" / ");
}
}
}
- tos << muT("\" title=\"") << utils::htmlEscape(strTooltip) << muT("\">");
+ tos << _T("\" title=\"") << utils::htmlEscape(strTooltip) << _T("\">");
}
else
{
- tos << muT("\">");
+ tos << _T("\">");
}
if (m_bGraph)
{
- tos << muT("<div class=\"n\">")
+ tos << _T("<div class=\"n\">")
<< utils::htmlEscape(strAll[m_nVisMode]);
if (display == asContact || m_nVisMode != 3)
@@ -235,23 +228,23 @@ void ColChatDuration::impl_outputRenderRow(ext::ostream& tos, const Contact& con
if (getStatistic()->newFilePNG(canvas, strFinalFile))
{
- tos << muT("<br/><img src=\"") << strFinalFile << muT("\"/>");
+ tos << _T("<br/><img src=\"") << strFinalFile << _T("\"/>");
}
}
else
{
- tos << muT("</div>")
- << muT("<div class=\"") << m_CSS << muT("\">")
- << muT("<div style=\"width: ") << barW << muT("px;\"></div>");
+ tos << _T("</div>")
+ << _T("<div class=\"") << m_CSS << _T("\">")
+ << _T("<div style=\"width: ") << barW << _T("px;\"></div>");
}
}
- tos << muT("</div>");
+ tos << _T("</div>");
}
else
{
tos << utils::htmlEscape(strAll[m_nVisMode]);
}
- tos << muT("</td>") << ext::endl;
+ tos << _T("</td>") << ext::endl;
}
diff --git a/plugins/HistoryStats/src/column_chatduration.h b/plugins/HistoryStats/src/column_chatduration.h
index dd68efffbc..e2ddfd9e7e 100644
--- a/plugins/HistoryStats/src/column_chatduration.h
+++ b/plugins/HistoryStats/src/column_chatduration.h
@@ -27,9 +27,9 @@ public:
explicit ColChatDuration();
protected:
- virtual const mu_text* impl_getUID() const { return con::ColChatDuration; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("Chat duration")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding the amount of time you have chatted with the given contact.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColChatDuration; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("Chat duration"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding the amount of time you have chatted with the given contact."); }
virtual void impl_copyConfig(const Column* pSource);
virtual int impl_getFeatures() const { return cfHasConfig; }
virtual void impl_configRead(const SettingsTree& settings);
diff --git a/plugins/HistoryStats/src/column_events.cpp b/plugins/HistoryStats/src/column_events.cpp
index 2186f8bb91..b0fee0204c 100644
--- a/plugins/HistoryStats/src/column_events.cpp
+++ b/plugins/HistoryStats/src/column_events.cpp
@@ -29,20 +29,20 @@ void ColEvents::impl_configWrite(SettingsTree& settings) const
void ColEvents::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
{
- m_hSource = Opt.insertCombo(hGroup, i18n(muT("Events to count")));
-
- static const mu_text* sourceTexts[] = {
- I18N(muT("URLs (incoming)")),
- I18N(muT("URLs (outgoing)")),
- I18N(muT("URLs (all)")),
- I18N(muT("Files (incoming)")),
- I18N(muT("Files (outgoing)")),
- I18N(muT("Files (all)")),
+ m_hSource = Opt.insertCombo(hGroup, TranslateT("Events to count"));
+
+ static const TCHAR* sourceTexts[] = {
+ LPGENT("URLs (incoming)"),
+ LPGENT("URLs (outgoing)"),
+ LPGENT("URLs (all)"),
+ LPGENT("Files (incoming)"),
+ LPGENT("Files (outgoing)"),
+ LPGENT("Files (all)"),
};
array_each_(i, sourceTexts)
{
- Opt.addComboItem(m_hSource, i18n(sourceTexts[i]));
+ Opt.addComboItem(m_hSource, TranslateTS(sourceTexts[i]));
}
Opt.setComboSelected(m_hSource, m_nSource);
@@ -55,23 +55,23 @@ void ColEvents::impl_configFromUI(OptionsCtrl& Opt)
void ColEvents::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
- static const mu_text* szShortDesc[] = {
- I18N(muT("URLs")),
- I18N(muT("Files")),
+ static const TCHAR* szShortDesc[] = {
+ LPGENT("URLs"),
+ LPGENT("Files"),
};
- static const mu_text* szSourceDesc[] = {
- I18N(muT("Incoming URLs")),
- I18N(muT("Outgoing URLs")),
- I18N(muT("URLs")),
- I18N(muT("Incoming files")),
- I18N(muT("Outgoing files")),
- I18N(muT("Files")),
+ static const TCHAR* szSourceDesc[] = {
+ LPGENT("Incoming URLs"),
+ LPGENT("Outgoing URLs"),
+ LPGENT("URLs"),
+ LPGENT("Incoming files"),
+ LPGENT("Outgoing files"),
+ LPGENT("Files"),
};
if (row == 1)
{
- writeRowspanTD(tos, getCustomTitle(i18n(szShortDesc[m_nSource / 3]), i18n(szSourceDesc[m_nSource])), row, 1, rowSpan);
+ writeRowspanTD(tos, getCustomTitle(TranslateTS(szShortDesc[m_nSource / 3]), TranslateTS(szSourceDesc[m_nSource])), row, 1, rowSpan);
}
}
@@ -86,7 +86,7 @@ void ColEvents::impl_outputRenderRow(ext::ostream& tos, const Contact& contact,
&Contact::getTotalFiles,
};
- tos << muT("<td class=\"num\">")
+ tos << _T("<td class=\"num\">")
<< utils::intToGrouped((contact.*getData[m_nSource])())
- << muT("</td>") << ext::endl;
+ << _T("</td>") << ext::endl;
}
diff --git a/plugins/HistoryStats/src/column_events.h b/plugins/HistoryStats/src/column_events.h
index 6a3aa9f827..571f078e68 100644
--- a/plugins/HistoryStats/src/column_events.h
+++ b/plugins/HistoryStats/src/column_events.h
@@ -19,9 +19,9 @@ public:
explicit ColEvents();
protected:
- virtual const mu_text* impl_getUID() const { return con::ColEvents; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("Events")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding event counts for incoming, outgoing or total number of files or URLs.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColEvents; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("Events"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding event counts for incoming, outgoing or total number of files or URLs."); }
virtual void impl_copyConfig(const Column* pSource);
virtual int impl_getFeatures() const { return cfHasConfig; }
virtual void impl_configRead(const SettingsTree& settings);
diff --git a/plugins/HistoryStats/src/column_group.cpp b/plugins/HistoryStats/src/column_group.cpp
index 9d816af1c4..46b984da7c 100644
--- a/plugins/HistoryStats/src/column_group.cpp
+++ b/plugins/HistoryStats/src/column_group.cpp
@@ -9,7 +9,7 @@ void ColGroup::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan)
{
if (row == 1)
{
- writeRowspanTD(tos, getCustomTitle(i18n(muT("Group")), i18n(muT("Group"))), row, 1, rowSpan);
+ writeRowspanTD(tos, getCustomTitle(TranslateT("Group"), TranslateT("Group")), row, 1, rowSpan);
}
}
@@ -20,12 +20,12 @@ void ColGroup::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D
ext::string groupName = contact.getGroup();
// replace subgroup separator with something better (really better?)
- utils::replaceAllInPlace(groupName, muT("\\"), muT(" > "));
+ utils::replaceAllInPlace(groupName, _T("\\"), _T(" > "));
- tos << muT("<td>") << utils::htmlEscape(groupName) << muT("</td>") << ext::endl;
+ tos << _T("<td>") << utils::htmlEscape(groupName) << _T("</td>") << ext::endl;
}
else
{
- tos << muT("<td>&nbsp;</td>");
+ tos << _T("<td>&nbsp;</td>");
}
}
diff --git a/plugins/HistoryStats/src/column_group.h b/plugins/HistoryStats/src/column_group.h
index f8c68c704d..033f5d5fb4 100644
--- a/plugins/HistoryStats/src/column_group.h
+++ b/plugins/HistoryStats/src/column_group.h
@@ -11,9 +11,9 @@ class ColGroup
: public Column
{
protected:
- virtual const mu_text* impl_getUID() const { return con::ColGroup; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("Group")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding the contact list's group name the contact is in.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColGroup; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("Group"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding the contact list's group name the contact is in."); }
virtual int impl_getFeatures() const { return 0; }
virtual int impl_configGetRestrictions(ext::string* pDetails) const { return crHTMLFull; }
virtual void impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const;
diff --git a/plugins/HistoryStats/src/column_inout.cpp b/plugins/HistoryStats/src/column_inout.cpp
index 4aaf5f1743..62cb3d5a8f 100644
--- a/plugins/HistoryStats/src/column_inout.cpp
+++ b/plugins/HistoryStats/src/column_inout.cpp
@@ -38,29 +38,29 @@ void ColInOut::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
{
OptionsCtrl::Group hTemp;
- /**/m_hSource = Opt.insertCombo(hGroup, i18n(muT("Data source")));
- /**/hTemp = Opt.insertGroup(hGroup, i18n(muT("Display as")));
- /**/ m_hAbsolute = Opt.insertRadio(hTemp, NULL, i18n(muT("Absolute")));
- /**/ m_hAbsolute = Opt.insertRadio(hTemp, m_hAbsolute, i18n(muT("Average")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hAbsTime = Opt.insertRadio(m_hAbsolute, NULL, i18n(muT("Units per day")));
- /**/ Opt.insertRadio(m_hAbsolute, m_hAbsTime, i18n(muT("Units per week")));
- /**/ Opt.insertRadio(m_hAbsolute, m_hAbsTime, i18n(muT("Units per month (30 days)")));
-
- static const mu_text* sourceTexts[] = {
- I18N(muT("Characters (incoming)")),
- I18N(muT("Characters (outgoing)")),
- I18N(muT("Characters (all)")),
- I18N(muT("Messages (incoming)")),
- I18N(muT("Messages (outgoing)")),
- I18N(muT("Messages (all)")),
- I18N(muT("Chats (incoming)")),
- I18N(muT("Chats (outgoing)")),
- I18N(muT("Chats (all)")),
+ m_hSource = Opt.insertCombo(hGroup, TranslateT("Data source"));
+ hTemp = Opt.insertGroup(hGroup, TranslateT("Display as"));
+ m_hAbsolute = Opt.insertRadio(hTemp, NULL, TranslateT("Absolute"));
+ m_hAbsolute = Opt.insertRadio(hTemp, m_hAbsolute, TranslateT("Average"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hAbsTime = Opt.insertRadio(m_hAbsolute, NULL, TranslateT("Units per day"));
+ Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per week"));
+ Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per month (30 days)"));
+
+ static const TCHAR* sourceTexts[] = {
+ LPGENT("Characters (incoming)"),
+ LPGENT("Characters (outgoing)"),
+ LPGENT("Characters (all)"),
+ LPGENT("Messages (incoming)"),
+ LPGENT("Messages (outgoing)"),
+ LPGENT("Messages (all)"),
+ LPGENT("Chats (incoming)"),
+ LPGENT("Chats (outgoing)"),
+ LPGENT("Chats (all)"),
};
array_each_(i, sourceTexts)
{
- Opt.addComboItem(m_hSource, i18n(sourceTexts[i]));
+ Opt.addComboItem(m_hSource, TranslateTS(sourceTexts[i]));
}
Opt.setComboSelected(m_hSource , m_nSource );
@@ -77,28 +77,28 @@ void ColInOut::impl_configFromUI(OptionsCtrl& Opt)
void ColInOut::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
- static const mu_text* szShortDesc[] = {
- I18N(muT("Characters")),
- I18N(muT("Messages")),
- I18N(muT("Chats"))
+ static const TCHAR* szShortDesc[] = {
+ LPGENT("Characters"),
+ LPGENT("Messages"),
+ LPGENT("Chats")
};
- static const mu_text* szSourceDesc[] = {
- I18N(muT("Incoming characters")),
- I18N(muT("Outgoing characters")),
- I18N(muT("Characters")),
- I18N(muT("Incoming messages")),
- I18N(muT("Outgoing messages")),
- I18N(muT("Messages")),
- I18N(muT("Incoming chats")),
- I18N(muT("Outgoing chats")),
- I18N(muT("Chats")),
+ static const TCHAR* szSourceDesc[] = {
+ LPGENT("Incoming characters"),
+ LPGENT("Outgoing characters"),
+ LPGENT("Characters"),
+ LPGENT("Incoming messages"),
+ LPGENT("Outgoing messages"),
+ LPGENT("Messages"),
+ LPGENT("Incoming chats"),
+ LPGENT("Outgoing chats"),
+ LPGENT("Chats")
};
- static const mu_text* szUnitDesc[] = {
- I18N(muT("day")),
- I18N(muT("week")),
- I18N(muT("month")),
+ static const TCHAR* szUnitDesc[] = {
+ LPGENT("day"),
+ LPGENT("week"),
+ LPGENT("month"),
};
if (row == 1)
@@ -107,16 +107,16 @@ void ColInOut::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan)
if (m_bAbsolute)
{
- strTitle = i18n(szSourceDesc[m_nSource]);
+ strTitle = TranslateTS(szSourceDesc[m_nSource]);
}
else
{
- strTitle = str(ext::kformat(i18n(muT("#{data} per #{unit}")))
- % muT("#{data}") * i18n(szSourceDesc[m_nSource])
- % muT("#{unit}") * i18n(szUnitDesc[m_nAbsTime]));
+ strTitle = str(ext::kformat(TranslateT("#{data} per #{unit}"))
+ % _T("#{data}") * TranslateTS(szSourceDesc[m_nSource])
+ % _T("#{unit}") * TranslateTS(szUnitDesc[m_nAbsTime]));
}
- writeRowspanTD(tos, getCustomTitle(i18n(szShortDesc[m_nSource / 3]), strTitle), row, 1, rowSpan);
+ writeRowspanTD(tos, getCustomTitle(TranslateTS(szShortDesc[m_nSource / 3]), strTitle), row, 1, rowSpan);
}
}
@@ -136,9 +136,9 @@ void ColInOut::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D
&Contact::getTotalChats,
};
- tos << muT("<td class=\"num\">")
+ tos << _T("<td class=\"num\">")
<< utils::intToGrouped((contact.*getData[m_nSource])())
- << muT("</td>") << ext::endl;
+ << _T("</td>") << ext::endl;
}
else
{
@@ -160,8 +160,8 @@ void ColInOut::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D
60.0 * 60.0 * 24.0 * 30.0,
};
- tos << muT("<td class=\"num\">")
+ tos << _T("<td class=\"num\">")
<< utils::floatToGrouped((contact.*getData[m_nSource])() * avgFactor[m_nAbsTime], 1)
- << muT("</td>") << ext::endl;
+ << _T("</td>") << ext::endl;
}
}
diff --git a/plugins/HistoryStats/src/column_inout.h b/plugins/HistoryStats/src/column_inout.h
index ac66377312..fd2955299a 100644
--- a/plugins/HistoryStats/src/column_inout.h
+++ b/plugins/HistoryStats/src/column_inout.h
@@ -23,9 +23,9 @@ public:
explicit ColInOut();
protected:
- virtual const mu_text* impl_getUID() const { return con::ColInOut; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("In/out")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding counts for incoming, outgoing or total characters, messages or chats. This column can display absolute and average values.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColInOut; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("In/out"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding counts for incoming, outgoing or total characters, messages or chats. This column can display absolute and average values."); }
virtual void impl_copyConfig(const Column* pSource);
virtual int impl_getFeatures() const { return cfHasConfig; }
virtual void impl_configRead(const SettingsTree& settings);
diff --git a/plugins/HistoryStats/src/column_inoutgraph.cpp b/plugins/HistoryStats/src/column_inoutgraph.cpp
index a28c4b7fd5..3d8065929f 100644
--- a/plugins/HistoryStats/src/column_inoutgraph.cpp
+++ b/plugins/HistoryStats/src/column_inoutgraph.cpp
@@ -55,21 +55,21 @@ void ColInOutGraph::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
{
OptionsCtrl::Group hTemp;
- /**/hTemp = Opt.insertGroup(hGroup, i18n(muT("Data source")));
- /**/ m_hSource = Opt.insertRadio(hTemp, NULL, i18n(muT("Characters")));
- /**/ Opt.insertRadio(hTemp, m_hSource, i18n(muT("Messages")));
- /**/ Opt.insertRadio(hTemp, m_hSource, i18n(muT("Chats")));
- /**/hTemp = Opt.insertGroup(hGroup, i18n(muT("Display as")));
- /**/ m_hAbsolute = Opt.insertRadio(hTemp, NULL, i18n(muT("Absolute")));
- /**/ m_hAbsolute = Opt.insertRadio(hTemp, m_hAbsolute, i18n(muT("Average")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hAbsTime = Opt.insertRadio(m_hAbsolute, NULL, i18n(muT("Units per day")));
- /**/ Opt.insertRadio(m_hAbsolute, m_hAbsTime, i18n(muT("Units per week")));
- /**/ Opt.insertRadio(m_hAbsolute, m_hAbsTime, i18n(muT("Units per month (30 days)")));
- /**/m_hShowSum = Opt.insertCheck(hGroup, i18n(muT("Show sum of incoming and outgoing")));
- /**/m_hDetail = Opt.insertCheck(hGroup, i18n(muT("In/out details (tooltip)")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hDetailPercent = Opt.insertCheck(m_hDetail, i18n(muT("Percentage in tooltip")));
- /**/ m_hDetailInvert = Opt.insertCheck(m_hDetail, i18n(muT("Absolute in tooltip if average selected and vice versa")));
- /**/m_hGraphPercent = Opt.insertCheck(hGroup, i18n(muT("Percentage in bar graph")));
+ hTemp = Opt.insertGroup(hGroup, TranslateT("Data source"));
+ m_hSource = Opt.insertRadio(hTemp, NULL, TranslateT("Characters"));
+ Opt.insertRadio(hTemp, m_hSource, TranslateT("Messages"));
+ Opt.insertRadio(hTemp, m_hSource, TranslateT("Chats"));
+ hTemp = Opt.insertGroup(hGroup, TranslateT("Display as"));
+ m_hAbsolute = Opt.insertRadio(hTemp, NULL, TranslateT("Absolute"));
+ m_hAbsolute = Opt.insertRadio(hTemp, m_hAbsolute, TranslateT("Average"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hAbsTime = Opt.insertRadio(m_hAbsolute, NULL, TranslateT("Units per day"));
+ Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per week"));
+ Opt.insertRadio(m_hAbsolute, m_hAbsTime, TranslateT("Units per month (30 days)"));
+ m_hShowSum = Opt.insertCheck(hGroup, TranslateT("Show sum of incoming and outgoing"));
+ m_hDetail = Opt.insertCheck(hGroup, TranslateT("In/out details (tooltip)"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hDetailPercent = Opt.insertCheck(m_hDetail, TranslateT("Percentage in tooltip"));
+ m_hDetailInvert = Opt.insertCheck(m_hDetail, TranslateT("Absolute in tooltip if average selected and vice versa"));
+ m_hGraphPercent = Opt.insertCheck(hGroup, TranslateT("Percentage in bar graph"));
Opt.setRadioChecked(m_hSource , m_nSource );
Opt.setRadioChecked(m_hAbsolute , m_bAbsolute ? 0 : 1);
@@ -99,24 +99,24 @@ Column::StyleList ColInOutGraph::impl_outputGetAdditionalStyles(IDProvider& idp)
m_CSS = idp.getID();
- l.push_back(StylePair(muT("td.") + m_CSS, muT("vertical-align: middle; padding: 2px 2px 2px 2px;")));
+ l.push_back(StylePair(_T("td.") + m_CSS, _T("vertical-align: middle; padding: 2px 2px 2px 2px;")));
if (m_bShowSum)
{
- l.push_back(StylePair(muT("td.") + m_CSS + muT(" div.n"), muT("text-align: center;")));
+ l.push_back(StylePair(_T("td.") + m_CSS + _T(" div.n"), _T("text-align: center;")));
}
if (!usePNG())
{
- l.push_back(StylePair(muT("div.") + m_CSS, muT("position: relative; left: 50%; margin-left: -50px; width: 100px; height: 15px; background-color: ") + utils::colorToHTML(con::ColorBack) + muT(";")));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div"), muT("position: absolute; top: 0px; height: 15px; overflow: hidden; font-size: 80%; color: ") + utils::colorToHTML(con::ColorBack) + muT(";")));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div.obar"), muT("left: 0px; background-color: ") + utils::colorToHTML(con::ColorOut) + muT(";")));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div.ibar"), muT("right: 0px; background-color: ") + utils::colorToHTML(con::ColorIn) + muT(";")));
+ l.push_back(StylePair(_T("div.") + m_CSS, _T("position: relative; left: 50%; margin-left: -50px; width: 100px; height: 15px; background-color: ") + utils::colorToHTML(con::ColorBack) + _T(";")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div"), _T("position: absolute; top: 0px; height: 15px; overflow: hidden; font-size: 80%; color: ") + utils::colorToHTML(con::ColorBack) + _T(";")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div.obar"), _T("left: 0px; background-color: ") + utils::colorToHTML(con::ColorOut) + _T(";")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div.ibar"), _T("right: 0px; background-color: ") + utils::colorToHTML(con::ColorIn) + _T(";")));
if (m_bGraphPercent)
{
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div.otext"), muT("left: 2px; width: 48px; text-align: left; z-index: 9;")));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div.itext"), muT("right: 2px; width: 48px; text-align: right; z-index: 9;")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div.otext"), _T("left: 2px; width: 48px; text-align: left; z-index: 9;")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div.itext"), _T("right: 2px; width: 48px; text-align: right; z-index: 9;")));
}
}
@@ -132,16 +132,16 @@ SIZE ColInOutGraph::impl_outputMeasureHeader() const
void ColInOutGraph::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
- static const mu_text* szSourceDesc[] = {
- I18N(muT("Characters")),
- I18N(muT("Messages")),
- I18N(muT("Chats"))
+ static const TCHAR* szSourceDesc[] = {
+ LPGENT("Characters"),
+ LPGENT("Messages"),
+ LPGENT("Chats")
};
- static const mu_text* szSourceUnit[] = {
- I18N(muT("day")),
- I18N(muT("week")),
- I18N(muT("month")),
+ static const TCHAR* szSourceUnit[] = {
+ LPGENT("day"),
+ LPGENT("week"),
+ LPGENT("month"),
};
if (row == 1)
@@ -150,21 +150,21 @@ void ColInOutGraph::impl_outputRenderHeader(ext::ostream& tos, int row, int rowS
if (m_bAbsolute)
{
- strTitle = i18n(szSourceDesc[m_nSource]);
+ strTitle = TranslateTS(szSourceDesc[m_nSource]);
}
else
{
- strTitle = str(ext::kformat(i18n(muT("#{data} per #{unit}")))
- % muT("#{data}") * i18n(szSourceDesc[m_nSource])
- % muT("#{unit}") * i18n(szSourceUnit[m_nAbsTime]));
+ strTitle = str(ext::kformat(TranslateT("#{data} per #{unit}"))
+ % _T("#{data}") * TranslateTS(szSourceDesc[m_nSource])
+ % _T("#{unit}") * TranslateTS(szSourceUnit[m_nAbsTime]));
}
- writeRowspanTD(tos, getCustomTitle(i18n(szSourceDesc[m_nSource]), strTitle) + muT("<div style=\"width: 100px;\"></div>"), 1, 2, rowSpan, 2);
+ writeRowspanTD(tos, getCustomTitle(TranslateTS(szSourceDesc[m_nSource]), strTitle) + _T("<div style=\"width: 100px;\"></div>"), 1, 2, rowSpan, 2);
}
else if (row == 2)
{
- writeRowspanTD(tos, i18n(muT("Outgoing")), 2, 2, rowSpan);
- writeRowspanTD(tos, i18n(muT("Incoming")), 2, 2, rowSpan);
+ writeRowspanTD(tos, TranslateT("Outgoing"), 2, 2, rowSpan);
+ writeRowspanTD(tos, TranslateT("Incoming"), 2, 2, rowSpan);
}
}
@@ -194,7 +194,7 @@ void ColInOutGraph::impl_outputRenderRow(ext::ostream& tos, const Contact& conta
double avgTotal = avgFactor[m_nAbsTime] * (contact.*getAvgTotal[m_nSource])();
// begin output
- tos << muT("<td colspan=\"2\" class=\"") << m_CSS;
+ tos << _T("<td colspan=\"2\" class=\"") << m_CSS;
if (m_bDetail)
{
@@ -213,26 +213,26 @@ void ColInOutGraph::impl_outputRenderRow(ext::ostream& tos, const Contact& conta
if (m_bDetailPercent)
{
- tos << muT("\" title=\"")
- << utils::htmlEscape(ext::str(ext::kformat(i18n(muT("[Out] #{out_amount} (#{out_ratio}) / [In] #{in_amount} (#{in_ratio})")))
- % muT("#{out_amount}") * strOut
- % muT("#{out_ratio}") * utils::ratioToPercent(numOut, numTotal)
- % muT("#{in_amount}") * strIn
- % muT("#{in_ratio}") * utils::ratioToPercent(numIn, numTotal)))
- << muT("\">");
+ tos << _T("\" title=\"")
+ << utils::htmlEscape(ext::str(ext::kformat(TranslateT("[Out] #{out_amount} (#{out_ratio}) / [In] #{in_amount} (#{in_ratio})"))
+ % _T("#{out_amount}") * strOut
+ % _T("#{out_ratio}") * utils::ratioToPercent(numOut, numTotal)
+ % _T("#{in_amount}") * strIn
+ % _T("#{in_ratio}") * utils::ratioToPercent(numIn, numTotal)))
+ << _T("\">");
}
else
{
- tos << muT("\" title=\"")
- << utils::htmlEscape(ext::str(ext::kformat(i18n(muT("[Out] #{out_amount} / [In] #{in_amount}")))
- % muT("#{out_amount}") * strOut
- % muT("#{in_amount}") * strIn))
- << muT("\">");
+ tos << _T("\" title=\"")
+ << utils::htmlEscape(ext::str(ext::kformat(TranslateT("[Out] #{out_amount} / [In] #{in_amount}"))
+ % _T("#{out_amount}") * strOut
+ % _T("#{in_amount}") * strIn))
+ << _T("\">");
}
}
else
{
- tos << muT("\">");
+ tos << _T("\">");
}
if (numOut + numIn == 0)
@@ -256,12 +256,12 @@ void ColInOutGraph::impl_outputRenderRow(ext::ostream& tos, const Contact& conta
if (usePNG())
{
- tos << muT("<div class=\"n\">");
+ tos << _T("<div class=\"n\">");
if (m_bShowSum)
{
tos << (m_bAbsolute ? utils::intToGrouped(numTotal) : utils::floatToGrouped(avgTotal, 1))
- << muT("<br/>");
+ << _T("<br/>");
}
// draw graph
@@ -298,7 +298,7 @@ void ColInOutGraph::impl_outputRenderRow(ext::ostream& tos, const Contact& conta
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH | FF_SWISS,
- muT("Verdana")
+ _T("Verdana")
};
HFONT hFont = CreateFontIndirect(&lf);
@@ -317,40 +317,40 @@ void ColInOutGraph::impl_outputRenderRow(ext::ostream& tos, const Contact& conta
if (getStatistic()->newFilePNG(canvas, strFinalFile))
{
- tos << muT("<img src=\"") << strFinalFile << muT("\"/>");
+ tos << _T("<img src=\"") << strFinalFile << _T("\"/>");
}
- tos << muT("</div>");
+ tos << _T("</div>");
}
else
{
if (m_bShowSum)
{
- tos << muT("<div class=\"n\">")
+ tos << _T("<div class=\"n\">")
<< (m_bAbsolute ? utils::intToGrouped(numTotal) : utils::floatToGrouped(avgTotal, 1))
- << muT("</div>");
+ << _T("</div>");
}
- tos << muT("<div class=\"") << m_CSS << muT("\">");
+ tos << _T("<div class=\"") << m_CSS << _T("\">");
if (outW != 0)
{
- tos << muT("<div class=\"obar\" style=\"width: ") << outW << muT("px;\"></div>");
+ tos << _T("<div class=\"obar\" style=\"width: ") << outW << _T("px;\"></div>");
}
if (inW != 0)
{
- tos << muT("<div class=\"ibar\" style=\"width: ") << inW << muT("px;\"></div>");
+ tos << _T("<div class=\"ibar\" style=\"width: ") << inW << _T("px;\"></div>");
}
if (m_bGraphPercent)
{
- tos << muT("<div class=\"otext\">") << utils::ratioToPercent(numOut, allNum) << muT("</div>");
- tos << muT("<div class=\"itext\">") << utils::ratioToPercent(numIn, allNum) << muT("</div>");
+ tos << _T("<div class=\"otext\">") << utils::ratioToPercent(numOut, allNum) << _T("</div>");
+ tos << _T("<div class=\"itext\">") << utils::ratioToPercent(numIn, allNum) << _T("</div>");
}
- tos << muT("</div>");
+ tos << _T("</div>");
}
- tos << muT("</td>") << ext::endl;
+ tos << _T("</td>") << ext::endl;
}
diff --git a/plugins/HistoryStats/src/column_inoutgraph.h b/plugins/HistoryStats/src/column_inoutgraph.h
index 875a09d004..b2f7ac1bc6 100644
--- a/plugins/HistoryStats/src/column_inoutgraph.h
+++ b/plugins/HistoryStats/src/column_inoutgraph.h
@@ -35,9 +35,9 @@ public:
ColInOutGraph();
protected:
- virtual const mu_text* impl_getUID() const { return con::ColInOutGraph; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("In/out graph")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding in/out bar graphs for characters, messages or chats.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColInOutGraph; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("In/out graph"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding in/out bar graphs for characters, messages or chats."); }
virtual void impl_copyConfig(const Column* pSource);
virtual int impl_getFeatures() const { return cfHasConfig; }
virtual void impl_configRead(const SettingsTree& settings);
diff --git a/plugins/HistoryStats/src/column_nick.cpp b/plugins/HistoryStats/src/column_nick.cpp
index f61744a545..d0ba71a9ae 100644
--- a/plugins/HistoryStats/src/column_nick.cpp
+++ b/plugins/HistoryStats/src/column_nick.cpp
@@ -35,8 +35,8 @@ void ColNick::impl_configWrite(SettingsTree& settings) const
void ColNick::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
{
- /**/m_hDetail = Opt.insertCheck(hGroup, i18n(muT("First/last message time (tooltip)")));
- /**/m_hContactCount = Opt.insertCheck(hGroup, i18n(muT("Show countact count for omitted/totals (tooltip)")));
+ m_hDetail = Opt.insertCheck(hGroup, TranslateT("First/last message time (tooltip)"));
+ m_hContactCount = Opt.insertCheck(hGroup, TranslateT("Show countact count for omitted/totals (tooltip)"));
Opt.checkItem(m_hDetail , m_bDetail );
Opt.checkItem(m_hContactCount, m_bContactCount);
@@ -52,18 +52,18 @@ void ColNick::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) c
{
if (row == 1)
{
- writeRowspanTD(tos, getCustomTitle(i18n(muT("Nick")), i18n(muT("Nick"))), row, 1, rowSpan);
+ writeRowspanTD(tos, getCustomTitle(TranslateT("Nick"), TranslateT("Nick")), row, 1, rowSpan);
}
}
void ColNick::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, DisplayType display)
{
- tos << muT("<td");
+ tos << _T("<td");
if (m_bDetail || (m_bContactCount && display != asContact))
{
- ext::string strFirstTime = i18n(muT("(unknown)"));
- ext::string strLastTime = i18n(muT("(unknown)"));
+ ext::string strFirstTime = TranslateT("(unknown)");
+ ext::string strLastTime = TranslateT("(unknown)");
if (contact.isFirstLastTimeValid())
{
@@ -75,40 +75,31 @@ void ColNick::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, Di
if (m_bDetail && !(m_bContactCount && display != asContact))
{
- strTooltip = utils::htmlEscape(ext::str(ext::kformat(i18n(muT("[First] #{first_time} / [Last] #{last_time}")))
- % muT("#{first_time}") * strFirstTime
- % muT("#{last_time}") * strLastTime));
+ strTooltip = utils::htmlEscape(ext::str(ext::kformat(TranslateT("[First] #{first_time} / [Last] #{last_time}"))
+ % _T("#{first_time}") * strFirstTime
+ % _T("#{last_time}") * strLastTime));
}
else if (m_bDetail && (m_bContactCount && display != asContact))
{
- strTooltip = utils::htmlEscape(ext::str(ext::kformat(i18n(muT("#{count} contacts / [First] #{first_time} / [Last] #{last_time}")))
- % muT("#{count}") * contact.getNumContacts()
- % muT("#{first_time}") * strFirstTime
- % muT("#{last_time}") * strLastTime));
+ strTooltip = utils::htmlEscape(ext::str(ext::kformat(TranslateT("#{count} contacts / [First] #{first_time} / [Last] #{last_time}"))
+ % _T("#{count}") * contact.getNumContacts()
+ % _T("#{first_time}") * strFirstTime
+ % _T("#{last_time}") * strLastTime));
}
else // if (!m_bDetail && (m_bContactCount && display != asContact))
{
- strTooltip = utils::htmlEscape(ext::str(ext::kformat(i18n(muT("#{count} contacts")))
- % muT("#{count}") * contact.getNumContacts()));
+ strTooltip = utils::htmlEscape(ext::str(ext::kformat(TranslateT("#{count} contacts"))
+ % _T("#{count}") * contact.getNumContacts()));
}
- tos << muT(" title=\"") << strTooltip << muT("\">");
- }
- else
- {
- tos << muT(">");
+ tos << _T(" title=\"") << strTooltip << _T("\">");
}
+ else tos << _T(">");
if (display == asContact)
- {
- tos << utils::htmlEscape(contact.getNick()) << muT("</td>") << ext::endl;
- }
+ tos << utils::htmlEscape(contact.getNick()) << _T("</td>") << ext::endl;
else if (display == asOmitted)
- {
- tos << i18n(muT("Omitted")) << muT("</td>") << ext::endl;
- }
+ tos << TranslateT("Omitted") << _T("</td>") << ext::endl;
else
- {
- tos << i18n(muT("Totals")) << muT("</td>") << ext::endl;
- }
+ tos << TranslateT("Totals") << _T("</td>") << ext::endl;
}
diff --git a/plugins/HistoryStats/src/column_nick.h b/plugins/HistoryStats/src/column_nick.h
index 81f7905c93..6eca7f3f7e 100644
--- a/plugins/HistoryStats/src/column_nick.h
+++ b/plugins/HistoryStats/src/column_nick.h
@@ -21,9 +21,9 @@ public:
explicit ColNick();
protected:
- virtual const mu_text* impl_getUID() const { return con::ColNick; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("Nick")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding the contact's nick and first/last message time if selected.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColNick; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("Nick"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding the contact's nick and first/last message time if selected."); }
virtual void impl_copyConfig(const Column* pSource);
virtual int impl_getFeatures() const { return cfHasConfig; }
virtual void impl_configRead(const SettingsTree& settings);
diff --git a/plugins/HistoryStats/src/column_protocol.cpp b/plugins/HistoryStats/src/column_protocol.cpp
index bbbe67ba01..3b194c5f01 100644
--- a/plugins/HistoryStats/src/column_protocol.cpp
+++ b/plugins/HistoryStats/src/column_protocol.cpp
@@ -8,19 +8,13 @@
void ColProtocol::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
if (row == 1)
- {
- writeRowspanTD(tos, getCustomTitle(i18n(muT("Protocol")), i18n(muT("Protocol"))), row, 1, rowSpan);
- }
+ writeRowspanTD(tos, getCustomTitle(TranslateT("Protocol"), TranslateT("Protocol")), row, 1, rowSpan);
}
void ColProtocol::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, DisplayType display)
{
if (display == asContact)
- {
- tos << muT("<td>") << utils::htmlEscape(contact.getProtocol()) << muT("</td>") << ext::endl;
- }
+ tos << _T("<td>") << utils::htmlEscape(contact.getProtocol()) << _T("</td>") << ext::endl;
else
- {
- tos << muT("<td>&nbsp;</td>");
- }
+ tos << _T("<td>&nbsp;</td>");
}
diff --git a/plugins/HistoryStats/src/column_protocol.h b/plugins/HistoryStats/src/column_protocol.h
index b846243275..cc6050c728 100644
--- a/plugins/HistoryStats/src/column_protocol.h
+++ b/plugins/HistoryStats/src/column_protocol.h
@@ -11,9 +11,9 @@ class ColProtocol
: public Column
{
protected:
- virtual const mu_text* impl_getUID() const { return con::ColProtocol; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("Protocol")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding the contact's protocol.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColProtocol; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("Protocol"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding the contact's protocol."); }
virtual int impl_getFeatures() const { return 0; }
virtual int impl_configGetRestrictions(ext::string* pDetails) const { return crHTMLFull; }
virtual void impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const;
diff --git a/plugins/HistoryStats/src/column_rank.cpp b/plugins/HistoryStats/src/column_rank.cpp
index ae44689be9..d65e730be9 100644
--- a/plugins/HistoryStats/src/column_rank.cpp
+++ b/plugins/HistoryStats/src/column_rank.cpp
@@ -8,9 +8,7 @@
void ColRank::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
if (row == 1)
- {
- writeRowspanTD(tos, getCustomTitle(i18n(muT("Rank")), i18n(muT("Rank"))), row, 1, rowSpan);
- }
+ writeRowspanTD(tos, getCustomTitle(TranslateT("Rank"), TranslateT("Rank")), row, 1, rowSpan);
}
void ColRank::impl_outputBegin()
@@ -21,13 +19,9 @@ void ColRank::impl_outputBegin()
void ColRank::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, DisplayType display)
{
if (display == asContact)
- {
- tos << muT("<td class=\"num\">")
- << utils::htmlEscape(ext::str(ext::kformat(i18n(muT("#{rank}."))) % muT("#{rank}") * (m_nNextRank++)))
- << muT("</td>") << ext::endl;
- }
- else
- {
- tos << muT("<td>&nbsp;</td>");
- }
+ tos << _T("<td class=\"num\">")
+ << utils::htmlEscape(ext::str(ext::kformat(TranslateT("#{rank}.")) % _T("#{rank}") * (m_nNextRank++)))
+ << _T("</td>") << ext::endl;
+ else
+ tos << _T("<td>&nbsp;</td>");
}
diff --git a/plugins/HistoryStats/src/column_rank.h b/plugins/HistoryStats/src/column_rank.h
index 29d737277f..e1522fcf20 100644
--- a/plugins/HistoryStats/src/column_rank.h
+++ b/plugins/HistoryStats/src/column_rank.h
@@ -14,9 +14,9 @@ private:
int m_nNextRank;
protected:
- virtual const mu_text* impl_getUID() const { return con::ColRank; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("Rank")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding the contact's placing according to your sorting criteria.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColRank; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("Rank"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding the contact's placing according to your sorting criteria."); }
virtual int impl_getFeatures() const { return 0; }
virtual int impl_configGetRestrictions(ext::string* pDetails) const { return crHTMLFull; }
virtual void impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const;
diff --git a/plugins/HistoryStats/src/column_split.cpp b/plugins/HistoryStats/src/column_split.cpp
index bba1625f2b..fd48189c48 100644
--- a/plugins/HistoryStats/src/column_split.cpp
+++ b/plugins/HistoryStats/src/column_split.cpp
@@ -59,46 +59,46 @@ void ColSplit::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
OptionsCtrl::Group hTemp;
OptionsCtrl::Radio hTempRadio;
- /**/m_hSource = Opt.insertCombo(hGroup, i18n(muT("Data source")));
- /**/hTemp = Opt.insertGroup(hGroup, i18n(muT("\"Split\" type")));
- /**/ m_hVisMode = Opt.insertRadio(hTemp, NULL, i18n(muT("Hours of day")));
- /**/ Opt.insertRadio(hTemp, m_hVisMode, i18n(muT("Days of week")));
- /**/ hTempRadio = Opt.insertRadio(hTemp, m_hVisMode, i18n(muT("Custom (for experts only)")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ hTemp = Opt.insertGroup(hTempRadio, i18n(muT("Column setup")));
- /**/ m_hBlockUnit = Opt.insertCombo(hTemp, i18n(muT("Bar unit")));
- /**/ m_hUnitsPerBlock = Opt.insertEdit (hTemp, i18n(muT("Units per bar")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ m_hBlocks = Opt.insertEdit (hTemp, i18n(muT("Bars per graph")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ hTemp = Opt.insertGroup(hTempRadio, i18n(muT("Graph alignment")));
- /**/ m_hGraphAlign = Opt.insertRadio(hTemp, NULL, i18n(muT("Align on day boundary")));
- /**/ Opt.insertRadio(hTemp, m_hGraphAlign, i18n(muT("Align on week boundary")));
- /**/m_hDetail = Opt.insertCheck(hGroup, i18n(muT("Details for every bar (tooltip)")));
-
- static const mu_text* sourceTexts[] = {
- I18N(muT("Characters (incoming)")),
- I18N(muT("Characters (outgoing)")),
- I18N(muT("Characters (all)")),
- I18N(muT("Messages (incoming)")),
- I18N(muT("Messages (outgoing)")),
- I18N(muT("Messages (all)")),
- I18N(muT("Chats (incoming)")),
- I18N(muT("Chats (outgoing)")),
- I18N(muT("Chats (all)")),
+ m_hSource = Opt.insertCombo(hGroup, TranslateT("Data source"));
+ hTemp = Opt.insertGroup(hGroup, TranslateT("\"Split\" type"));
+ m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Hours of day"));
+ Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Days of week"));
+ hTempRadio = Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Custom (for experts only)"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ hTemp = Opt.insertGroup(hTempRadio, TranslateT("Column setup"));
+ m_hBlockUnit = Opt.insertCombo(hTemp, TranslateT("Bar unit"));
+ m_hUnitsPerBlock = Opt.insertEdit (hTemp, TranslateT("Units per bar"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hBlocks = Opt.insertEdit (hTemp, TranslateT("Bars per graph"), _T(""), OptionsCtrl::OCF_NUMBER);
+ hTemp = Opt.insertGroup(hTempRadio, TranslateT("Graph alignment"));
+ m_hGraphAlign = Opt.insertRadio(hTemp, NULL, TranslateT("Align on day boundary"));
+ Opt.insertRadio(hTemp, m_hGraphAlign, TranslateT("Align on week boundary"));
+ m_hDetail = Opt.insertCheck(hGroup, TranslateT("Details for every bar (tooltip)"));
+
+ static const TCHAR* sourceTexts[] = {
+ LPGENT("Characters (incoming)"),
+ LPGENT("Characters (outgoing)"),
+ LPGENT("Characters (all)"),
+ LPGENT("Messages (incoming)"),
+ LPGENT("Messages (outgoing)"),
+ LPGENT("Messages (all)"),
+ LPGENT("Chats (incoming)"),
+ LPGENT("Chats (outgoing)"),
+ LPGENT("Chats (all)"),
};
array_each_(i, sourceTexts)
{
- Opt.addComboItem(m_hSource, i18n(sourceTexts[i]));
+ Opt.addComboItem(m_hSource, TranslateTS(sourceTexts[i]));
}
- static const mu_text* unitTexts[] = {
- I18N(muT("Hours")),
- I18N(muT("Days")),
- I18N(muT("Weeks")),
+ static const TCHAR* unitTexts[] = {
+ LPGENT("Hours"),
+ LPGENT("Days"),
+ LPGENT("Weeks"),
};
array_each_(i, unitTexts)
{
- Opt.addComboItem(m_hBlockUnit, i18n(unitTexts[i]));
+ Opt.addComboItem(m_hBlockUnit, TranslateTS(unitTexts[i]));
}
Opt.setComboSelected(m_hSource , 3 * m_nSource + m_nSourceType);
@@ -129,9 +129,7 @@ void ColSplit::impl_configFromUI(OptionsCtrl& Opt)
int ColSplit::impl_configGetRestrictions(ext::string* pDetails) const
{
if (pDetails && m_bDetail)
- {
- *pDetails = i18n(muT("Details for every bar (tooltip) are only available with HTML output."));
- }
+ *pDetails = TranslateT("Details for every bar (tooltip) are only available with HTML output.");
// m_bDetail "on" means we need tooltips and they are not available with PNG output
return crHTMLFull | (m_bDetail ? crPNGPartial : crPNGFull);
@@ -141,7 +139,7 @@ ext::string ColSplit::impl_contactDataGetUID() const
{
SplitParams params = getParams();
- return ext::str(ext::format(muT("split-|-|-|-|-|"))
+ return ext::str(ext::format(_T("split-|-|-|-|-|"))
% m_nSource
% m_nSourceType
% params.hours_in_block
@@ -251,13 +249,13 @@ Column::StyleList ColSplit::impl_outputGetAdditionalStyles(IDProvider& idp)
m_CSS = idp.getID();
l.push_back(StylePair(
- muT("div.") + m_CSS,
- ext::str(ext::format(muT("position: relative; left: 50%; margin-left: -|px; width: |px; height: 50px;"))
+ _T("div.") + m_CSS,
+ ext::str(ext::format(_T("position: relative; left: 50%; margin-left: -|px; width: |px; height: 50px;"))
% ((5 * params.blocks_in_column - 1) / 2)
% (5 * params.blocks_in_column - 1))));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div"), muT("position: absolute; top: 0px; width: 4px; height: 50px; overflow: hidden;")));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div div"), muT("position: absolute; left: 0px; width: 4px; height: 50px; background-color: ") + utils::colorToHTML(con::ColorBar) + muT(";")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div"), _T("position: absolute; top: 0px; width: 4px; height: 50px; overflow: hidden;")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div div"), _T("position: absolute; left: 0px; width: 4px; height: 50px; background-color: ") + utils::colorToHTML(con::ColorBar) + _T(";")));
}
return l;
@@ -265,32 +263,32 @@ Column::StyleList ColSplit::impl_outputGetAdditionalStyles(IDProvider& idp)
void ColSplit::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
- static const mu_text* szTypeDesc[] = {
- I18N(muT("Hours of day")),
- I18N(muT("Days of week")),
- I18N(muT("\"Split\"")),
+ static const TCHAR* szTypeDesc[] = {
+ LPGENT("Hours of day"),
+ LPGENT("Days of week"),
+ LPGENT("\"Split\""),
};
- static const mu_text* szSourceDesc[] = {
- I18N(muT("incoming characters")),
- I18N(muT("outgoing characters")),
- I18N(muT("all characters")),
- I18N(muT("incoming messages")),
- I18N(muT("outgoing messages")),
- I18N(muT("all messages")),
- I18N(muT("incoming chats")),
- I18N(muT("outgoing chats")),
- I18N(muT("all chats")),
+ static const TCHAR* szSourceDesc[] = {
+ LPGENT("incoming characters"),
+ LPGENT("outgoing characters"),
+ LPGENT("all characters"),
+ LPGENT("incoming messages"),
+ LPGENT("outgoing messages"),
+ LPGENT("all messages"),
+ LPGENT("incoming chats"),
+ LPGENT("outgoing chats"),
+ LPGENT("all chats"),
};
if (row == 1)
{
SplitParams params = getParams();
- ext::string strTitle = str(ext::kformat(i18n(muT("#{type} for #{data}")))
- % muT("#{type}") * i18n(szTypeDesc[params.effective_vis_mode])
- % muT("#{data}") * i18n(szSourceDesc[3 * m_nSource + m_nSourceType]));
+ ext::string strTitle = str(ext::kformat(TranslateT("#{type} for #{data}"))
+ % _T("#{type}") * TranslateTS(szTypeDesc[params.effective_vis_mode])
+ % _T("#{data}") * TranslateTS(szSourceDesc[3 * m_nSource + m_nSourceType]));
- writeRowspanTD(tos, getCustomTitle(i18n(szTypeDesc[params.effective_vis_mode]), strTitle) + ext::str(ext::format(muT("<div style=\"width: |px;\"></div>")) % (5 * params.blocks_in_column - 1)), row, 1, rowSpan);
+ writeRowspanTD(tos, getCustomTitle(TranslateTS(szTypeDesc[params.effective_vis_mode]), strTitle) + ext::str(ext::format(_T("<div style=\"width: |px;\"></div>")) % (5 * params.blocks_in_column - 1)), row, 1, rowSpan);
}
}
@@ -346,14 +344,14 @@ void ColSplit::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D
{
SplitParams params = getParams();
- static const mu_text* szWDayName[] = {
- I18N(muT("wday3:Mon")),
- I18N(muT("wday3:Tue")),
- I18N(muT("wday3:Wed")),
- I18N(muT("wday3:Thu")),
- I18N(muT("wday3:Fri")),
- I18N(muT("wday3:Sat")),
- I18N(muT("wday3:Sun")),
+ static const TCHAR* szWDayName[] = {
+ LPGENT("wday3:Mon"),
+ LPGENT("wday3:Tue"),
+ LPGENT("wday3:Wed"),
+ LPGENT("wday3:Thu"),
+ LPGENT("wday3:Fri"),
+ LPGENT("wday3:Sat"),
+ LPGENT("wday3:Sun")
};
const int* pData = reinterpret_cast<const int*>(contact.getSlot(contactDataSlotGet()));
@@ -372,7 +370,7 @@ void ColSplit::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D
if (usePNG())
{
- tos << muT("<td class=\"img_bottom\">");
+ tos << _T("<td class=\"img_bottom\">");
// draw graph
Canvas canvas(5 * params.blocks_in_column - 1, 50);
@@ -402,15 +400,15 @@ void ColSplit::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D
if (getStatistic()->newFilePNG(canvas, strFinalFile))
{
- tos << muT("<img src=\"") << strFinalFile << muT("\"/>");
+ tos << _T("<img src=\"") << strFinalFile << _T("\"/>");
}
- tos << muT("</td>") << ext::endl;
+ tos << _T("</td>") << ext::endl;
}
else
{
- tos << muT("<td class=\"bars_bottom\">")
- << muT("<div class=\"") << m_CSS << muT("\">") << ext::endl;
+ tos << _T("<td class=\"bars_bottom\">")
+ << _T("<div class=\"") << m_CSS << _T("\">") << ext::endl;
upto_each_(j, params.blocks_in_column)
{
@@ -422,42 +420,42 @@ void ColSplit::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D
if (params.effective_vis_mode == 0)
{
- divTitle = ext::str(ext::kformat(i18n(muT("[#{hour}:00-#{hour}:59] #{amount}")))
- % muT("#{hour}") * utils::intToPadded(j, 2)
- % muT("#{amount}") * utils::intToGrouped(part_top));
+ divTitle = ext::str(ext::kformat(TranslateT("[#{hour}:00-#{hour}:59] #{amount}"))
+ % _T("#{hour}") * utils::intToPadded(j, 2)
+ % _T("#{amount}") * utils::intToGrouped(part_top));
}
else if (params.effective_vis_mode == 1)
{
- divTitle = ext::str(ext::kformat(i18n(muT("[#{day}] #{amount}")))
- % muT("#{day}") * utils::stripPrefix(muT("wday3:"), i18n(szWDayName[j]))
- % muT("#{amount}") * utils::intToGrouped(part_top));
+ divTitle = ext::str(ext::kformat(TranslateT("[#{day}] #{amount}"))
+ % _T("#{day}") * utils::stripPrefix(_T("wday3:"), TranslateTS(szWDayName[j]))
+ % _T("#{amount}") * utils::intToGrouped(part_top));
}
else
{
- divTitle = ext::str(ext::kformat(i18n(muT("#{amount}")))
- % muT("#{amount}") * utils::intToGrouped(part_top));
+ divTitle = ext::str(ext::kformat(TranslateT("#{amount}"))
+ % _T("#{amount}") * utils::intToGrouped(part_top));
}
- tos << muT("<div title=\"") << utils::htmlEscape(divTitle) << muT("\" style=\"left: ") << (5 * j) << muT("px;\">");
+ tos << _T("<div title=\"") << utils::htmlEscape(divTitle) << _T("\" style=\"left: ") << (5 * j) << _T("px;\">");
}
else if (part_top != 0)
{
- tos << muT("<div style=\"left: ") << (5 * j) << muT("px;\">");
+ tos << _T("<div style=\"left: ") << (5 * j) << _T("px;\">");
}
if (part_top != 0)
{
int bar_len = (50 * part_top + top - 1) / top;
- tos << muT("<div style=\"top: ") << (50 - bar_len) << muT("px;\"></div>");
+ tos << _T("<div style=\"top: ") << (50 - bar_len) << _T("px;\"></div>");
}
if (m_bDetail || part_top != 0)
{
- tos << muT("</div>") << ext::endl;
+ tos << _T("</div>") << ext::endl;
}
}
- tos << muT("</div></td>") << ext::endl;
+ tos << _T("</div></td>") << ext::endl;
}
}
diff --git a/plugins/HistoryStats/src/column_split.h b/plugins/HistoryStats/src/column_split.h
index 03d0ce6055..31613aee34 100644
--- a/plugins/HistoryStats/src/column_split.h
+++ b/plugins/HistoryStats/src/column_split.h
@@ -49,9 +49,9 @@ public:
explicit ColSplit();
protected:
- virtual const mu_text* impl_getUID() const { return con::ColSplit; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("\"Split\"")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding a graphical overview of your chatting amount split by day of week or by hour of day. Different chatting amount measures are available.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColSplit; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("\"Split\""); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding a graphical overview of your chatting amount split by day of week or by hour of day. Different chatting amount measures are available."); }
virtual void impl_copyConfig(const Column* pSource);
virtual int impl_getFeatures() const { return cfHasConfig | cfAcquiresData; }
virtual void impl_configRead(const SettingsTree& settings);
diff --git a/plugins/HistoryStats/src/column_splittimeline.cpp b/plugins/HistoryStats/src/column_splittimeline.cpp
index f856167d04..986c48e6e2 100644
--- a/plugins/HistoryStats/src/column_splittimeline.cpp
+++ b/plugins/HistoryStats/src/column_splittimeline.cpp
@@ -72,53 +72,53 @@ void ColSplitTimeline::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGrou
OptionsCtrl::Group hTemp;
OptionsCtrl::Radio hTempRadio;
- /**/m_hSource = Opt.insertCombo(hGroup, i18n(muT("Data source")));
- /**/m_hIgnoreOld = Opt.insertEdit(hGroup, i18n(muT("Drop everything older than (days, 0=no limit)")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/hTemp = Opt.insertGroup(hGroup, i18n(muT("\"Split\" type")));
- /**/ m_hVisMode = Opt.insertRadio(hTemp, NULL, i18n(muT("Hours of day")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hHODGroup = Opt.insertEdit (m_hVisMode, i18n(muT("Number of days to group")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ hTempRadio = Opt.insertRadio(hTemp, m_hVisMode, i18n(muT("Days of week")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hDOWGroup = Opt.insertEdit (hTempRadio, i18n(muT("Number of weeks to group")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ hTempRadio = Opt.insertRadio(hTemp, m_hVisMode, i18n(muT("Custom (for experts only)")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ hTemp = Opt.insertGroup(hTempRadio, i18n(muT("Column setup")));
- /**/ m_hBlockUnit = Opt.insertCombo(hTemp, i18n(muT("Block unit")));
- /**/ m_hUnitsPerBlock = Opt.insertEdit (hTemp, i18n(muT("Units per block")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ m_hBlocks = Opt.insertEdit (hTemp, i18n(muT("Blocks per column")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ hTemp = Opt.insertGroup(hTempRadio, i18n(muT("Graph alignment")));
- /**/ m_hGraphAlign = Opt.insertRadio(hTemp, NULL, i18n(muT("Align on day boundary")));
- /**/ Opt.insertRadio(hTemp, m_hGraphAlign, i18n(muT("Align on week boundary")));
- /**/ m_hCustomGroup = Opt.insertEdit (hTempRadio, i18n(muT("Number of columns to group")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/m_hTopPerColumn = Opt.insertCheck(hGroup, i18n(muT("Calculate maximum per column (not per graph)")));
-
- static const mu_text* sourceTexts[] = {
- I18N(muT("Characters (incoming)")),
- I18N(muT("Characters (outgoing)")),
- I18N(muT("Characters (all)")),
- I18N(muT("Characters (in/out ratio)")),
- I18N(muT("Messages (incoming)")),
- I18N(muT("Messages (outgoing)")),
- I18N(muT("Messages (all)")),
- I18N(muT("Messages (in/out ratio)")),
- I18N(muT("Chats (incoming)")),
- I18N(muT("Chats (outgoing)")),
- I18N(muT("Chats (all)")),
- I18N(muT("Chats (in/out ratio)")),
+ m_hSource = Opt.insertCombo(hGroup, TranslateT("Data source"));
+ m_hIgnoreOld = Opt.insertEdit(hGroup, TranslateT("Drop everything older than (days, 0=no limit)"), _T(""), OptionsCtrl::OCF_NUMBER);
+ hTemp = Opt.insertGroup(hGroup, TranslateT("\"Split\" type"));
+ m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Hours of day"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hHODGroup = Opt.insertEdit (m_hVisMode, TranslateT("Number of days to group"), _T(""), OptionsCtrl::OCF_NUMBER);
+ hTempRadio = Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Days of week"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hDOWGroup = Opt.insertEdit (hTempRadio, TranslateT("Number of weeks to group"), _T(""), OptionsCtrl::OCF_NUMBER);
+ hTempRadio = Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Custom (for experts only)"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ hTemp = Opt.insertGroup(hTempRadio, TranslateT("Column setup"));
+ m_hBlockUnit = Opt.insertCombo(hTemp, TranslateT("Block unit"));
+ m_hUnitsPerBlock = Opt.insertEdit (hTemp, TranslateT("Units per block"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hBlocks = Opt.insertEdit (hTemp, TranslateT("Blocks per column"), _T(""), OptionsCtrl::OCF_NUMBER);
+ hTemp = Opt.insertGroup(hTempRadio, TranslateT("Graph alignment"));
+ m_hGraphAlign = Opt.insertRadio(hTemp, NULL, TranslateT("Align on day boundary"));
+ Opt.insertRadio(hTemp, m_hGraphAlign, TranslateT("Align on week boundary"));
+ m_hCustomGroup = Opt.insertEdit (hTempRadio, TranslateT("Number of columns to group"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hTopPerColumn = Opt.insertCheck(hGroup, TranslateT("Calculate maximum per column (not per graph)"));
+
+ static const TCHAR* sourceTexts[] = {
+ LPGENT("Characters (incoming)"),
+ LPGENT("Characters (outgoing)"),
+ LPGENT("Characters (all)"),
+ LPGENT("Characters (in/out ratio)"),
+ LPGENT("Messages (incoming)"),
+ LPGENT("Messages (outgoing)"),
+ LPGENT("Messages (all)"),
+ LPGENT("Messages (in/out ratio)"),
+ LPGENT("Chats (incoming)"),
+ LPGENT("Chats (outgoing)"),
+ LPGENT("Chats (all)"),
+ LPGENT("Chats (in/out ratio)"),
};
array_each_(i, sourceTexts)
{
- Opt.addComboItem(m_hSource, i18n(sourceTexts[i]));
+ Opt.addComboItem(m_hSource, TranslateTS(sourceTexts[i]));
}
- static const mu_text* unitTexts[] = {
- I18N(muT("Hours")),
- I18N(muT("Days")),
- I18N(muT("Weeks")),
+ static const TCHAR* unitTexts[] = {
+ LPGENT("Hours"),
+ LPGENT("Days"),
+ LPGENT("Weeks"),
};
array_each_(i, unitTexts)
{
- Opt.addComboItem(m_hBlockUnit, i18n(unitTexts[i]));
+ Opt.addComboItem(m_hBlockUnit, TranslateTS(unitTexts[i]));
}
Opt.setComboSelected(m_hSource , 4 * m_nSource + m_nSourceType);
@@ -162,7 +162,7 @@ ext::string ColSplitTimeline::impl_contactDataGetUID() const
{
SplitParams params = getParams();
- return ext::str(ext::format(muT("splittimeline-|-|-|"))
+ return ext::str(ext::format(_T("splittimeline-|-|-|"))
% m_nSource
% params.hours_in_block
% params.alignment);
@@ -250,35 +250,35 @@ void ColSplitTimeline::impl_contactDataMerge(Contact& contact, const Contact& in
void ColSplitTimeline::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
- static const mu_text* szTypeDesc[] = {
- I18N(muT("Hours of day timeline")),
- I18N(muT("Days of week timeline")),
- I18N(muT("\"Split\" timeline")),
+ static const TCHAR* szTypeDesc[] = {
+ LPGENT("Hours of day timeline"),
+ LPGENT("Days of week timeline"),
+ LPGENT("\"Split\" timeline"),
};
- static const mu_text* szSourceDesc[] = {
- I18N(muT("incoming characters")),
- I18N(muT("outgoing characters")),
- I18N(muT("all characters")),
- I18N(muT("in/out ratio of characters")),
- I18N(muT("incoming messages")),
- I18N(muT("outgoing messages")),
- I18N(muT("all messages")),
- I18N(muT("in/out ratio of messages")),
- I18N(muT("incoming chats")),
- I18N(muT("outgoing chats")),
- I18N(muT("all chats")),
- I18N(muT("in/out ratio of chats")),
+ static const TCHAR* szSourceDesc[] = {
+ LPGENT("incoming characters"),
+ LPGENT("outgoing characters"),
+ LPGENT("all characters"),
+ LPGENT("in/out ratio of characters"),
+ LPGENT("incoming messages"),
+ LPGENT("outgoing messages"),
+ LPGENT("all messages"),
+ LPGENT("in/out ratio of messages"),
+ LPGENT("incoming chats"),
+ LPGENT("outgoing chats"),
+ LPGENT("all chats"),
+ LPGENT("in/out ratio of chats"),
};
if (row == 1)
{
SplitParams params = getParams();
- ext::string strTitle = str(ext::kformat(i18n(muT("#{type} for #{data}")))
- % muT("#{type}") * i18n(szTypeDesc[params.effective_vis_mode])
- % muT("#{data}") * i18n(szSourceDesc[4 * m_nSource + m_nSourceType]));
+ ext::string strTitle = str(ext::kformat(TranslateT("#{type} for #{data}"))
+ % _T("#{type}") * TranslateTS(szTypeDesc[params.effective_vis_mode])
+ % _T("#{data}") * TranslateTS(szSourceDesc[4 * m_nSource + m_nSourceType]));
- writeRowspanTD(tos, getCustomTitle(i18n(szTypeDesc[params.effective_vis_mode]), strTitle) + muT("<div style=\"width: ") + utils::intToString(m_nTimelineWidth) + muT("px;\"></div>"), row, 1, rowSpan);
+ writeRowspanTD(tos, getCustomTitle(TranslateTS(szTypeDesc[params.effective_vis_mode]), strTitle) + _T("<div style=\"width: ") + utils::intToString(m_nTimelineWidth) + _T("px;\"></div>"), row, 1, rowSpan);
}
}
@@ -459,7 +459,7 @@ void ColSplitTimeline::outputRenderRowInOut(ext::ostream& tos, const Contact& co
}
}
- tos << muT("<td class=\"img_middle\">");
+ tos << _T("<td class=\"img_middle\">");
// draw graph
Canvas canvas(m_nTimelineWidth, 49);
@@ -548,10 +548,10 @@ void ColSplitTimeline::outputRenderRowInOut(ext::ostream& tos, const Contact& co
if (getStatistic()->newFilePNG(canvas, strFinalFile))
{
- tos << muT("<img src=\"") << strFinalFile << muT("\"/>");
+ tos << _T("<img src=\"") << strFinalFile << _T("\"/>");
}
- tos << muT("</td>") << ext::endl;
+ tos << _T("</td>") << ext::endl;
}
void ColSplitTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& contact, DisplayType display)
@@ -559,7 +559,7 @@ void ColSplitTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& co
SplitParams params = getParams();
const TimelineMap* pData = reinterpret_cast<const TimelineMap*>(contact.getSlot(contactDataSlotGet()));
- tos << muT("<td class=\"img_middle\">");
+ tos << _T("<td class=\"img_middle\">");
// draw graph
Canvas canvas(m_nTimelineWidth, 49);
@@ -631,8 +631,8 @@ void ColSplitTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& co
if (getStatistic()->newFilePNG(canvas, strFinalFile))
{
- tos << muT("<img src=\"") << strFinalFile << muT("\"/>");
+ tos << _T("<img src=\"") << strFinalFile << _T("\"/>");
}
- tos << muT("</td>") << ext::endl;
+ tos << _T("</td>") << ext::endl;
}
diff --git a/plugins/HistoryStats/src/column_splittimeline.h b/plugins/HistoryStats/src/column_splittimeline.h
index e3754f5891..48881ebfd9 100644
--- a/plugins/HistoryStats/src/column_splittimeline.h
+++ b/plugins/HistoryStats/src/column_splittimeline.h
@@ -76,9 +76,9 @@ public:
explicit ColSplitTimeline();
protected:
- virtual const mu_text* impl_getUID() const { return con::ColSplitTimeline; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("\"Split\" timeline")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding a graphical overview of your chatting behaviour (out, in, total, in/out ratio) from the first to the last day of your history. The information is spread along x- and y-axis and the values are encoded as color values. Different chatting behaviour measures are available.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColSplitTimeline; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("\"Split\" timeline"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding a graphical overview of your chatting behaviour (out, in, total, in/out ratio) from the first to the last day of your history. The information is spread along x- and y-axis and the values are encoded as color values. Different chatting behaviour measures are available."); }
virtual void impl_copyConfig(const Column* pSource);
virtual int impl_getFeatures() const { return cfHasConfig | cfAcquiresData; }
virtual void impl_configRead(const SettingsTree& settings);
diff --git a/plugins/HistoryStats/src/column_timeline.cpp b/plugins/HistoryStats/src/column_timeline.cpp
index 0caeb6564a..df41c85a71 100644
--- a/plugins/HistoryStats/src/column_timeline.cpp
+++ b/plugins/HistoryStats/src/column_timeline.cpp
@@ -42,29 +42,29 @@ void ColTimeline::impl_configWrite(SettingsTree& settings) const
void ColTimeline::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
{
- /**/m_hSource = Opt.insertCombo(hGroup, i18n(muT("Data source")));
- /**/m_hIgnoreOld = Opt.insertEdit(hGroup, i18n(muT("Drop everything older than (days, 0=no limit)")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/m_hDetail = Opt.insertCheck(hGroup, i18n(muT("Details for every bar (tooltip)")));
- /**/m_hDays = Opt.insertEdit (hGroup, i18n(muT("Number of days to group")), muT(""), OptionsCtrl::OCF_NUMBER);
-
- static const mu_text* sourceTexts[] = {
- I18N(muT("Characters (incoming)")),
- I18N(muT("Characters (outgoing)")),
- I18N(muT("Characters (all)")),
- I18N(muT("Characters (in/out ratio)")),
- I18N(muT("Messages (incoming)")),
- I18N(muT("Messages (outgoing)")),
- I18N(muT("Messages (all)")),
- I18N(muT("Messages (in/out ratio)")),
- I18N(muT("Chats (incoming)")),
- I18N(muT("Chats (outgoing)")),
- I18N(muT("Chats (all)")),
- I18N(muT("Chats (in/out ratio)")),
+ m_hSource = Opt.insertCombo(hGroup, TranslateT("Data source"));
+ m_hIgnoreOld = Opt.insertEdit(hGroup, TranslateT("Drop everything older than (days, 0=no limit)"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hDetail = Opt.insertCheck(hGroup, TranslateT("Details for every bar (tooltip)"));
+ m_hDays = Opt.insertEdit (hGroup, TranslateT("Number of days to group"), _T(""), OptionsCtrl::OCF_NUMBER);
+
+ static const TCHAR* sourceTexts[] = {
+ LPGENT("Characters (incoming)"),
+ LPGENT("Characters (outgoing)"),
+ LPGENT("Characters (all)"),
+ LPGENT("Characters (in/out ratio)"),
+ LPGENT("Messages (incoming)"),
+ LPGENT("Messages (outgoing)"),
+ LPGENT("Messages (all)"),
+ LPGENT("Messages (in/out ratio)"),
+ LPGENT("Chats (incoming)"),
+ LPGENT("Chats (outgoing)"),
+ LPGENT("Chats (all)"),
+ LPGENT("Chats (in/out ratio)"),
};
array_each_(i, sourceTexts)
{
- Opt.addComboItem(m_hSource, i18n(sourceTexts[i]));
+ Opt.addComboItem(m_hSource, TranslateTS(sourceTexts[i]));
}
Opt.setComboSelected(m_hSource , 4 * m_nSource + m_nSourceType);
@@ -88,9 +88,7 @@ void ColTimeline::impl_configFromUI(OptionsCtrl& Opt)
int ColTimeline::impl_configGetRestrictions(ext::string* pDetails) const
{
if (pDetails && m_bDetail)
- {
- *pDetails = i18n(muT("Details for every bar (tooltip) are only available with HTML output."));
- }
+ *pDetails = TranslateT("Details for every bar (tooltip) are only available with HTML output.");
// m_bDetail "on" means we need tooltips and they are not available with PNG output
return crHTMLFull | (m_bDetail ? crPNGPartial : crPNGFull);
@@ -98,7 +96,7 @@ int ColTimeline::impl_configGetRestrictions(ext::string* pDetails) const
ext::string ColTimeline::impl_contactDataGetUID() const
{
- return ext::str(ext::format(muT("timeline-|")) % m_nSource);
+ return ext::str(ext::format(_T("timeline-|")) % m_nSource);
}
void ColTimeline::impl_contactDataPrepare(Contact& contact) const
@@ -170,20 +168,20 @@ Column::StyleList ColTimeline::impl_outputGetAdditionalStyles(IDProvider& idp)
{
m_CSS = idp.getID();
- l.push_back(StylePair(muT("div.") + m_CSS, muT("position: relative; left: 50%; margin-left: -") + utils::intToString(m_nTimelineWidth / 2) + muT("px; width: ") + utils::intToString(m_nTimelineWidth) + muT("px; height: 49px;")));
+ l.push_back(StylePair(_T("div.") + m_CSS, _T("position: relative; left: 50%; margin-left: -") + utils::intToString(m_nTimelineWidth / 2) + _T("px; width: ") + utils::intToString(m_nTimelineWidth) + _T("px; height: 49px;")));
if (m_nSourceType != 3)
{
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div"), muT("position: absolute; top: 0px; width: 3px; height: 49px; overflow: hidden;")));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div div"), muT("position: absolute; left: 0px; width: 3px; background-color: ") + utils::colorToHTML(con::ColorBar) + muT(";")));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div.l"), muT("position: absolute; top: 24px; left: 0px; height: 1px; width: ") + utils::intToString(m_nTimelineWidth) + muT("px; background-color: ") + utils::colorToHTML(con::ColorBarLine) + muT("; z-index: 9;")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div"), _T("position: absolute; top: 0px; width: 3px; height: 49px; overflow: hidden;")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div div"), _T("position: absolute; left: 0px; width: 3px; background-color: ") + utils::colorToHTML(con::ColorBar) + _T(";")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div.l"), _T("position: absolute; top: 24px; left: 0px; height: 1px; width: ") + utils::intToString(m_nTimelineWidth) + _T("px; background-color: ") + utils::colorToHTML(con::ColorBarLine) + _T("; z-index: 9;")));
}
else
{
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div"), muT("position: absolute; top: 0px; width: 3px; height: 49px; overflow: hidden; z-index: 9;")));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div div.o"), muT("position: absolute; left: 0px; width: 3px; background-color: ") + utils::colorToHTML(con::ColorOut) + muT(";")));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div div.i"), muT("position: absolute; top: 24px; left: 0px; width: 3px; background-color: ") + utils::colorToHTML(con::ColorIn) + muT(";")));
- l.push_back(StylePair(muT("div.") + m_CSS + muT(" div.l"), muT("position: absolute; top: 24px; left: 0px; height: 1px; width: ") + utils::intToString(m_nTimelineWidth) + muT("px; background-color: ") + utils::colorToHTML(con::ColorIOLine) + muT("; z-index: 8;")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div"), _T("position: absolute; top: 0px; width: 3px; height: 49px; overflow: hidden; z-index: 9;")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div div.o"), _T("position: absolute; left: 0px; width: 3px; background-color: ") + utils::colorToHTML(con::ColorOut) + _T(";")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div div.i"), _T("position: absolute; top: 24px; left: 0px; width: 3px; background-color: ") + utils::colorToHTML(con::ColorIn) + _T(";")));
+ l.push_back(StylePair(_T("div.") + m_CSS + _T(" div.l"), _T("position: absolute; top: 24px; left: 0px; height: 1px; width: ") + utils::intToString(m_nTimelineWidth) + _T("px; background-color: ") + utils::colorToHTML(con::ColorIOLine) + _T("; z-index: 8;")));
}
}
@@ -192,27 +190,27 @@ Column::StyleList ColTimeline::impl_outputGetAdditionalStyles(IDProvider& idp)
void ColTimeline::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
- static const mu_text* szSourceDesc[] = {
- I18N(muT("incoming characters")),
- I18N(muT("outgoing characters")),
- I18N(muT("all characters")),
- I18N(muT("in/out ratio of characters")),
- I18N(muT("incoming messages")),
- I18N(muT("outgoing messages")),
- I18N(muT("all messages")),
- I18N(muT("in/out ratio of messages")),
- I18N(muT("incoming chats")),
- I18N(muT("outgoing chats")),
- I18N(muT("all chats")),
- I18N(muT("in/out ratio of chats")),
+ static const TCHAR* szSourceDesc[] = {
+ LPGENT("incoming characters"),
+ LPGENT("outgoing characters"),
+ LPGENT("all characters"),
+ LPGENT("in/out ratio of characters"),
+ LPGENT("incoming messages"),
+ LPGENT("outgoing messages"),
+ LPGENT("all messages"),
+ LPGENT("in/out ratio of messages"),
+ LPGENT("incoming chats"),
+ LPGENT("outgoing chats"),
+ LPGENT("all chats"),
+ LPGENT("in/out ratio of chats"),
};
if (row == 1)
{
- ext::string strTitle = str(ext::kformat(i18n(muT("Timeline for #{data}")))
- % muT("#{data}") * i18n(szSourceDesc[4 * m_nSource + m_nSourceType]));
+ ext::string strTitle = str(ext::kformat(TranslateT("Timeline for #{data}"))
+ % _T("#{data}") * TranslateTS(szSourceDesc[4 * m_nSource + m_nSourceType]));
- writeRowspanTD(tos, getCustomTitle(i18n(muT("Timeline")), strTitle) + muT("<div style=\"width: ") + utils::intToString(m_nTimelineWidth) + muT("px;\"></div>"), row, 1, rowSpan);
+ writeRowspanTD(tos, getCustomTitle(TranslateT("Timeline"), strTitle) + _T("<div style=\"width: ") + utils::intToString(m_nTimelineWidth) + _T("px;\"></div>"), row, 1, rowSpan);
}
}
@@ -273,7 +271,7 @@ void ColTimeline::outputRenderRowInOut(ext::ostream& tos, const Contact& contact
if (usePNG())
{
- tos << muT("<td class=\"img_middle\">");
+ tos << _T("<td class=\"img_middle\">");
// draw graph
Canvas canvas(m_nTimelineWidth, 49);
@@ -315,16 +313,16 @@ void ColTimeline::outputRenderRowInOut(ext::ostream& tos, const Contact& contact
if (getStatistic()->newFilePNG(canvas, strFinalFile))
{
- tos << muT("<img src=\"") << strFinalFile << muT("\"/>");
+ tos << _T("<img src=\"") << strFinalFile << _T("\"/>");
}
- tos << muT("</td>") << ext::endl;
+ tos << _T("</td>") << ext::endl;
}
else
{
- tos << muT("<td class=\"bars_middle\">")
- << muT("<div class=\"") << m_CSS << muT("\">")
- << muT("<div class=\"l\"></div>") << ext::endl;
+ tos << _T("<td class=\"bars_middle\">")
+ << _T("<div class=\"") << m_CSS << _T("\">")
+ << _T("<div class=\"l\"></div>") << ext::endl;
for (curDay = m_nFirstDay; curDay <= m_nLastDay; curDay += m_nDays)
{
@@ -346,42 +344,42 @@ void ColTimeline::outputRenderRowInOut(ext::ostream& tos, const Contact& contact
{
DWORD rightDay = min(curDay + m_nDays - 1, m_nLastDay);
- tos << muT("<div title=\"");
+ tos << _T("<div title=\"");
if (rightDay != curDay)
{
- tos << utils::htmlEscape(ext::str(ext::kformat(i18n(muT("[#{start_date}-#{end_date}] #{amount}")))
- % muT("#{start_date}") * utils::timestampToDate(curDay * 86400)
- % muT("#{end_date}") * utils::timestampToDate(rightDay * 86400)
- % muT("#{amount}") * utils::intToGrouped(part_top)));
+ tos << utils::htmlEscape(ext::str(ext::kformat(TranslateT("[#{start_date}-#{end_date}] #{amount}"))
+ % _T("#{start_date}") * utils::timestampToDate(curDay * 86400)
+ % _T("#{end_date}") * utils::timestampToDate(rightDay * 86400)
+ % _T("#{amount}") * utils::intToGrouped(part_top)));
}
else
{
- tos << utils::htmlEscape(ext::str(ext::kformat(i18n(muT("[#{date}] #{amount}")))
- % muT("#{date}") * utils::timestampToDate(curDay * 86400)
- % muT("#{amount}") * utils::intToGrouped(part_top)));
+ tos << utils::htmlEscape(ext::str(ext::kformat(TranslateT("[#{date}] #{amount}"))
+ % _T("#{date}") * utils::timestampToDate(curDay * 86400)
+ % _T("#{amount}") * utils::intToGrouped(part_top)));
}
- tos << muT("\" style=\"left: ")
- << (3 * ((curDay - m_nFirstDay) / m_nDays)) << muT("px;\">");
+ tos << _T("\" style=\"left: ")
+ << (3 * ((curDay - m_nFirstDay) / m_nDays)) << _T("px;\">");
}
else if (bar_len != 0)
{
- tos << muT("<div style=\"left: ") << (3 * ((curDay - m_nFirstDay) / m_nDays)) << muT("px;\">");
+ tos << _T("<div style=\"left: ") << (3 * ((curDay - m_nFirstDay) / m_nDays)) << _T("px;\">");
}
if (bar_len != 0)
{
- tos << muT("<div style=\"top: ") << (24 - bar_len) << muT("px; height: ") << (1 + 2 * bar_len) << muT("px;\"></div>");
+ tos << _T("<div style=\"top: ") << (24 - bar_len) << _T("px; height: ") << (1 + 2 * bar_len) << _T("px;\"></div>");
}
if (m_bDetail || bar_len != 0)
{
- tos << muT("</div>") << ext::endl;
+ tos << _T("</div>") << ext::endl;
}
}
- tos << muT("</div></td>") << ext::endl;
+ tos << _T("</div></td>") << ext::endl;
}
}
@@ -393,7 +391,7 @@ void ColTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& contact
if (usePNG())
{
- tos << muT("<td class=\"img_middle\">");
+ tos << _T("<td class=\"img_middle\">");
// draw graph
Canvas canvas(m_nTimelineWidth, 49);
@@ -450,16 +448,16 @@ void ColTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& contact
if (getStatistic()->newFilePNG(canvas, strFinalFile))
{
- tos << muT("<img src=\"") << strFinalFile << muT("\"/>");
+ tos << _T("<img src=\"") << strFinalFile << _T("\"/>");
}
- tos << muT("</td>") << ext::endl;
+ tos << _T("</td>") << ext::endl;
}
else
{
- tos << muT("<td class=\"bars_middle\">")
- << muT("<div class=\"") << m_CSS << muT("\">")
- << muT("<div class=\"l\"></div>") << ext::endl;
+ tos << _T("<td class=\"bars_middle\">")
+ << _T("<div class=\"") << m_CSS << _T("\">")
+ << _T("<div class=\"l\"></div>") << ext::endl;
for (curDay = m_nFirstDay; curDay <= m_nLastDay; curDay += m_nDays)
{
@@ -490,47 +488,47 @@ void ColTimeline::outputRenderRowRatio(ext::ostream& tos, const Contact& contact
{
DWORD rightDay = min(curDay + m_nDays - 1, m_nLastDay);
- tos << muT("<div title=\"");
+ tos << _T("<div title=\"");
if (rightDay != curDay)
{
- tos << utils::htmlEscape(ext::str(ext::kformat(i18n(muT("[#{start_date}-#{end_date}] #{out_amount} (out) / #{in_amount} (in)")))
- % muT("#{start_date}") * utils::timestampToDate(curDay * 86400)
- % muT("#{end_date}") * utils::timestampToDate(rightDay * 86400)
- % muT("#{out_amount}") * utils::intToGrouped(part_out)
- % muT("#{in_amount}") * utils::intToGrouped(part_in)));
+ tos << utils::htmlEscape(ext::str(ext::kformat(TranslateT("[#{start_date}-#{end_date}] #{out_amount} (out) / #{in_amount} (in)"))
+ % _T("#{start_date}") * utils::timestampToDate(curDay * 86400)
+ % _T("#{end_date}") * utils::timestampToDate(rightDay * 86400)
+ % _T("#{out_amount}") * utils::intToGrouped(part_out)
+ % _T("#{in_amount}") * utils::intToGrouped(part_in)));
}
else
{
- tos << utils::htmlEscape(ext::str(ext::kformat(i18n(muT("[#{date}] #{out_amount} (out) / #{in_amount} (in)")))
- % muT("#{date}") * utils::timestampToDate(curDay * 86400)
- % muT("#{out_amount}") * utils::intToGrouped(part_out)
- % muT("#{in_amount}") * utils::intToGrouped(part_in)));
+ tos << utils::htmlEscape(ext::str(ext::kformat(TranslateT("[#{date}] #{out_amount} (out) / #{in_amount} (in)"))
+ % _T("#{date}") * utils::timestampToDate(curDay * 86400)
+ % _T("#{out_amount}") * utils::intToGrouped(part_out)
+ % _T("#{in_amount}") * utils::intToGrouped(part_in)));
}
- tos << muT("\" style=\"left: ")
- << (3 * ((curDay - m_nFirstDay) / m_nDays)) << muT("px;\">");
+ tos << _T("\" style=\"left: ")
+ << (3 * ((curDay - m_nFirstDay) / m_nDays)) << _T("px;\">");
}
else if (bar_len != 0)
{
- tos << muT("<div style=\"left: ") << (3 * ((curDay - m_nFirstDay) / m_nDays)) << muT("px;\">");
+ tos << _T("<div style=\"left: ") << (3 * ((curDay - m_nFirstDay) / m_nDays)) << _T("px;\">");
}
if (bar_len < 0)
{
- tos << muT("<div class=\"i\" style=\"height: ") << -bar_len << muT("px;\"></div>");
+ tos << _T("<div class=\"i\" style=\"height: ") << -bar_len << _T("px;\"></div>");
}
else if (bar_len > 0)
{
- tos << muT("<div class=\"o\" style=\"top: ") << (25 - bar_len) << muT("px; height: ") << bar_len << muT("px;\"></div>");
+ tos << _T("<div class=\"o\" style=\"top: ") << (25 - bar_len) << _T("px; height: ") << bar_len << _T("px;\"></div>");
}
if (m_bDetail || bar_len != 0)
{
- tos << muT("</div>") << ext::endl;
+ tos << _T("</div>") << ext::endl;
}
}
- tos << muT("</div></td>") << ext::endl;
+ tos << _T("</div></td>") << ext::endl;
}
}
diff --git a/plugins/HistoryStats/src/column_timeline.h b/plugins/HistoryStats/src/column_timeline.h
index 642a900546..38a3108e95 100644
--- a/plugins/HistoryStats/src/column_timeline.h
+++ b/plugins/HistoryStats/src/column_timeline.h
@@ -52,9 +52,9 @@ public:
explicit ColTimeline();
protected:
- virtual const mu_text* impl_getUID() const { return con::ColTimeline; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("Timeline")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding a graphical overview of your chatting behaviour (out, in, total, in/out ratio) from the first to the last day of your history on an daily basis. Multiple days can be grouped. Different chatting behaviour measures are available.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColTimeline; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("Timeline"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding a graphical overview of your chatting behaviour (out, in, total, in/out ratio) from the first to the last day of your history on an daily basis. Multiple days can be grouped. Different chatting behaviour measures are available."); }
virtual void impl_copyConfig(const Column* pSource);
virtual int impl_getFeatures() const { return cfHasConfig | cfAcquiresData; }
virtual void impl_configRead(const SettingsTree& settings);
diff --git a/plugins/HistoryStats/src/column_wordcount.cpp b/plugins/HistoryStats/src/column_wordcount.cpp
index fd172e0716..f2a68056ca 100644
--- a/plugins/HistoryStats/src/column_wordcount.cpp
+++ b/plugins/HistoryStats/src/column_wordcount.cpp
@@ -45,11 +45,11 @@ void ColWordCount::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
OptionsCtrl::Group hTemp;
- /**/hTemp = Opt.insertGroup(hGroup, i18n(muT("Word count type")));
- /**/ m_hVisMode = Opt.insertRadio(hTemp, NULL, i18n(muT("Total words")));
- /**/ Opt.insertRadio(hTemp, m_hVisMode, i18n(muT("Distinct words")));
- /**/ Opt.insertRadio(hTemp, m_hVisMode, i18n(muT("Ratio total/distinct words")));
- /**/m_hDetail = Opt.insertCheck(hGroup, i18n(muT("Additional info in tooltip (depends on type)")));
+ hTemp = Opt.insertGroup(hGroup, TranslateT("Word count type"));
+ m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Total words"));
+ Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Distinct words"));
+ Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Ratio total/distinct words"));
+ m_hDetail = Opt.insertCheck(hGroup, TranslateT("Additional info in tooltip (depends on type)"));
Opt.setRadioChecked(m_hVisMode, m_nVisMode);
Opt.checkItem (m_hDetail , m_bDetail );
@@ -110,25 +110,25 @@ void ColWordCount::impl_contactDataTransformCleanup(Contact& contact) const
void ColWordCount::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
- static const mu_text* szTypeDesc[] = {
- I18N(muT("Total word count")),
- I18N(muT("Distinct word count")),
- I18N(muT("Ratio total/distinct words")),
+ static const TCHAR* szTypeDesc[] = {
+ LPGENT("Total word count"),
+ LPGENT("Distinct word count"),
+ LPGENT("Ratio total/distinct words")
};
- static const mu_text* szSourceDesc[] = {
- I18N(muT("incoming messages")),
- I18N(muT("outgoing messages")),
- I18N(muT("all messages")),
+ static const TCHAR* szSourceDesc[] = {
+ LPGENT("incoming messages"),
+ LPGENT("outgoing messages"),
+ LPGENT("all messages"),
};
if (row == 1)
{
- ext::string strTitle = str(ext::kformat(i18n(muT("#{type} for #{data}")))
- % muT("#{type}") * i18n(szTypeDesc[m_nVisMode])
- % muT("#{data}") * i18n(szSourceDesc[m_nSource]));
+ ext::string strTitle = str(ext::kformat(TranslateT("#{type} for #{data}"))
+ % _T("#{type}") * TranslateTS(szTypeDesc[m_nVisMode])
+ % _T("#{data}") * TranslateTS(szSourceDesc[m_nSource]));
- writeRowspanTD(tos, getCustomTitle(i18n(szTypeDesc[m_nVisMode]), strTitle), row, 1, rowSpan);
+ writeRowspanTD(tos, getCustomTitle(TranslateTS(szTypeDesc[m_nVisMode]), strTitle), row, 1, rowSpan);
}
}
@@ -142,18 +142,18 @@ void ColWordCount::impl_outputRenderRow(ext::ostream& tos, const Contact& contac
{
if (!m_bDetail)
{
- tos << muT("<td class=\"num\">")
+ tos << _T("<td class=\"num\">")
<< utils::intToGrouped(pWordCount[0])
- << muT("</td>") << ext::endl;
+ << _T("</td>") << ext::endl;
}
else
{
- tos << muT("<td class=\"num\" title=\"")
- << utils::htmlEscape(ext::str(ext::kformat(i18n(muT("#{distict_words} distinct")))
- % muT("#{distict_words}") * utils::intToGrouped(pWordCount[1])))
- << muT("\">")
+ tos << _T("<td class=\"num\" title=\"")
+ << utils::htmlEscape(ext::str(ext::kformat(TranslateT("#{distict_words} distinct"))
+ % _T("#{distict_words}") * utils::intToGrouped(pWordCount[1])))
+ << _T("\">")
<< utils::intToGrouped(pWordCount[0])
- << muT("</td>") << ext::endl;
+ << _T("</td>") << ext::endl;
}
}
break;
@@ -162,18 +162,18 @@ void ColWordCount::impl_outputRenderRow(ext::ostream& tos, const Contact& contac
{
if (!m_bDetail)
{
- tos << muT("<td class=\"num\">")
+ tos << _T("<td class=\"num\">")
<< utils::intToGrouped(pWordCount[1])
- << muT("</td>") << ext::endl;
+ << _T("</td>") << ext::endl;
}
else
{
- tos << muT("<td class=\"num\" title=\"")
- << utils::htmlEscape(ext::str(ext::kformat(i18n(muT("#{words} total")))
- % muT("#{words}") * utils::intToGrouped(pWordCount[0])))
- << muT("\">")
+ tos << _T("<td class=\"num\" title=\"")
+ << utils::htmlEscape(ext::str(ext::kformat(TranslateT("#{words} total"))
+ % _T("#{words}") * utils::intToGrouped(pWordCount[0])))
+ << _T("\">")
<< utils::intToGrouped(pWordCount[1])
- << muT("</td>") << ext::endl;
+ << _T("</td>") << ext::endl;
}
}
break;
@@ -182,19 +182,19 @@ void ColWordCount::impl_outputRenderRow(ext::ostream& tos, const Contact& contac
{
if (!m_bDetail)
{
- tos << muT("<td class=\"num\">")
+ tos << _T("<td class=\"num\">")
<< utils::ratioToString(pWordCount[0], pWordCount[1], 2)
- << muT("</td>") << ext::endl;
+ << _T("</td>") << ext::endl;
}
else
{
- tos << muT("<td class=\"num\" title=\"")
- << utils::htmlEscape(ext::str(ext::kformat(i18n(muT("#{words} total / #{distict_words} distinct")))
- % muT("#{words}") * utils::intToGrouped(pWordCount[0])
- % muT("#{distict_words}") * utils::intToGrouped(pWordCount[1])))
- << muT("\">")
+ tos << _T("<td class=\"num\" title=\"")
+ << utils::htmlEscape(ext::str(ext::kformat(TranslateT("#{words} total / #{distict_words} distinct"))
+ % _T("#{words}") * utils::intToGrouped(pWordCount[0])
+ % _T("#{distict_words}") * utils::intToGrouped(pWordCount[1])))
+ << _T("\">")
<< utils::ratioToString(pWordCount[0], pWordCount[1], 2)
- << muT("</td>") << ext::endl;
+ << _T("</td>") << ext::endl;
}
}
break;
diff --git a/plugins/HistoryStats/src/column_wordcount.h b/plugins/HistoryStats/src/column_wordcount.h
index 028c95a952..ebbea04c36 100644
--- a/plugins/HistoryStats/src/column_wordcount.h
+++ b/plugins/HistoryStats/src/column_wordcount.h
@@ -21,9 +21,9 @@ public:
explicit ColWordCount();
protected:
- virtual const mu_text* impl_getUID() const { return con::ColWordCount; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("Word count")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding the number of (distinct) words used by you, by your contact, or by both of you.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColWordCount; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("Word count"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding the number of (distinct) words used by you, by your contact, or by both of you."); }
virtual void impl_copyConfig(const Column* pSource);
virtual void impl_configRead(const SettingsTree& settings);
virtual void impl_configWrite(SettingsTree& settings) const;
diff --git a/plugins/HistoryStats/src/column_words.cpp b/plugins/HistoryStats/src/column_words.cpp
index 61991f3638..bae075d3c0 100644
--- a/plugins/HistoryStats/src/column_words.cpp
+++ b/plugins/HistoryStats/src/column_words.cpp
@@ -132,15 +132,15 @@ void ColWords::impl_configToUI(OptionsCtrl& Opt, OptionsCtrl::Item hGroup)
OptionsCtrl::Group hTemp;
- /**/hTemp = Opt.insertGroup(hGroup, i18n(muT("Words type")));
- /**/ m_hVisMode = Opt.insertRadio(hTemp, NULL, i18n(muT("Most common words")));
- /**/ Opt.insertRadio(hTemp, m_hVisMode, i18n(muT("Least common words")));
- /**/ Opt.insertRadio(hTemp, m_hVisMode, i18n(muT("Longest words")));
- /**/m_hNum = Opt.insertEdit (hGroup, i18n(muT("Number of words")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/m_hOffset = Opt.insertEdit (hGroup, i18n(muT("Number of words to skip in output")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/m_hDetail = Opt.insertCheck(hGroup, i18n(muT("Word count for each word (tooltip)")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/m_hDetailInOut = Opt.insertCheck(m_hDetail, i18n(muT("Show separate counts for incoming/outgoing")));
- /**/m_hInOutColor = Opt.insertCheck(hGroup, i18n(muT("Color words according to in/out ratio")));
+ hTemp = Opt.insertGroup(hGroup, TranslateT("Words type"));
+ m_hVisMode = Opt.insertRadio(hTemp, NULL, TranslateT("Most common words"));
+ Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Least common words"));
+ Opt.insertRadio(hTemp, m_hVisMode, TranslateT("Longest words"));
+ m_hNum = Opt.insertEdit (hGroup, TranslateT("Number of words"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hOffset = Opt.insertEdit (hGroup, TranslateT("Number of words to skip in output"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hDetail = Opt.insertCheck(hGroup, TranslateT("Word count for each word (tooltip)"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hDetailInOut = Opt.insertCheck(m_hDetail, TranslateT("Show separate counts for incoming/outgoing"));
+ m_hInOutColor = Opt.insertCheck(hGroup, TranslateT("Color words according to in/out ratio"));
Opt.setRadioChecked(m_hVisMode , m_nVisMode );
Opt.setEditNumber (m_hNum , m_nNum );
@@ -207,8 +207,8 @@ Column::StyleList ColWords::impl_outputGetAdditionalStyles(IDProvider& idp)
if (m_bInOutColor)
{
- l.push_back(StylePair(muT("span.onum"), muT("color: ") + utils::colorToHTML(con::ColorOut) + muT(";")));
- l.push_back(StylePair(muT("span.inum"), muT("color: ") + utils::colorToHTML(con::ColorIn) + muT(";")));
+ l.push_back(StylePair(_T("span.onum"), _T("color: ") + utils::colorToHTML(con::ColorOut) + _T(";")));
+ l.push_back(StylePair(_T("span.inum"), _T("color: ") + utils::colorToHTML(con::ColorIn) + _T(";")));
}
return l;
@@ -216,25 +216,25 @@ Column::StyleList ColWords::impl_outputGetAdditionalStyles(IDProvider& idp)
void ColWords::impl_outputRenderHeader(ext::ostream& tos, int row, int rowSpan) const
{
- static const mu_text* szTypeDesc[] = {
- I18N(muT("Most common words")),
- I18N(muT("Least common words")),
- I18N(muT("Longest words")),
+ static const TCHAR* szTypeDesc[] = {
+ LPGENT("Most common words"),
+ LPGENT("Least common words"),
+ LPGENT("Longest words"),
};
- static const mu_text* szSourceDesc[] = {
- I18N(muT("incoming messages")),
- I18N(muT("outgoing messages")),
- I18N(muT("all messages")),
+ static const TCHAR* szSourceDesc[] = {
+ LPGENT("incoming messages"),
+ LPGENT("outgoing messages"),
+ LPGENT("all messages"),
};
if (row == 1)
{
- ext::string strTitle = str(ext::kformat(i18n(muT("#{type} for #{data}")))
- % muT("#{type}") * i18n(szTypeDesc[m_nVisMode])
- % muT("#{data}") * i18n(szSourceDesc[m_nSource]));
+ ext::string strTitle = str(ext::kformat(TranslateT("#{type} for #{data}"))
+ % _T("#{type}") * TranslateTS(szTypeDesc[m_nVisMode])
+ % _T("#{data}") * TranslateTS(szSourceDesc[m_nSource]));
- writeRowspanTD(tos, getCustomTitle(i18n(szTypeDesc[m_nVisMode]), strTitle), row, 1, rowSpan);
+ writeRowspanTD(tos, getCustomTitle(TranslateTS(szTypeDesc[m_nVisMode]), strTitle), row, 1, rowSpan);
}
}
@@ -242,7 +242,7 @@ void ColWords::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D
{
const WordList* pWords = reinterpret_cast<const WordList*>(contact.getSlot(contactDataTransformSlotGet()));
- tos << muT("<td>");
+ tos << _T("<td>");
vector_each_(j, *pWords)
{
@@ -253,27 +253,25 @@ void ColWords::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D
ext::string strTooltip;
if (!m_bDetailInOut || m_nSource != 2)
- {
strTooltip = utils::intToString(w.first.total());
- }
else
{
- strTooltip = utils::htmlEscape(ext::str(ext::kformat(i18n(muT("[Out] #{out_words} / [In] #{in_words}")))
- % muT("#{out_words}") * w.first.out
- % muT("#{in_words}") * w.first.in));
+ strTooltip = utils::htmlEscape(ext::str(ext::kformat(TranslateT("[Out] #{out_words} / [In] #{in_words}"))
+ % _T("#{out_words}") * w.first.out
+ % _T("#{in_words}") * w.first.in));
}
if (!m_bInOutColor || m_nSource != 2 || w.first.in == w.first.out)
{
- tos << muT("<span title=\"") << strTooltip << muT("\">")
- << utils::htmlEscape(w.second) << muT("</span>");
+ tos << _T("<span title=\"") << strTooltip << _T("\">")
+ << utils::htmlEscape(w.second) << _T("</span>");
}
else
{
- tos << muT("<span class=\"")
- << ((w.first.out - w.first.in > 0) ? muT("onum") : muT("inum"))
- << muT("\" title=\"") << strTooltip << muT("\">")
- << utils::htmlEscape(w.second) << muT("</span>");
+ tos << _T("<span class=\"")
+ << ((w.first.out - w.first.in > 0) ? _T("onum") : _T("inum"))
+ << _T("\" title=\"") << strTooltip << _T("\">")
+ << utils::htmlEscape(w.second) << _T("</span>");
}
}
else
@@ -284,17 +282,17 @@ void ColWords::impl_outputRenderRow(ext::ostream& tos, const Contact& contact, D
}
else
{
- tos << muT("<span class=\"")
- << ((w.first.out - w.first.in > 0) ? muT("onum") : muT("inum"))
- << muT("\">") << utils::htmlEscape(w.second) << muT("</span>");
+ tos << _T("<span class=\"")
+ << ((w.first.out - w.first.in > 0) ? _T("onum") : _T("inum"))
+ << _T("\">") << utils::htmlEscape(w.second) << _T("</span>");
}
}
if (j < pWords->size() - 1)
{
- tos << muT(", ");
+ tos << _T(", ");
}
}
- tos << muT("</td>") << ext::endl;
+ tos << _T("</td>") << ext::endl;
}
diff --git a/plugins/HistoryStats/src/column_words.h b/plugins/HistoryStats/src/column_words.h
index f6d1284562..31406c07ad 100644
--- a/plugins/HistoryStats/src/column_words.h
+++ b/plugins/HistoryStats/src/column_words.h
@@ -64,9 +64,9 @@ public:
explicit ColWords();
protected:
- virtual const mu_text* impl_getUID() const { return con::ColWords; }
- virtual const mu_text* impl_getTitle() const { return i18n(muT("Words")); }
- virtual const mu_text* impl_getDescription() const { return i18n(muT("Column holding a list of a specified number of most/least common words or longest words used by you, by your contact, or by both of you.")); }
+ virtual const TCHAR* impl_getUID() const { return con::ColWords; }
+ virtual const TCHAR* impl_getTitle() const { return TranslateT("Words"); }
+ virtual const TCHAR* impl_getDescription() const { return TranslateT("Column holding a list of a specified number of most/least common words or longest words used by you, by your contact, or by both of you."); }
virtual void impl_copyConfig(const Column* pSource);
virtual void impl_configRead(const SettingsTree& settings);
virtual void impl_configWrite(SettingsTree& settings) const;
diff --git a/plugins/HistoryStats/src/contact.cpp b/plugins/HistoryStats/src/contact.cpp
index 260ed68c1e..830c782f91 100644
--- a/plugins/HistoryStats/src/contact.cpp
+++ b/plugins/HistoryStats/src/contact.cpp
@@ -5,39 +5,37 @@
#include <queue>
#include <cmath>
-Contact::Contact(Statistic* pStatistic, int nSlots, const ext::string& nick, const ext::string& protocol, const ext::string& group, int nContacts, int nSubcontacts)
- : m_Nick(nick)
- , m_Protocol(protocol)
- , m_Group(group)
- , m_Bytes(0, 0)
- , m_Messages(0, 0)
- , m_Chats(0, 0)
- , m_bFirstLastTimeValid(false)
- , m_FirstTime(0)
- , m_LastTime(0)
- , m_bChatDurValid(false)
- , m_ChatDurMin(0xFFFFFFFF)
- , m_ChatDurMax(0)
- , m_ChatDurSum(0)
- , m_Urls(0, 0)
- , m_Files(0, 0)
- , m_NumContacts(nContacts)
- , m_NumSubcontacts(nSubcontacts)
- , m_pStatistic(pStatistic)
+Contact::Contact(Statistic* pStatistic, int nSlots, const ext::string& nick, const ext::string& protocol, const ext::string& group, int nContacts, int nSubcontacts) :
+ m_Nick(nick),
+ m_Protocol(protocol),
+ m_Group(group),
+ m_Bytes(0, 0),
+ m_Messages(0, 0),
+ m_Chats(0, 0),
+ m_bFirstLastTimeValid(false),
+ m_FirstTime(0),
+ m_LastTime(0),
+ m_bChatDurValid(false),
+ m_ChatDurMin(0xFFFFFFFF),
+ m_ChatDurMax(0),
+ m_ChatDurSum(0),
+ m_Urls(0, 0),
+ m_Files(0, 0),
+ m_NumContacts(nContacts),
+ m_NumSubcontacts(nSubcontacts),
+ m_pStatistic(pStatistic)
{
m_Slots.resize(nSlots, NULL);
}
void Contact::updateTime(DWORD msgTime)
{
- if (!m_bFirstLastTimeValid)
- {
+ if (!m_bFirstLastTimeValid) {
m_FirstTime = msgTime;
m_LastTime = msgTime;
m_bFirstLastTimeValid = true;
}
- else
- {
+ else {
m_FirstTime = min(m_FirstTime, msgTime);
m_LastTime = max(m_LastTime, msgTime);
}
@@ -56,24 +54,19 @@ void Contact::updateChatDur(DWORD timeDelta)
double Contact::getAvg(int nTotal) const
{
DWORD dwHistTime = m_pStatistic->getLastTime() - getFirstTime();
-
if (dwHistTime < m_pStatistic->getAverageMinTime())
- {
dwHistTime = m_pStatistic->getAverageMinTime();
- }
return dwHistTime ? (0.0 + nTotal) / dwHistTime : 0.0;
}
void Contact::addMessage(Message& msg)
{
- if (msg.isOutgoing())
- {
+ if (msg.isOutgoing()) {
m_Bytes.out += msg.getLength();
m_Messages.out++;
}
- else
- {
+ else {
m_Bytes.in += msg.getLength();
m_Messages.in++;
}
@@ -84,13 +77,9 @@ void Contact::addMessage(Message& msg)
void Contact::addChat(bool bOutgoing, DWORD localTimestampStarted, DWORD duration)
{
if (bOutgoing)
- {
m_Chats.out++;
- }
else
- {
m_Chats.in++;
- }
updateChatDur(duration);
}
@@ -99,59 +88,46 @@ void Contact::addEvent(WORD eventType, bool bOutgoing)
{
InOut* pIO = NULL;
- switch (eventType)
- {
- case EVENTTYPE_URL:
- pIO = &m_Urls;
- break;
+ switch (eventType) {
+ case EVENTTYPE_URL:
+ pIO = &m_Urls;
+ break;
- case EVENTTYPE_FILE:
- pIO = &m_Files;
- break;
+ case EVENTTYPE_FILE:
+ pIO = &m_Files;
+ break;
- default:
- return;
+ default:
+ return;
}
if (bOutgoing)
- {
pIO->out++;
- }
else
- {
pIO->in++;
- }
}
void Contact::merge(const Contact& other)
{
if (m_Nick != other.m_Nick)
- {
- m_Nick = i18n(muT("(multiple)"));
- }
+ m_Nick = TranslateT("(multiple)");
if (m_Protocol != other.m_Protocol)
- {
- m_Protocol = i18n(muT("(multiple)"));
- }
+ m_Protocol = TranslateT("(multiple)");
if (m_Group != other.m_Group)
- {
- m_Group = i18n(muT("(multiple)"));
- }
+ m_Group = TranslateT("(multiple)");
m_Bytes += other.m_Bytes;
m_Messages += other.m_Messages;
m_Chats += other.m_Chats;
- if (other.m_bFirstLastTimeValid)
- {
+ if (other.m_bFirstLastTimeValid) {
updateTime(other.m_FirstTime);
updateTime(other.m_LastTime);
}
- if (other.m_bChatDurValid)
- {
+ if (other.m_bChatDurValid) {
m_ChatDurSum += other.m_ChatDurSum - other.m_ChatDurMin - other.m_ChatDurMax;
updateChatDur(other.m_ChatDurMin);
diff --git a/plugins/HistoryStats/src/dlgconfigure.cpp b/plugins/HistoryStats/src/dlgconfigure.cpp
index 5c4ad0b727..50ef62827d 100644
--- a/plugins/HistoryStats/src/dlgconfigure.cpp
+++ b/plugins/HistoryStats/src/dlgconfigure.cpp
@@ -17,67 +17,60 @@ INT_PTR CALLBACK DlgConfigure::staticConfigureProc(HWND hDlg, UINT msg, WPARAM w
{
DlgConfigure* pDlg = reinterpret_cast<DlgConfigure*>(GetWindowLong(hDlg, DWLP_USER));
- switch (msg)
- {
- case WM_INITDIALOG:
- pDlg = new DlgConfigure(hDlg);
- SetWindowLong(hDlg, DWLP_USER, reinterpret_cast<LONG>(pDlg));
- pDlg->onWMInitDialog();
+ switch (msg) {
+ case WM_INITDIALOG:
+ pDlg = new DlgConfigure(hDlg);
+ SetWindowLong(hDlg, DWLP_USER, reinterpret_cast<LONG>(pDlg));
+ pDlg->onWMInitDialog();
+ return TRUE;
+
+ case WM_DESTROY:
+ delete pDlg;
+ SetWindowLong(hDlg, DWLP_USER, 0);
+ break;
+
+ case PSM_CHANGED:
+ EnableWindow(GetDlgItem(hDlg, IDC_APPLY), TRUE);
+ pDlg->m_bChanged = true;
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDCANCEL:
+ pDlg->onCancel();
return TRUE;
- case WM_DESTROY:
- delete pDlg;
- SetWindowLong(hDlg, DWLP_USER, 0);
- break;
-
- case PSM_CHANGED:
- {
- EnableWindow(GetDlgItem(hDlg, IDC_APPLY), TRUE);
- pDlg->m_bChanged = true;
- }
+ case IDOK:
+ pDlg->onApply();
+ DestroyWindow(hDlg);
return TRUE;
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDCANCEL:
- pDlg->onCancel();
- return TRUE;
-
- case IDOK:
- pDlg->onApply();
- DestroyWindow(hDlg);
- return TRUE;
-
- case IDC_APPLY:
- pDlg->onApply();
- return TRUE;
- }
- }
- break;
-
- case WM_WINDOWPOSCHANGED:
- pDlg->rearrangeControls();
+ case IDC_APPLY:
+ pDlg->onApply();
return TRUE;
+ }
+ break;
- case WM_GETMINMAXINFO:
- {
- static POINT sizeMin = { 0, 0 };
- MINMAXINFO* pMMI = reinterpret_cast<MINMAXINFO*>(lParam);
+ case WM_WINDOWPOSCHANGED:
+ pDlg->rearrangeControls();
+ return TRUE;
- if (sizeMin.x == 0)
- {
- RECT rectWin;
+ case WM_GETMINMAXINFO:
+ {
+ static POINT sizeMin = { 0, 0 };
+ MINMAXINFO* pMMI = reinterpret_cast<MINMAXINFO*>(lParam);
- GetWindowRect(hDlg, &rectWin);
- sizeMin.x = rectWin.right - rectWin.left;
- sizeMin.y = rectWin.bottom - rectWin.top;
- }
+ if (sizeMin.x == 0) {
+ RECT rectWin;
- pMMI->ptMinTrackSize = sizeMin;
- }
- return TRUE;
+ GetWindowRect(hDlg, &rectWin);
+ sizeMin.x = rectWin.right - rectWin.left;
+ sizeMin.y = rectWin.bottom - rectWin.top;
+ }
+
+ pMMI->ptMinTrackSize = sizeMin;
+ }
+ return TRUE;
}
return FALSE;
@@ -85,8 +78,7 @@ INT_PTR CALLBACK DlgConfigure::staticConfigureProc(HWND hDlg, UINT msg, WPARAM w
int DlgConfigure::staticEventPreShutdown(WPARAM wParam, LPARAM lParam)
{
- if (IsWindow(m_hCfgWnd))
- {
+ if (IsWindow(m_hCfgWnd)) {
DestroyWindow(m_hCfgWnd);
}
@@ -95,12 +87,10 @@ int DlgConfigure::staticEventPreShutdown(WPARAM wParam, LPARAM lParam)
void DlgConfigure::showModal()
{
- if (g_bConfigureLock)
- {
- MessageBox(
- 0,
- i18n(muT("You can't access the stand-alone configuration dialog of HistoryStats as long as the options dialog of Miranda IM is open. Please close the options dialog and try again.\r\n\r\nNote that the options offered by both dialogs are the same.")),
- i18n(muT("HistoryStats - Warning")),
+ if (g_bConfigureLock) {
+ MessageBox(0,
+ TranslateT("You can't access the stand-alone configuration dialog of HistoryStats as long as the options dialog of Miranda IM is open. Please close the options dialog and try again.\r\n\r\nNote that the options offered by both dialogs are the same."),
+ TranslateT("HistoryStats - Warning"),
MB_ICONWARNING | MB_OK);
return;
@@ -128,12 +118,10 @@ void DlgConfigure::onWMInitDialog()
void DlgConfigure::onCancel()
{
PSHNOTIFY pshn;
-
pshn.hdr.idFrom = 0;
pshn.hdr.code = PSN_RESET;
pshn.hdr.hwndFrom = m_hOptWnd;
pshn.lParam = 0;
-
SendMessage(m_hOptWnd, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&pshn));
rearrangeControls();
@@ -146,19 +134,15 @@ void DlgConfigure::onApply()
EnableWindow(GetDlgItem(m_hWnd, IDC_APPLY), FALSE);
PSHNOTIFY pshn;
-
pshn.hdr.idFrom = 0;
pshn.hdr.code = PSN_KILLACTIVE;
pshn.hdr.hwndFrom = m_hOptWnd;
pshn.lParam = 0;
-
SendMessage(m_hOptWnd, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&pshn));
- if (m_bChanged)
- {
+ if (m_bChanged) {
m_bChanged = false;
pshn.hdr.code = PSN_APPLY;
-
SendMessage(m_hOptWnd, WM_NOTIFY, 0, reinterpret_cast<LPARAM>(&pshn));
}
}
@@ -169,10 +153,8 @@ void DlgConfigure::rearrangeControls()
GetClientRect(m_hWnd, &rClient);
- if (m_nPadY == -1)
- {
+ if (m_nPadY == -1) {
RECT rButton = utils::getWindowRect(m_hWnd, IDOK);
-
m_nPadY = rClient.bottom - rButton.bottom;
m_nOKPadX = rClient.right - rButton.right;
m_nCancelPadX = rClient.right - utils::getWindowRect(m_hWnd, IDCANCEL).right;
@@ -180,7 +162,7 @@ void DlgConfigure::rearrangeControls()
}
RECT rButton;
-
+
rButton = utils::getWindowRect(m_hWnd, IDOK);
OffsetRect(&rButton, rClient.right - rButton.right - m_nOKPadX, rClient.bottom - rButton.bottom - m_nPadY);
utils::moveWindow(m_hWnd, IDOK, rButton);
@@ -205,16 +187,14 @@ void DlgConfigure::rearrangeControls()
InvalidateRect(m_hWnd, NULL, TRUE);
}
-DlgConfigure::DlgConfigure(HWND hWnd)
- : m_hWnd(hWnd), m_bChanged(false), m_hOptWnd(NULL),
+DlgConfigure::DlgConfigure(HWND hWnd) :
+ m_hWnd(hWnd), m_bChanged(false), m_hOptWnd(NULL),
m_nPadY(-1), m_nOKPadX(0), m_nCancelPadX(0), m_nApplyPadX(0)
{
- if (!m_hCfgWnd)
- {
+ if (!m_hCfgWnd) {
m_hCfgWnd = hWnd;
- if (!m_bHookedEvent)
- {
+ if (!m_bHookedEvent) {
HookEvent(ME_SYSTEM_PRESHUTDOWN, staticEventPreShutdown);
m_bHookedEvent = true;
}
@@ -226,7 +206,5 @@ DlgConfigure::~DlgConfigure()
DestroyWindow(m_hOptWnd);
if (m_hWnd == m_hCfgWnd)
- {
m_hCfgWnd = NULL;
- }
-} \ No newline at end of file
+}
diff --git a/plugins/HistoryStats/src/dlgfilterwords.cpp b/plugins/HistoryStats/src/dlgfilterwords.cpp
index 5609880d9d..f2d159d8e4 100644
--- a/plugins/HistoryStats/src/dlgfilterwords.cpp
+++ b/plugins/HistoryStats/src/dlgfilterwords.cpp
@@ -10,70 +10,55 @@ INT_PTR CALLBACK DlgFilterWords::staticDlgProc(HWND hDlg, UINT msg, WPARAM wPara
{
DlgFilterWords* pDlg = reinterpret_cast<DlgFilterWords*>(GetWindowLong(hDlg, DWLP_USER));
- switch (msg)
- {
- case WM_INITDIALOG:
- pDlg = reinterpret_cast<DlgFilterWords*>(lParam);
- SetWindowLong(hDlg, DWLP_USER, reinterpret_cast<LONG>(pDlg));
- pDlg->m_hWnd = hDlg;
- pDlg->onWMInitDialog();
+ switch (msg) {
+ case WM_INITDIALOG:
+ pDlg = reinterpret_cast<DlgFilterWords*>(lParam);
+ SetWindowLong(hDlg, DWLP_USER, reinterpret_cast<LONG>(pDlg));
+ pDlg->m_hWnd = hDlg;
+ pDlg->onWMInitDialog();
+ return TRUE;
+
+ case WM_DESTROY:
+ pDlg->onWMDestroy();
+ pDlg->m_hWnd = NULL;
+ SetWindowLong(hDlg, DWLP_USER, 0);
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ EndDialog(hDlg, 1);
return TRUE;
- case WM_DESTROY:
- pDlg->onWMDestroy();
- pDlg->m_hWnd = NULL;
- SetWindowLong(hDlg, DWLP_USER, 0);
+ case IDCANCEL:
+ EndDialog(hDlg, 0);
return TRUE;
+ }
+ break;
- case WM_COMMAND:
- switch (LOWORD(wParam))
+ case WM_NOTIFY:
+ switch (reinterpret_cast<NMHDR*>(lParam)->idFrom) {
+ case IDC_BAND:
{
- case IDOK:
- EndDialog(hDlg, 1);
- return TRUE;
+ BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
- case IDCANCEL:
- EndDialog(hDlg, 0);
- return TRUE;
+ if (pNM->hdr.code == BandCtrl::BCN_CLICKED)
+ pDlg->onBandClicked(pNM->hButton, pNM->dwData);
}
break;
- case WM_NOTIFY:
- {
- switch (reinterpret_cast<NMHDR*>(lParam)->idFrom)
- {
- case IDC_BAND:
- {
- BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
-
- if (pNM->hdr.code == BandCtrl::BCN_CLICKED)
- {
- pDlg->onBandClicked(pNM->hButton, pNM->dwData);
- }
- }
- break;
-
- case IDC_SETS:
- {
- OptionsCtrl::NMOPTIONSCTRL * pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
-
- if (pNM->hdr.code == OptionsCtrl::OCN_MODIFIED)
- {
- pDlg->onSetItemModified(pNM->hItem, pNM->dwData);
- }
- else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGED)
- {
- pDlg->onSetSelChanged(pNM->hItem, pNM->dwData);
- }
- else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGING)
- {
- pDlg->onSetSelChanging(pNM->hItem, pNM->dwData);
- }
- }
- break;
- }
- }
+ case IDC_SETS:
+ OptionsCtrl::NMOPTIONSCTRL * pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
+
+ if (pNM->hdr.code == OptionsCtrl::OCN_MODIFIED)
+ pDlg->onSetItemModified(pNM->hItem, pNM->dwData);
+ else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGED)
+ pDlg->onSetSelChanged(pNM->hItem, pNM->dwData);
+ else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGING)
+ pDlg->onSetSelChanging(pNM->hItem, pNM->dwData);
break;
+ }
+ break;
}
return FALSE;
@@ -90,13 +75,14 @@ void DlgFilterWords::onWMInitDialog()
// init band control
m_Band << GetDlgItem(m_hWnd, IDC_BAND);
- static const struct {
+ static const struct
+ {
WORD iconId;
- mu_text* szTooltip;
+ TCHAR* szTooltip;
bool bDisabled;
} columnBand[] = {
- { IDI_COL_ADD , I18N(muT("Add set")) , false },
- { IDI_COL_DEL , I18N(muT("Delete set")), true },
+ { IDI_COL_ADD, LPGENT("Add set"), false },
+ { IDI_COL_DEL, LPGENT("Delete set"), true },
};
array_each_(i, columnBand)
@@ -104,7 +90,7 @@ void DlgFilterWords::onWMInitDialog()
HICON hIcon = reinterpret_cast<HICON>(LoadImage(g_hInst, MAKEINTRESOURCE(columnBand[i].iconId), IMAGE_ICON, OS::smIconCX(), OS::smIconCY(), 0));
DWORD dwFlags = (columnBand[i].bDisabled ? BandCtrl::BCF_DISABLED : 0);
- m_hActionButtons[i] = m_Band.addButton(dwFlags, hIcon, i, i18n(columnBand[i].szTooltip));
+ m_hActionButtons[i] = m_Band.addButton(dwFlags, hIcon, i, TranslateTS(columnBand[i].szTooltip));
DestroyIcon(hIcon);
}
@@ -119,26 +105,24 @@ void DlgFilterWords::onWMInitDialog()
HANDLE hCheck = m_Sets.insertCheck(NULL, pFilter->getName().c_str(), 0, reinterpret_cast<DWORD>(pFilter));
if (m_bColProvided && m_ColFilters.find(pFilter->getID()) != m_ColFilters.end())
- {
m_Sets.checkItem(hCheck, true);
- }
}
// init other controls
- static const mu_text* szWordFilterModes[] = {
- I18N(muT("Filter words matching")),
- I18N(muT("Filter words containing")),
- I18N(muT("Filter words starting with")),
- I18N(muT("Filter words ending with")),
- I18N(muT("Filter messages matching")),
- I18N(muT("Filter messages containing")),
- I18N(muT("Filter messages starting with")),
- I18N(muT("Filter messages ending with")),
+ static const TCHAR* szWordFilterModes[] = {
+ LPGENT("Filter words matching"),
+ LPGENT("Filter words containing"),
+ LPGENT("Filter words starting with"),
+ LPGENT("Filter words ending with"),
+ LPGENT("Filter messages matching"),
+ LPGENT("Filter messages containing"),
+ LPGENT("Filter messages starting with"),
+ LPGENT("Filter messages ending with"),
};
array_each_(i, szWordFilterModes)
{
- SendDlgItemMessage(m_hWnd, IDC_MODE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(i18n(szWordFilterModes[i])));
+ SendDlgItemMessage(m_hWnd, IDC_MODE, CB_ADDSTRING, 0, reinterpret_cast<LPARAM>(TranslateTS(szWordFilterModes[i])));
}
SendDlgItemMessage(m_hWnd, IDC_MODE, CB_SETCURSEL, 0, 0);
@@ -154,15 +138,14 @@ void DlgFilterWords::onWMDestroy()
void DlgFilterWords::onBandClicked(HANDLE hButton, DWORD dwData)
{
- switch (dwData)
- {
- case saAdd:
- onSetAdd();
- break;
-
- case saDel:
- onSetDel();
- break;
+ switch (dwData) {
+ case saAdd:
+ onSetAdd();
+ break;
+
+ case saDel:
+ onSetDel();
+ break;
}
}
@@ -181,26 +164,19 @@ void DlgFilterWords::onSetDel()
{
HANDLE hSel = m_Sets.getSelection();
- if (hSel)
- {
+ if (hSel) {
Filter* pFilter = reinterpret_cast<Filter*>(m_Sets.getItemData(hSel));
- if (pFilter->getRef() > 0)
- {
- if (IDYES != MessageBox(
- m_hWnd,
- i18n(muT("The selected set is in use by at least one other column. If you remove it it won't be available to all other columns that use it. Are you sure you want to remove the set?")),
- i18n(muT("HistoryStats - Warning")),
- MB_ICONWARNING | MB_YESNO))
- {
+ if (pFilter->getRef() > 0) {
+ if (IDYES != MessageBox(m_hWnd,
+ TranslateT("The selected set is in use by at least one other column. If you remove it it won't be available to all other columns that use it. Are you sure you want to remove the set?"),
+ TranslateT("HistoryStats - Warning"), MB_ICONWARNING | MB_YESNO)) {
return;
}
}
FilterVec::iterator i = std::find(m_Filters.begin(), m_Filters.end(), pFilter);
-
- if (i != m_Filters.end())
- {
+ if (i != m_Filters.end()) {
m_Sets.deleteItem(hSel);
m_Filters.erase(i);
@@ -211,41 +187,31 @@ void DlgFilterWords::onSetDel()
void DlgFilterWords::onSetItemModified(HANDLE hItem, DWORD dwData)
{
- if (m_bColProvided)
- {
+ if (m_bColProvided) {
Filter* pFilter = reinterpret_cast<Filter*>(dwData);
if (m_Sets.isItemChecked(hItem))
- {
m_ColFilters.insert(pFilter->getID());
- }
else
- {
m_ColFilters.erase(pFilter->getID());
- }
}
- else
- {
+ else {
if (m_Sets.isItemChecked(hItem))
- {
m_Sets.checkItem(hItem, false);
- }
}
}
void DlgFilterWords::onSetSelChanging(HANDLE hItem, DWORD dwData)
{
- if (hItem)
- {
+ if (hItem) {
Filter* pFilter = reinterpret_cast<Filter*>(dwData);
// set name
HWND hText = GetDlgItem(m_hWnd, IDC_SETNAME);
int nLen = GetWindowTextLength(hText);
- mu_text* szText = new mu_text[nLen + 1];
+ TCHAR* szText = new TCHAR[nLen + 1];
- if (GetWindowText(hText, szText, nLen + 1))
- {
+ if (GetWindowText(hText, szText, nLen + 1)) {
pFilter->setName(szText);
m_Sets.setItemLabel(hItem, szText);
}
@@ -255,33 +221,27 @@ void DlgFilterWords::onSetSelChanging(HANDLE hItem, DWORD dwData)
// words
hText = GetDlgItem(m_hWnd, IDC_WORDS);
nLen = GetWindowTextLength(hText);
- szText = new mu_text[nLen + 1];
+ szText = new TCHAR[nLen + 1];
- if (GetWindowText(hText, szText, nLen + 1))
- {
+ if (GetWindowText(hText, szText, nLen + 1)) {
ext::string strText = szText;
- utils::replaceAllInPlace(strText, muT("\r"), muT(""));
+ utils::replaceAllInPlace(strText, _T("\r"), _T(""));
pFilter->clearWords();
- ext::string::size_type nPos = strText.find(muC('\n'));
+ ext::string::size_type nPos = strText.find('\n');
- while (nPos != ext::string::npos)
- {
+ while (nPos != ext::string::npos) {
if (nPos > 0)
- {
pFilter->addWord(utils::toLowerCase(strText.substr(0, nPos)));
- }
strText.erase(0, nPos + 1);
- nPos = strText.find(muC('\n'));
+ nPos = strText.find('\n');
}
if (!strText.empty())
- {
pFilter->addWord(utils::toLowerCase(strText));
- }
}
delete[] szText;
@@ -299,8 +259,7 @@ void DlgFilterWords::onSetSelChanged(HANDLE hItem, DWORD dwData)
EnableWindow(GetDlgItem(m_hWnd, IDC_MODE), bEnable);
EnableWindow(GetDlgItem(m_hWnd, IDC_WORDS), bEnable);
- if (hItem)
- {
+ if (hItem) {
Filter* pFilter = reinterpret_cast<Filter*>(dwData);
SetDlgItemText(m_hWnd, IDC_SETNAME, pFilter->getName().c_str());
@@ -311,20 +270,17 @@ void DlgFilterWords::onSetSelChanged(HANDLE hItem, DWORD dwData)
citer_each_(WordSet, i, pFilter->getWords())
{
strWords += *i;
- strWords += muT("\r\n");
+ strWords += _T("\r\n");
}
if (!strWords.empty())
- {
strWords.erase(strWords.length() - 2, 2);
- }
SetDlgItemText(m_hWnd, IDC_WORDS, strWords.c_str());
}
- else
- {
- SetDlgItemText(m_hWnd, IDC_SETNAME, muT(""));
- SetDlgItemText(m_hWnd, IDC_WORDS, muT(""));
+ else {
+ SetDlgItemText(m_hWnd, IDC_SETNAME, _T(""));
+ SetDlgItemText(m_hWnd, IDC_WORDS, _T(""));
}
// (de)activate band controls
@@ -341,8 +297,8 @@ void DlgFilterWords::clearFilters()
m_Filters.clear();
}
-DlgFilterWords::DlgFilterWords()
- : m_hWnd(NULL), m_bColProvided(false)
+DlgFilterWords::DlgFilterWords() :
+ m_hWnd(NULL), m_bColProvided(false)
{
}
diff --git a/plugins/HistoryStats/src/dlgoption.cpp b/plugins/HistoryStats/src/dlgoption.cpp
index e48b3bdb7a..d66d2d24a9 100644
--- a/plugins/HistoryStats/src/dlgoption.cpp
+++ b/plugins/HistoryStats/src/dlgoption.cpp
@@ -13,57 +13,46 @@ INT_PTR CALLBACK DlgOption::staticDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LP
{
DlgOption* pDlg = reinterpret_cast<DlgOption*>(GetWindowLong(hDlg, DWLP_USER));
- switch (msg)
- {
- case WM_INITDIALOG:
- pDlg = new DlgOption(hDlg);
- SetWindowLong(hDlg, DWLP_USER, reinterpret_cast<LONG>(pDlg));
- pDlg->onWMInitDialog();
- return TRUE;
-
- case WM_DESTROY:
- delete pDlg;
- SetWindowLong(hDlg, DWLP_USER, 0);
+ switch (msg) {
+ case WM_INITDIALOG:
+ pDlg = new DlgOption(hDlg);
+ SetWindowLong(hDlg, DWLP_USER, reinterpret_cast<LONG>(pDlg));
+ pDlg->onWMInitDialog();
+ return TRUE;
+
+ case WM_DESTROY:
+ delete pDlg;
+ SetWindowLong(hDlg, DWLP_USER, 0);
+ break;
+
+ case WM_WINDOWPOSCHANGED:
+ pDlg->rearrangeControls();
+ return TRUE;
+
+ case WM_NOTIFY:
+ NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
+ switch (p->idFrom) {
+ case 0:
+ if (p->code == PSN_APPLY)
+ pDlg->saveSettings();
break;
- case WM_WINDOWPOSCHANGED:
- pDlg->rearrangeControls();
- return TRUE;
-
- case WM_NOTIFY:
- {
- NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
-
- switch (p->idFrom)
- {
- case 0:
- if (p->code == PSN_APPLY)
- {
- pDlg->saveSettings();
- }
- break;
-
- case IDC_BAND:
- {
- if (p->code == BandCtrl::BCN_CLICKED)
- {
- BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
-
- pDlg->onBandClicked(pNM->hButton, pNM->dwData);
- }
- else if (p->code == BandCtrl::BCN_DROPDOWN)
- {
- BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
-
- pDlg->onBandDropDown(pNM->hButton, pNM->dwData);
- }
- }
- break;
- }
+ case IDC_BAND:
+ if (p->code == BandCtrl::BCN_CLICKED) {
+ BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
+
+ pDlg->onBandClicked(pNM->hButton, pNM->dwData);
+ }
+ else if (p->code == BandCtrl::BCN_DROPDOWN) {
+ BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
+
+ pDlg->onBandDropDown(pNM->hButton, pNM->dwData);
}
break;
+ }
+ break;
}
-
+
return FALSE;
}
@@ -76,8 +65,7 @@ void DlgOption::onWMInitDialog()
// init band control
m_Band << GetDlgItem(m_hWnd, IDC_BAND);
- if (!g_bConfigureLock)
- {
+ if (!g_bConfigureLock) {
// lock configure dialog for us
g_bConfigureLock = true;
m_bAcquiredLock = true;
@@ -86,11 +74,11 @@ void DlgOption::onWMInitDialog()
m_Band.setLayout(7);
// init pages
- m_pPage[opGlobal] = new SubGlobal();
+ m_pPage[opGlobal] = new SubGlobal();
m_pPage[opExclude] = new SubExclude();
- m_pPage[opInput] = new SubInput();
+ m_pPage[opInput] = new SubInput();
m_pPage[opColumns] = new SubColumns();
- m_pPage[opOutput] = new SubOutput();
+ m_pPage[opOutput] = new SubOutput();
RECT rPage, rBand;
@@ -99,22 +87,24 @@ void DlgOption::onWMInitDialog()
rPage.top += rBand.bottom;
- static const struct {
+ static const struct
+ {
WORD iconId;
- mu_text* szText;
- mu_text* szTooltip;
+ TCHAR* szText;
+ TCHAR* szTooltip;
bool bRight;
WORD dlgId;
bool bVisible;
bool bDropDown;
- } pageBand[] = {
- { IDI_SETT_GLOBAL , I18N(muT("Global")) , I18N(muT("Global settings")) , false, IDD_SUB_GLOBAL , true , false },
- { IDI_SETT_EXCLUDE , I18N(muT("Exclude")), I18N(muT("Exclude contacts")) , false, IDD_SUB_EXCLUDE, true , false },
- { IDI_SETT_INPUT , I18N(muT("Input")) , I18N(muT("Input settings")) , false, IDD_SUB_INPUT , true , false },
- { IDI_SETT_COLUMNS , I18N(muT("Columns")), I18N(muT("Column settings")) , false, IDD_SUB_COLUMNS, true , false },
- { IDI_SETT_OUTPUT , I18N(muT("Output")) , I18N(muT("Output settings")) , false, IDD_SUB_OUTPUT , true , false },
- { IDI_CREATE , I18N(muT("Create")) , I18N(muT("Create statistics")) , true , 0 , true , true },
- { IDI_CREATE_WARNING, I18N(muT("Create")) , I18N(muT("Create statistics (there are warnings)")), true , 0 , false, true },
+ }
+ pageBand[] = {
+ { IDI_SETT_GLOBAL, LPGENT("Global"), LPGENT("Global settings"), false, IDD_SUB_GLOBAL, true, false },
+ { IDI_SETT_EXCLUDE, LPGENT("Exclude"), LPGENT("Exclude contacts"), false, IDD_SUB_EXCLUDE, true, false },
+ { IDI_SETT_INPUT, LPGENT("Input"), LPGENT("Input settings"), false, IDD_SUB_INPUT, true, false },
+ { IDI_SETT_COLUMNS, LPGENT("Columns"), LPGENT("Column settings"), false, IDD_SUB_COLUMNS, true, false },
+ { IDI_SETT_OUTPUT, LPGENT("Output"), LPGENT("Output settings"), false, IDD_SUB_OUTPUT, true, false },
+ { IDI_CREATE, LPGENT("Create"), LPGENT("Create statistics"), true, 0, true, true },
+ { IDI_CREATE_WARNING, LPGENT("Create"), LPGENT("Create statistics (there are warnings)"), true, 0, false, true },
};
array_each_(i, pageBand)
@@ -127,30 +117,24 @@ void DlgOption::onWMInitDialog()
dwFlags |= pageBand[i].bVisible ? 0 : BandCtrl::BCF_HIDDEN;
dwFlags |= pageBand[i].bDropDown ? BandCtrl::BCF_DROPDOWN : 0;
- HANDLE hButton = m_Band.addButton(dwFlags, hIcon, i, i18n(pageBand[i].szTooltip), i18n(pageBand[i].szText));
+ HANDLE hButton = m_Band.addButton(dwFlags, hIcon, i, TranslateTS(pageBand[i].szTooltip), TranslateTS(pageBand[i].szText));
DestroyIcon(hIcon);
- if (i >= opFirstPage && i <= opLastPage)
- {
+ if (i >= opFirstPage && i <= opLastPage) {
m_hPageButton[i] = hButton;
m_pPage[i]->createWindow(this, pageBand[i].dlgId, rPage);
}
else if (i == opCreate)
- {
m_hCreateButton = hButton;
- }
else if (i == opCreateWarn)
- {
m_hCreateWarnButton = hButton;
- }
}
// init first tab
int nNewPage = g_pSettings->getLastPage();
- if (nNewPage < opFirstPage || nNewPage > opLastPage)
- {
+ if (nNewPage < opFirstPage || nNewPage > opLastPage) {
nNewPage = opGlobal;
}
@@ -159,13 +143,12 @@ void DlgOption::onWMInitDialog()
// show/hide info about possible problems with PNG output
updateProblemInfo();
}
- else
- {
+ else {
// inform the user that he can't simultaneously access the options with two dialogs
ShowWindow(m_Band, SW_HIDE);
ShowWindow(GetDlgItem(m_hWnd, IDC_MESSAGE), SW_SHOW);
- SetDlgItemText(m_hWnd, IDC_MESSAGE, i18n(muT("You can't access the options of HistoryStats as long as the stand-alone configuration dialog of HistoryStats is open. Please close the stand-alone dialog before opening the options dialog of Miranda IM to see the options of HistoryStats here.\r\n\r\nNote that the options offered by both dialogs are the same.")));
+ SetDlgItemText(m_hWnd, IDC_MESSAGE, TranslateT("You can't access the options of HistoryStats as long as the stand-alone configuration dialog of HistoryStats is open. Please close the stand-alone dialog before opening the options dialog of Miranda IM to see the options of HistoryStats here.\r\n\r\nNote that the options offered by both dialogs are the same."));
}
// reset flag
@@ -174,22 +157,15 @@ void DlgOption::onWMInitDialog()
void DlgOption::onRunStats()
{
- if (m_bSettingsModified)
- {
- int svar = MessageBox(
- m_hWnd,
- i18n(muT("You have unsaved settings. Do you want to save before running HistoryStats?")),
- i18n(muT("HistoryStats")),
- MB_YESNOCANCEL);
+ if (m_bSettingsModified) {
+ int svar = MessageBox(m_hWnd,
+ TranslateT("You have unsaved settings. Do you want to save before running HistoryStats?"),
+ TranslateT("HistoryStats"), MB_YESNOCANCEL);
if (svar == IDYES)
- {
saveSettings();
- }
else
- {
return;
- }
}
Statistic::run(*g_pSettings, Statistic::fromOptions, g_hInst, m_hWnd);
@@ -197,12 +173,9 @@ void DlgOption::onRunStats()
void DlgOption::onBandClicked(HANDLE hButton, DWORD dwData)
{
- if (dwData >= opFirstPage && dwData <= opLastPage && dwData != m_nCurPage)
- {
- if (m_nCurPage != dwData)
- {
- if (m_nCurPage != -1)
- {
+ if (dwData >= opFirstPage && dwData <= opLastPage && dwData != m_nCurPage) {
+ if (m_nCurPage != dwData) {
+ if (m_nCurPage != -1) {
m_Band.checkButton(m_hPageButton[m_nCurPage], false);
m_pPage[m_nCurPage]->hide();
}
@@ -214,15 +187,12 @@ void DlgOption::onBandClicked(HANDLE hButton, DWORD dwData)
m_pPage[m_nCurPage]->show();
}
else if (dwData == opCreate || dwData == opCreateWarn)
- {
onRunStats();
- }
}
void DlgOption::onBandDropDown(HANDLE hButton, DWORD dwData)
{
- if (dwData == opCreate || dwData == opCreateWarn)
- {
+ if (dwData == opCreate || dwData == opCreateWarn) {
// determine position for popup menu
RECT rItem = m_Band.getButtonRect(hButton);
@@ -233,15 +203,14 @@ void DlgOption::onBandDropDown(HANDLE hButton, DWORD dwData)
// create and display popup menu
HMENU hPopup = CreatePopupMenu();
- if (dwData == opCreateWarn)
- {
- AppendMenu(hPopup, MF_STRING, 1, i18n(muT("Show warnings...")));
+ if (dwData == opCreateWarn) {
+ AppendMenu(hPopup, MF_STRING, 1, TranslateT("Show warnings..."));
AppendMenu(hPopup, MF_SEPARATOR, 0, NULL);
}
UINT iMenuFlags = g_pSettings->canShowStatistics() ? 0 : (MF_DISABLED | MF_GRAYED);
- AppendMenu(hPopup, iMenuFlags | MF_STRING, 2, i18n(muT("Show statistics")));
+ AppendMenu(hPopup, iMenuFlags | MF_STRING, 2, TranslateT("Show statistics"));
int nShowInfo = TrackPopupMenu(
hPopup,
@@ -254,15 +223,14 @@ void DlgOption::onBandDropDown(HANDLE hButton, DWORD dwData)
DestroyMenu(hPopup);
- switch (nShowInfo)
- {
- case 1:
- onProblemInfo();
- break;
+ switch (nShowInfo) {
+ case 1:
+ onProblemInfo();
+ break;
- case 2:
- g_pSettings->showStatistics();
- break;
+ case 2:
+ g_pSettings->showStatistics();
+ break;
}
}
}
@@ -272,28 +240,22 @@ void DlgOption::onProblemInfo()
HelpVec help;
bool bAreProblems = reinterpret_cast<SubColumns*>(m_pPage[opColumns])->configHasConflicts(&help);
- if (bAreProblems && help.size() > 0)
- {
- ext::string msg = i18n(muT("There are some potential conflicts in your settings. However, this is only a warning and can in general be ignored. The details:"));
+ if (bAreProblems && help.size() > 0) {
+ ext::string msg = TranslateT("There are some potential conflicts in your settings. However, this is only a warning and can in general be ignored. The details:");
citer_each_(HelpVec, i, help)
{
- msg += muT("\r\n\r\n");
+ msg += _T("\r\n\r\n");
msg += i->first;
- if (!i->second.empty())
- {
- msg += muT("\r\n - ");
+ if (!i->second.empty()) {
+ msg += _T("\r\n - ");
msg += i->second;
}
}
- MessageBox(
- m_hWnd,
- msg.c_str(),
- i18n(muT("HistoryStats - Warning")),
- MB_ICONWARNING | MB_OK);
+ MessageBox(m_hWnd, msg.c_str(), TranslateT("HistoryStats - Warning"), MB_ICONWARNING | MB_OK);
}
}
@@ -307,8 +269,7 @@ void DlgOption::rearrangeControls()
rOther.right = rClient.right;
utils::moveWindow(m_Band, rOther);
- if (m_bAcquiredLock)
- {
+ if (m_bAcquiredLock) {
rOther.top = rOther.bottom;
rOther.bottom = rClient.bottom;
@@ -321,8 +282,7 @@ void DlgOption::rearrangeControls()
void DlgOption::settingsChanged()
{
- if (!m_bSettingsModified)
- {
+ if (!m_bSettingsModified) {
m_bSettingsModified = true;
SendMessage(GetParent(m_hWnd), PSM_CHANGED, 0, 0);
}
@@ -330,8 +290,7 @@ void DlgOption::settingsChanged()
int DlgOption::saveSettings()
{
- if (m_bAcquiredLock)
- {
+ if (m_bAcquiredLock) {
// force all pages to write to local settings store
array_each_(i, m_pPage)
{
@@ -365,21 +324,19 @@ void DlgOption::updateProblemInfo()
bool bShowProblemInfo = reinterpret_cast<SubColumns*>(m_pPage[opColumns])->configHasConflicts(NULL);
m_Band.showButton(m_hCreateButton, !bShowProblemInfo);
- m_Band.showButton(m_hCreateWarnButton,bShowProblemInfo);
+ m_Band.showButton(m_hCreateWarnButton, bShowProblemInfo);
}
-DlgOption::DlgOption(HWND hWnd)
- : m_hWnd(hWnd), m_bSettingsModified(false), m_nCurPage(-1), m_LocalS(*g_pSettings),
+DlgOption::DlgOption(HWND hWnd) :
+ m_hWnd(hWnd), m_bSettingsModified(false), m_nCurPage(-1), m_LocalS(*g_pSettings),
m_hCreateButton(NULL), m_hCreateWarnButton(NULL), m_bAcquiredLock(false)
-{
-}
+{}
DlgOption::~DlgOption()
{
// this destructor is called upon WM_DESTROY
- if (m_bAcquiredLock)
- {
+ if (m_bAcquiredLock) {
// release configure dialog lock
m_bAcquiredLock = false;
g_bConfigureLock = false;
diff --git a/plugins/HistoryStats/src/dlgoption.h b/plugins/HistoryStats/src/dlgoption.h
index cb51f5d98c..d5d60b43d4 100644
--- a/plugins/HistoryStats/src/dlgoption.h
+++ b/plugins/HistoryStats/src/dlgoption.h
@@ -75,11 +75,11 @@ private:
{
private:
struct SupportInfo {
- mu_text* szPlugin;
- mu_text* szTeaser;
- mu_text* szDescription;
- mu_text* szLinkTexts;
- mu_text* szLinkURLs;
+ TCHAR* szPlugin;
+ TCHAR* szTeaser;
+ TCHAR* szDescription;
+ TCHAR* szLinkTexts;
+ TCHAR* szLinkURLs;
};
private:
diff --git a/plugins/HistoryStats/src/dlgoption_subbase.cpp b/plugins/HistoryStats/src/dlgoption_subbase.cpp
index 921195d4c9..2b9a3935e8 100644
--- a/plugins/HistoryStats/src/dlgoption_subbase.cpp
+++ b/plugins/HistoryStats/src/dlgoption_subbase.cpp
@@ -11,28 +11,27 @@ INT_PTR CALLBACK DlgOption::SubBase::staticDlgProc(HWND hDlg, UINT msg, WPARAM w
{
SubBase* pDlg = reinterpret_cast<SubBase*>(GetWindowLong(hDlg, DWLP_USER));
- switch (msg)
- {
- case WM_INITDIALOG:
- pDlg = reinterpret_cast<SubBase*>(lParam);
- SetWindowLong(hDlg, DWLP_USER, reinterpret_cast<LONG>(pDlg));
- pDlg->m_hWnd = hDlg;
- pDlg->onWMInitDialog();
- pDlg->loadSettings();
- return TRUE;
+ switch (msg) {
+ case WM_INITDIALOG:
+ pDlg = reinterpret_cast<SubBase*>(lParam);
+ SetWindowLong(hDlg, DWLP_USER, reinterpret_cast<LONG>(pDlg));
+ pDlg->m_hWnd = hDlg;
+ pDlg->onWMInitDialog();
+ pDlg->loadSettings();
+ return TRUE;
- case WM_DESTROY:
- pDlg->onWMDestroy();
- delete pDlg;
- SetWindowLong(hDlg, DWLP_USER, 0);
- return TRUE;
+ case WM_DESTROY:
+ pDlg->onWMDestroy();
+ delete pDlg;
+ SetWindowLong(hDlg, DWLP_USER, 0);
+ return TRUE;
}
return pDlg ? pDlg->handleMsg(msg, wParam, lParam) : FALSE;
}
-DlgOption::SubBase::SubBase()
- : m_pParent(NULL), m_hWnd(NULL)
+DlgOption::SubBase::SubBase() :
+ m_pParent(NULL), m_hWnd(NULL)
{
}
@@ -61,8 +60,7 @@ void DlgOption::SubBase::createWindow(DlgOption* pParent, WORD nDlgResource, con
void DlgOption::SubBase::destroyWindow()
{
- if (m_hWnd)
- {
+ if (m_hWnd) {
DestroyWindow(m_hWnd);
// exit NOW since we destroyed ourselves
diff --git a/plugins/HistoryStats/src/dlgoption_subcolumns.cpp b/plugins/HistoryStats/src/dlgoption_subcolumns.cpp
index 52155bd0f0..a1f84e054c 100644
--- a/plugins/HistoryStats/src/dlgoption_subcolumns.cpp
+++ b/plugins/HistoryStats/src/dlgoption_subcolumns.cpp
@@ -11,93 +11,68 @@
INT_PTR CALLBACK DlgOption::SubColumns::staticAddProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hDlg);
+ HWND hWndList = GetDlgItem(hDlg, IDC_COLUMN);
- SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hDlg);
- utils::centerDialog(hDlg);
+ SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
- HWND hWndList = GetDlgItem(hDlg, IDC_COLUMN);
+ utils::centerDialog(hDlg);
- upto_each_(i, Column::countColInfo())
- {
- int nIndex = SendMessage(hWndList, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(Column::getColInfo(i).m_Title));
- SendMessage(hWndList, LB_SETITEMDATA, nIndex, static_cast<LPARAM>(i));
- }
+ upto_each_(i, Column::countColInfo())
+ {
+ int nIndex = SendMessage(hWndList, LB_ADDSTRING, 0, reinterpret_cast<LPARAM>(Column::getColInfo(i).m_Title));
+ SendMessage(hWndList, LB_SETITEMDATA, nIndex, static_cast<LPARAM>(i));
+ }
- if (Column::countColInfo() > 0)
- {
- SendMessage(hWndList, LB_SETCURSEL, 0, 0);
+ if (Column::countColInfo() > 0) {
+ SendMessage(hWndList, LB_SETCURSEL, 0, 0);
- SetDlgItemText(hDlg, IDC_DESCRIPTION, Column::getColInfo(0).m_Description);
- }
- }
- return TRUE;
+ SetDlgItemText(hDlg, IDC_DESCRIPTION, Column::getColInfo(0).m_Description);
+ }
+ return TRUE;
- case WM_COMMAND:
- switch (LOWORD(wParam))
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDOK:
{
- case IDOK:
- {
- HWND hWndList = GetDlgItem(hDlg, IDC_COLUMN);
-
- int nIndex = SendMessage(hWndList, LB_GETCURSEL, 0, 0);
-
- if (nIndex != LB_ERR)
- {
- int nData = SendMessage(hWndList, LB_GETITEMDATA, nIndex, 0);
-
- EndDialog(hDlg, nIndex);
- }
- else
- {
- EndDialog(hDlg, -1);
- }
- }
- return TRUE;
-
- case IDCANCEL:
- EndDialog(hDlg, -1);
- return TRUE;
+ int nIndex = SendMessage(hWndList, LB_GETCURSEL, 0, 0);
+ if (nIndex != LB_ERR) {
+ int nData = SendMessage(hWndList, LB_GETITEMDATA, nIndex, 0);
- case IDC_COLUMN:
- {
- if (HIWORD(wParam) == LBN_SELCHANGE)
- {
- HWND hWndList = GetDlgItem(hDlg, IDC_COLUMN);
+ EndDialog(hDlg, nIndex);
+ }
+ else EndDialog(hDlg, -1);
+ }
+ return TRUE;
- int nIndex = SendMessage(hWndList, LB_GETCURSEL, 0, 0);
-
- if (nIndex != LB_ERR)
- {
- int nData = SendMessage(hWndList, LB_GETITEMDATA, nIndex, 0);
+ case IDCANCEL:
+ EndDialog(hDlg, -1);
+ return TRUE;
- SetDlgItemText(hDlg, IDC_DESCRIPTION, Column::getColInfo(nData).m_Description);
- }
- else
- {
- SetDlgItemText(hDlg, IDC_DESCRIPTION, muT(""));
- }
- }
- else if (HIWORD(wParam) == LBN_DBLCLK)
- {
- SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDOK, 0), NULL);
- }
- }
- break;
+ case IDC_COLUMN:
+ if (HIWORD(wParam) == LBN_SELCHANGE) {
+ int nIndex = SendMessage(hWndList, LB_GETCURSEL, 0, 0);
+ if (nIndex != LB_ERR) {
+ int nData = SendMessage(hWndList, LB_GETITEMDATA, nIndex, 0);
+ SetDlgItemText(hDlg, IDC_DESCRIPTION, Column::getColInfo(nData).m_Description);
+ }
+ else SetDlgItemText(hDlg, IDC_DESCRIPTION, _T(""));
}
+ else if (HIWORD(wParam) == LBN_DBLCLK)
+ SendMessage(hDlg, WM_COMMAND, MAKEWPARAM(IDOK, 0), NULL);
break;
+ }
+ break;
}
return FALSE;
}
-DlgOption::SubColumns::SubColumns()
- : m_hColTitle(NULL),
+DlgOption::SubColumns::SubColumns() :
+ m_hColTitle(NULL),
m_bShowInfo(true),
m_nInfoHeight(0)
{
@@ -110,98 +85,74 @@ DlgOption::SubColumns::~SubColumns()
BOOL DlgOption::SubColumns::handleMsg(UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_WINDOWPOSCHANGED:
- rearrangeControls();
- return TRUE;
+ switch (msg) {
+ case WM_WINDOWPOSCHANGED:
+ rearrangeControls();
+ return TRUE;
+
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDC_INFOLABEL && HIWORD(wParam) == STN_CLICKED) {
+ m_bShowInfo = !m_bShowInfo;
+ toggleInfo();
+ }
+ break;
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_INFOLABEL && HIWORD(wParam) == STN_CLICKED)
+ case WM_NOTIFY:
+ switch (reinterpret_cast<NMHDR*>(lParam)->idFrom) {
+ case IDC_BAND:
{
- m_bShowInfo = !m_bShowInfo;
- toggleInfo();
+ BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
+ if (pNM->hdr.code == BandCtrl::BCN_CLICKED)
+ onBandClicked(pNM->hButton, pNM->dwData);
+ else if (pNM->hdr.code == BandCtrl::BCN_DROPDOWN)
+ onBandDropDown(pNM->hButton, pNM->dwData);
}
break;
- case WM_NOTIFY:
+ case IDC_COLUMNS:
{
- switch (reinterpret_cast<NMHDR*>(lParam)->idFrom)
- {
- case IDC_BAND:
- {
- BandCtrl::NMBANDCTRL* pNM = reinterpret_cast<BandCtrl::NMBANDCTRL*>(lParam);
-
- if (pNM->hdr.code == BandCtrl::BCN_CLICKED)
- {
- onBandClicked(pNM->hButton, pNM->dwData);
- }
- else if (pNM->hdr.code == BandCtrl::BCN_DROPDOWN)
- {
- onBandDropDown(pNM->hButton, pNM->dwData);
- }
- }
- break;
+ OptionsCtrl::NMOPTIONSCTRL* pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
+ if (pNM->hdr.code == OptionsCtrl::OCN_MODIFIED) {
+ getParent()->settingsChanged();
+ getParent()->updateProblemInfo();
+ }
+ else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGED) {
+ onColSelChanged(pNM->hItem, pNM->dwData);
+ }
+ else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGING) {
+ onColSelChanging(pNM->hItem, pNM->dwData);
+ }
+ else if (pNM->hdr.code == OptionsCtrl::OCN_ITEMDROPPED) {
+ OptionsCtrl::NMOPTIONSCTRLDROP* pNM2 = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRLDROP*>(pNM);
- case IDC_COLUMNS:
- {
- OptionsCtrl::NMOPTIONSCTRL* pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
-
- if (pNM->hdr.code == OptionsCtrl::OCN_MODIFIED)
- {
- getParent()->settingsChanged();
- getParent()->updateProblemInfo();
- }
- else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGED)
- {
- onColSelChanged(pNM->hItem, pNM->dwData);
- }
- else if (pNM->hdr.code == OptionsCtrl::OCN_SELCHANGING)
- {
- onColSelChanging(pNM->hItem, pNM->dwData);
- }
- else if (pNM->hdr.code == OptionsCtrl::OCN_ITEMDROPPED)
- {
- OptionsCtrl::NMOPTIONSCTRLDROP* pNM2 = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRLDROP*>(pNM);
-
- onColItemDropped(pNM2->hItem, pNM2->hDropTarget, pNM2->bAbove);
- }
- }
- break;
+ onColItemDropped(pNM2->hItem, pNM2->hDropTarget, pNM2->bAbove);
+ }
+ }
+ break;
- case IDC_OPTIONS:
- {
- OptionsCtrl::NMOPTIONSCTRL * pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
-
- if (pNM->hdr.code == OptionsCtrl::OCN_MODIFIED)
- {
- getParent()->settingsChanged();
- }
- else if (pNM->hdr.code == OptionsCtrl::OCN_CLICKED)
- {
- onColumnButton(pNM->hItem, pNM->dwData);
- }
- }
- break;
+ case IDC_OPTIONS:
+ {
+ OptionsCtrl::NMOPTIONSCTRL * pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
- case IDC_INFO:
- {
- NMTREEVIEW* pNM = reinterpret_cast<NMTREEVIEW*>(lParam);
-
- if (pNM->hdr.code == TVN_ITEMEXPANDING)
- {
- if (pNM->action == TVE_COLLAPSE || pNM->action == TVE_COLLAPSERESET ||
- (pNM->action == TVE_TOGGLE && pNM->itemNew.state & TVIS_EXPANDED))
- {
- SetWindowLong(getHWnd(), DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- }
- }
- break;
+ if (pNM->hdr.code == OptionsCtrl::OCN_MODIFIED)
+ getParent()->settingsChanged();
+ else if (pNM->hdr.code == OptionsCtrl::OCN_CLICKED)
+ onColumnButton(pNM->hItem, pNM->dwData);
+ }
+ break;
+
+ case IDC_INFO:
+ NMTREEVIEW* pNM = reinterpret_cast<NMTREEVIEW*>(lParam);
+ if (pNM->hdr.code == TVN_ITEMEXPANDING) {
+ if (pNM->action == TVE_COLLAPSE || pNM->action == TVE_COLLAPSERESET ||
+ (pNM->action == TVE_TOGGLE && pNM->itemNew.state & TVIS_EXPANDED)) {
+ SetWindowLong(getHWnd(), DWLP_MSGRESULT, TRUE);
+ return TRUE;
}
}
break;
+ }
+ break;
}
return FALSE;
@@ -214,17 +165,19 @@ void DlgOption::SubColumns::onWMInitDialog()
// init column band
m_Band << GetDlgItem(getHWnd(), IDC_BAND);
- static const struct {
+ static const struct
+ {
WORD iconId;
- mu_text* szTooltip;
+ TCHAR* szTooltip;
bool bRight;
bool bDropDown;
bool bDisabled;
- } columnBand[] = {
- { IDI_COL_ADD , I18N(muT("Add column...")), false, true , false },
- { IDI_COL_DEL , I18N(muT("Delete column")), false, false, true },
- { IDI_COL_DOWN, I18N(muT("Move down")) , true , false, true },
- { IDI_COL_UP , I18N(muT("Move up")) , true , false, true },
+ }
+ columnBand[] = {
+ { IDI_COL_ADD, LPGENT("Add column..."), false, true, false },
+ { IDI_COL_DEL, LPGENT("Delete column"), false, false, true },
+ { IDI_COL_DOWN, LPGENT("Move down"), true, false, true },
+ { IDI_COL_UP, LPGENT("Move up"), true, false, true },
};
array_each_(i, columnBand)
@@ -235,7 +188,7 @@ void DlgOption::SubColumns::onWMInitDialog()
(columnBand[i].bDropDown ? BandCtrl::BCF_DROPDOWN : 0) |
(columnBand[i].bDisabled ? BandCtrl::BCF_DISABLED : 0);
- m_hActionButtons[i] = m_Band.addButton(dwFlags, hIcon, i, i18n(columnBand[i].szTooltip));
+ m_hActionButtons[i] = m_Band.addButton(dwFlags, hIcon, i, TranslateTS(columnBand[i].szTooltip));
DestroyIcon(hIcon);
}
@@ -267,10 +220,8 @@ void DlgOption::SubColumns::loadSettings()
HANDLE hSelItem = m_Columns.getSelection();
Column* pPrevCol = NULL;
- if (hSelItem)
- {
+ if (hSelItem) {
pPrevCol = reinterpret_cast<Column*>(m_Columns.getItemData(hSelItem));
-
hSelItem = NULL;
}
@@ -292,9 +243,7 @@ void DlgOption::SubColumns::loadSettings()
m_Columns.checkItem(hColCheck, pCol->isEnabled());
if (!hSelItem && pCol == pPrevCol)
- {
hSelItem = hColCheck;
- }
}
m_Columns.ensureVisible(NULL);
@@ -311,23 +260,17 @@ void DlgOption::SubColumns::saveSettings()
{
HANDLE hSelItem = m_Columns.getSelection();
- if (hSelItem)
- {
+ if (hSelItem) {
// deselect and select current item to save its options to localS
m_Columns.selectItem(NULL);
m_Columns.selectItem(hSelItem);
}
HANDLE hItem = m_Columns.getFirstItem();
-
- while (hItem)
- {
+ while (hItem) {
Column* pCol = reinterpret_cast<Column*>(m_Columns.getItemData(hItem));
-
if (pCol)
- {
pCol->setEnabled(m_Columns.isItemChecked(hItem));
- }
hItem = m_Columns.getNextItem(hItem);
}
@@ -338,14 +281,13 @@ void DlgOption::SubColumns::rearrangeControls()
RECT rClient, rWnd;
int offsetY;
- if (m_nInfoHeight == 0)
- {
+ if (m_nInfoHeight == 0) {
m_nInfoHeight = utils::getWindowRect(getHWnd(), IDC_INFO).bottom;
m_nInfoHeight -= utils::getWindowRect(getHWnd(), IDC_INFOLABEL).bottom;
}
GetClientRect(getHWnd(), &rClient);
-
+
// columns tree
rWnd = utils::getWindowRect(getHWnd(), m_Columns);
rWnd.bottom = rClient.bottom;
@@ -374,9 +316,9 @@ void DlgOption::SubColumns::rearrangeControls()
void DlgOption::SubColumns::toggleInfo()
{
HWND hInfo = GetDlgItem(getHWnd(), IDC_INFO);
- const mu_text* szInfoLabelText = m_bShowInfo ? I18N(muT("Hide additional column info...")) : I18N(muT("Show additional column info..."));
+ const TCHAR* szInfoLabelText = m_bShowInfo ? LPGENT("Hide additional column info...") : LPGENT("Show additional column info...");
- SetDlgItemText(getHWnd(), IDC_INFOLABEL, i18n(szInfoLabelText));
+ SetDlgItemText(getHWnd(), IDC_INFOLABEL, TranslateTS(szInfoLabelText));
ShowWindow(hInfo, m_bShowInfo ? SW_SHOW : SW_HIDE);
EnableWindow(hInfo, BOOL_(m_bShowInfo));
@@ -385,8 +327,7 @@ void DlgOption::SubColumns::toggleInfo()
void DlgOption::SubColumns::addCol(int nCol)
{
- if (nCol != -1)
- {
+ if (nCol != -1) {
Column* pCol = Column::fromUID(Column::getColInfo(nCol).m_UID);
getParent()->getLocalSettings().addCol(pCol);
@@ -401,13 +342,11 @@ void DlgOption::SubColumns::addCol(int nCol)
void DlgOption::SubColumns::onColSelChanging(HANDLE hItem, DWORD dwData)
{
- if (hItem)
- {
+ if (hItem) {
Column* pCol = reinterpret_cast<Column*>(m_Columns.getItemData(hItem));
// general column settings
- if (m_hColTitle)
- {
+ if (m_hColTitle) {
pCol->setCustomTitle(m_Options.getEditString(m_hColTitle));
// adjust title in column tree
@@ -440,19 +379,17 @@ void DlgOption::SubColumns::onColSelChanged(HANDLE hItem, DWORD dwData)
m_Options.setRedraw(false);
m_Options.deleteAllItems();
- if (hItem)
- {
+ if (hItem) {
Column* pCol = reinterpret_cast<Column*>(m_Columns.getItemData(hItem));
// general column settings
- OptionsCtrl::Group hGeneral = m_Options.insertGroup(NULL, i18n(muT("General column settings")), OptionsCtrl::OCF_ROOTGROUP);
+ OptionsCtrl::Group hGeneral = m_Options.insertGroup(NULL, TranslateT("General column settings"), OptionsCtrl::OCF_ROOTGROUP);
- m_hColTitle = m_Options.insertEdit(hGeneral, i18n(muT("Title (default if empty)")), pCol->getCustomTitle().c_str());
+ m_hColTitle = m_Options.insertEdit(hGeneral, TranslateT("Title (default if empty)"), pCol->getCustomTitle().c_str());
// column specific settings
- if (pCol->getFeatures() & Column::cfHasConfig)
- {
- OptionsCtrl::Group hSpecific = m_Options.insertGroup(NULL, i18n(muT("Column specific settings")), OptionsCtrl::OCF_ROOTGROUP);
+ if (pCol->getFeatures() & Column::cfHasConfig) {
+ OptionsCtrl::Group hSpecific = m_Options.insertGroup(NULL, TranslateT("Column specific settings"), OptionsCtrl::OCF_ROOTGROUP);
pCol->configToUI(m_Options, hSpecific);
}
@@ -475,33 +412,29 @@ void DlgOption::SubColumns::onColSelChanged(HANDLE hItem, DWORD dwData)
tvi.item.state = TVIS_EXPANDED;
tvi.item.stateMask = TVIS_EXPANDED;
- tvi.item.pszText = const_cast<mu_text*>(i18n(muT("For this config the selected column...")));
+ tvi.item.pszText = const_cast<TCHAR*>(TranslateT("For this config the selected column..."));
tvi.hParent = TreeView_InsertItem(hInfo, &tvi);
// show capabilities of column
- ext::string msg = i18n(muT("...can be output as: "));
+ ext::string msg = TranslateT("...can be output as: ");
- if (restrictions & Column::crHTMLMask)
- {
+ if (restrictions & Column::crHTMLMask) {
// MEMO: don't distinguish between full/partial since not yet supported
- msg += i18n(muT("HTML"));
+ msg += TranslateT("HTML");
}
- if (restrictions & Column::crPNGMask)
- {
+ if (restrictions & Column::crPNGMask) {
if (restrictions & Column::crHTMLMask)
- {
- msg += muT(", ");
- }
+ msg += _T(", ");
- msg += ((restrictions & Column::crPNGMask) == Column::crPNGPartial) ? i18n(muT("PNG (partial)")) : i18n(muT("PNG"));
+ msg += ((restrictions & Column::crPNGMask) == Column::crPNGPartial) ? TranslateT("PNG (partial)") : TranslateT("PNG");
}
- tvi.item.pszText = const_cast<mu_text*>(msg.c_str());
+ tvi.item.pszText = const_cast<TCHAR*>(msg.c_str());
TreeView_InsertItem(hInfo, &tvi);
// show effect of current config
- msg = i18n(muT("...will be output as: "));
+ msg = TranslateT("...will be output as: ");
/*
* the logic (output mode -> restrictions -> effect):
@@ -521,27 +454,22 @@ void DlgOption::SubColumns::onColSelChanged(HANDLE hItem, DWORD dwData)
* -> PNG-full -> PNG
*/
- if (!bPNGOutput)
- {
- msg += ((restrictions & Column::crHTMLMask) == Column::crHTMLFull) ? i18n(muT("HTML")) : i18n(muT("Nothing (column will be skipped)"));
+ if (!bPNGOutput) {
+ msg += ((restrictions & Column::crHTMLMask) == Column::crHTMLFull) ? TranslateT("HTML") : TranslateT("Nothing (column will be skipped)");
}
else if (nPNGMode != Settings::pmPreferHTML) // && bPNGOutput
{
if (restrictions == (Column::crHTMLFull | Column::crPNGPartial))
- {
- msg += (nPNGMode == Settings::pmHTMLFallBack) ? i18n(muT("HTML as fallback")) : i18n(muT("PNG, ignoring some sttings"));
- }
+ msg += (nPNGMode == Settings::pmHTMLFallBack) ? TranslateT("HTML as fallback") : TranslateT("PNG, ignoring some sttings");
else // !(html-full | png-partial)
- {
- msg += ((restrictions & Column::crPNGMask) == Column::crPNGFull) ? i18n(muT("PNG")) : i18n(muT("HTML"));
- }
+ msg += ((restrictions & Column::crPNGMask) == Column::crPNGFull) ? TranslateT("PNG") : TranslateT("HTML");
}
else // bPNGOutput && nPNGMode == Settings::pmPreferHTML
{
- msg += ((restrictions & Column::crHTMLMask) == Column::crHTMLFull) ? i18n(muT("HTML")) : i18n(muT("PNG"));
+ msg += ((restrictions & Column::crHTMLMask) == Column::crHTMLFull) ? TranslateT("HTML") : TranslateT("PNG");
}
- tvi.item.pszText = const_cast<mu_text*>(msg.c_str());
+ tvi.item.pszText = const_cast<TCHAR*>(msg.c_str());
TreeView_InsertItem(hInfo, &tvi);
SendMessage(hInfo, WM_SETREDRAW, TRUE, 0);
@@ -559,21 +487,15 @@ void DlgOption::SubColumns::onColItemDropped(HANDLE hItem, HANDLE hDropTarget, B
{
// check if dropped before or after hItem and abort
if (hItem == hDropTarget)
- {
return;
- }
// convert dropped below to dropped above
if (!bAbove)
- {
hDropTarget = m_Columns.getPrevItem(hDropTarget);
- }
// check if dropped before or after hItem and abort (part 2)
if (hItem == hDropTarget || (hDropTarget && m_Columns.getNextItem(hDropTarget) == hItem))
- {
return;
- }
// perform move
Column* pItem = reinterpret_cast<Column*>(m_Columns.getItemData(hItem));
@@ -591,30 +513,28 @@ void DlgOption::SubColumns::onColItemDropped(HANDLE hItem, HANDLE hDropTarget, B
void DlgOption::SubColumns::onBandClicked(HANDLE hButton, DWORD dwData)
{
- switch (dwData)
- {
- case caAdd:
- onAdd();
- break;
-
- case caDel:
- onDel();
- break;
-
- case caMoveUp:
- onMoveUp();
- break;
-
- case caMoveDown:
- onMoveDown();
- break;
+ switch (dwData) {
+ case caAdd:
+ onAdd();
+ break;
+
+ case caDel:
+ onDel();
+ break;
+
+ case caMoveUp:
+ onMoveUp();
+ break;
+
+ case caMoveDown:
+ onMoveDown();
+ break;
}
}
void DlgOption::SubColumns::onBandDropDown(HANDLE hButton, DWORD dwData)
{
- if (dwData == caAdd)
- {
+ if (dwData == caAdd) {
// determine position for popup menu
RECT rItem = m_Band.getButtonRect(hButton);
POINT ptMenu = { rItem.left, rItem.bottom };
@@ -655,12 +575,10 @@ void DlgOption::SubColumns::onDel()
{
HANDLE hSelItem = m_Columns.getSelection();
- if (hSelItem)
- {
+ if (hSelItem) {
Column* pCol = reinterpret_cast<Column*>(m_Columns.getItemData(hSelItem));
- if (pCol)
- {
+ if (pCol) {
getParent()->getLocalSettings().delCol(pCol);
m_Columns.deleteItem(hSelItem);
@@ -674,14 +592,10 @@ void DlgOption::SubColumns::onMoveUp()
HANDLE hSel, hPrev2;
if (!(hSel = m_Columns.getSelection()))
- {
return;
- }
if (!(hPrev2 = m_Columns.getPrevItem(hSel)))
- {
return;
- }
hPrev2 = m_Columns.getPrevItem(hPrev2);
@@ -703,14 +617,10 @@ void DlgOption::SubColumns::onMoveDown()
HANDLE hSel, hNext;
if (!(hSel = m_Columns.getSelection()))
- {
return;
- }
if (!(hNext = m_Columns.getNextItem(hSel)))
- {
return;
- }
Column* pSelCol = reinterpret_cast<Column*>(m_Columns.getItemData(hSel));
Column* pNextCol = reinterpret_cast<Column*>(m_Columns.getItemData(hNext));
@@ -727,15 +637,12 @@ void DlgOption::SubColumns::onMoveDown()
void DlgOption::SubColumns::onColumnButton(HANDLE hButton, DWORD dwData)
{
- if (dwData == Settings::biFilterWords)
- {
+ if (dwData == Settings::biFilterWords) {
HANDLE hSel = m_Columns.getSelection();
Column* pCol = reinterpret_cast<Column*>(m_Columns.getItemData(hSel));
- if (hSel && pCol)
- {
- if (getParent()->getLocalSettings().manageFilterWords(getHWnd(), pCol))
- {
+ if (hSel && pCol) {
+ if (getParent()->getLocalSettings().manageFilterWords(getHWnd(), pCol)) {
getParent()->settingsChanged();
}
}
@@ -751,41 +658,32 @@ bool DlgOption::SubColumns::configHasConflicts(HelpVec* pHelp)
int nConflicts = 0;
ext::string curDetails;
- while (hItem)
- {
- if (m_Columns.isItemChecked(hItem))
- {
+ while (hItem) {
+ if (m_Columns.isItemChecked(hItem)) {
Column* pCol = reinterpret_cast<Column*>(m_Columns.getItemData(hItem));
- if (pCol)
- {
+ if (pCol) {
int restrictions = pCol->configGetRestrictions(pHelp ? &curDetails : NULL);
// sanity check: either HTML or PNG has to be fully supported
if ((restrictions & Column::crHTMLMask) != Column::crHTMLFull &&
- (restrictions & Column::crPNGMask) != Column::crPNGFull)
- {
- MessageBox(
- 0,
- i18n(muT("HistoryStats - Error")),
- i18n(muT("An internal column configuration error occured. Please contact the author of this plugin.")),
- MB_ICONERROR | MB_OK);
+ (restrictions & Column::crPNGMask) != Column::crPNGFull) {
+ MessageBox(NULL,
+ TranslateT("An internal column configuration error occured. Please contact the author of this plugin."),
+ TranslateT("HistoryStats - Error"), MB_ICONERROR | MB_OK);
}
- do
- {
+ do {
// HTML-only output but column doesn't support it
- if (!bPNGOutput && !(restrictions & Column::crHTMLPartial))
- {
- if (pHelp)
- {
+ if (!bPNGOutput && !(restrictions & Column::crHTMLPartial)) {
+ if (pHelp) {
pHelp->push_back(HelpPair());
pHelp->back().first = pCol->getTitle();
- pHelp->back().first += muT(": ");
- pHelp->back().first += i18n(muT("HTML output unsupported."));
+ pHelp->back().first += _T(": ");
+ pHelp->back().first += TranslateT("HTML output unsupported.");
- pHelp->back().second = muT("");
+ pHelp->back().second = _T("");
}
++nConflicts;
@@ -795,25 +693,19 @@ bool DlgOption::SubColumns::configHasConflicts(HelpVec* pHelp)
// PNG output but only partial PNG support (enforce mode) -or-
// PNG output with alternative full HTML-only support (fallback mode)
if (bPNGOutput &&
- (restrictions & Column::crPNGMask) == Column::crPNGPartial &&
- (restrictions & Column::crHTMLMask) == Column::crHTMLFull &&
- nPNGMode != Settings::pmPreferHTML)
- {
- if (pHelp)
- {
+ (restrictions & Column::crPNGMask) == Column::crPNGPartial &&
+ (restrictions & Column::crHTMLMask) == Column::crHTMLFull &&
+ nPNGMode != Settings::pmPreferHTML) {
+ if (pHelp) {
pHelp->push_back(HelpPair());
pHelp->back().first = pCol->getTitle();
- pHelp->back().first += muT(": ");
+ pHelp->back().first += _T(": ");
if (nPNGMode == Settings::pmHTMLFallBack)
- {
- pHelp->back().first += i18n(muT("Fallback to HTML due to setting."));
- }
+ pHelp->back().first += TranslateT("Fallback to HTML due to setting.");
else
- {
- pHelp->back().first += i18n(muT("Setting ignored due to PNG output."));
- }
+ pHelp->back().first += TranslateT("Setting ignored due to PNG output.");
pHelp->back().second = curDetails;
}
@@ -821,7 +713,8 @@ bool DlgOption::SubColumns::configHasConflicts(HelpVec* pHelp)
++nConflicts;
break;
}
- } while (false);
+ }
+ while (false);
}
}
diff --git a/plugins/HistoryStats/src/dlgoption_subexclude.cpp b/plugins/HistoryStats/src/dlgoption_subexclude.cpp
index 8014a0d00f..e639610717 100644
--- a/plugins/HistoryStats/src/dlgoption_subexclude.cpp
+++ b/plugins/HistoryStats/src/dlgoption_subexclude.cpp
@@ -8,8 +8,8 @@
* DlgOption::SubExclude
*/
-DlgOption::SubExclude::SubExclude()
- : m_hItemAll(NULL), m_bChanged(false)
+DlgOption::SubExclude::SubExclude() :
+ m_hItemAll(NULL), m_bChanged(false)
{
}
@@ -21,107 +21,85 @@ DlgOption::SubExclude::~SubExclude()
BOOL DlgOption::SubExclude::handleMsg(UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_WINDOWPOSCHANGED:
- {
- RECT rClient, rWnd;
-
- GetClientRect(getHWnd(), &rClient);
-
- // clist
- rWnd = utils::getWindowRect(getHWnd(), IDC_CONTACTS);
- rWnd.right = rClient.right;
- rWnd.bottom = rClient.bottom;
- utils::moveWindow(getHWnd(), IDC_CONTACTS, rWnd);
- }
- break;
+ switch (msg) {
+ case WM_WINDOWPOSCHANGED:
+ {
+ RECT rClient, rWnd;
- case WM_NOTIFY:
- {
- NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
+ GetClientRect(getHWnd(), &rClient);
- if (p->idFrom != IDC_CONTACTS)
- {
+ // clist
+ rWnd = utils::getWindowRect(getHWnd(), IDC_CONTACTS);
+ rWnd.right = rClient.right;
+ rWnd.bottom = rClient.bottom;
+ utils::moveWindow(getHWnd(), IDC_CONTACTS, rWnd);
+ }
+ break;
+
+ case WM_NOTIFY:
+ {
+ NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
+ if (p->idFrom != IDC_CONTACTS)
+ break;
+
+ HWND hCList = GetDlgItem(getHWnd(), IDC_CONTACTS);
+
+ switch (p->code) {
+ case CLN_NEWCONTACT:
+ case CLN_LISTREBUILT:
+ updateAllContacts(hCList);
+ updateAllGroups(hCList, reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_ROOT, 0)), m_hItemAll);
+ break;
+
+ case CLN_CONTACTMOVED:
+ updateAllGroups(hCList, reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_ROOT, 0)), m_hItemAll);
+ break;
+
+ case CLN_OPTIONSCHANGED:
+ customizeList(hCList);
+ break;
+
+ case NM_CLICK:
+ NMCLISTCONTROL* pNM = reinterpret_cast<NMCLISTCONTROL*>(p);
+ if (pNM->iColumn == -1)
break;
- }
- HWND hCList = GetDlgItem(getHWnd(), IDC_CONTACTS);
-
- switch (p->code)
- {
- case CLN_NEWCONTACT:
- case CLN_LISTREBUILT:
- updateAllContacts(hCList);
- updateAllGroups(hCList, reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_ROOT, 0)), m_hItemAll);
- break;
-
- case CLN_CONTACTMOVED:
- updateAllGroups(hCList, reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_ROOT, 0)), m_hItemAll);
- break;
-
- case CLN_OPTIONSCHANGED:
- customizeList(hCList);
- break;
-
- case NM_CLICK:
- {
- NMCLISTCONTROL* pNM = reinterpret_cast<NMCLISTCONTROL*>(p);
-
- if (pNM->iColumn == -1)
- {
- break;
- }
-
- DWORD dwHitFlags = 0;
- HANDLE hItem = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_HITTEST, reinterpret_cast<WPARAM>(&dwHitFlags), MAKELPARAM(pNM->pt.x, pNM->pt.y)));
-
- if (!hItem || !(dwHitFlags & CLCHT_ONITEMEXTRA))
- {
- break;
- }
-
- int iImage = SendMessage(hCList, CLM_GETEXTRAIMAGE, reinterpret_cast<WPARAM>(hItem), MAKELPARAM(pNM->iColumn, 0));
-
- if (iImage != 0xFF)
- {
- iImage = (iImage == 0) ? 1 : 0;
-
- int itemType = SendMessage(hCList, CLM_GETITEMTYPE, reinterpret_cast<WPARAM>(hItem), 0);
-
- if (itemType == CLCIT_CONTACT)
- {
- setAll(hCList, hItem, iImage, false);
- }
- else if (itemType == CLCIT_INFO)
- {
- setAll(hCList, hItem, iImage, true);
- }
- else if (itemType == CLCIT_GROUP)
- {
- if (hItem = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_CHILD, reinterpret_cast<LPARAM>(hItem))))
- {
- setAll(hCList, hItem, iImage, true);
- }
- }
-
- // update groups
- updateAllGroups(hCList, reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_ROOT, 0)), m_hItemAll);
-
- // mark as dirty
- m_bChanged = true;
- getParent()->settingsChanged();
- }
- }
- break;
+ DWORD dwHitFlags = 0;
+ HANDLE hItem = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_HITTEST, reinterpret_cast<WPARAM>(&dwHitFlags), MAKELPARAM(pNM->pt.x, pNM->pt.y)));
+ if (!hItem || !(dwHitFlags & CLCHT_ONITEMEXTRA))
+ break;
+
+ int iImage = SendMessage(hCList, CLM_GETEXTRAIMAGE, reinterpret_cast<WPARAM>(hItem), MAKELPARAM(pNM->iColumn, 0));
+ if (iImage != 0xFF) {
+ iImage = (iImage == 0) ? 1 : 0;
+
+ int itemType = SendMessage(hCList, CLM_GETITEMTYPE, reinterpret_cast<WPARAM>(hItem), 0);
+
+ if (itemType == CLCIT_CONTACT)
+ setAll(hCList, hItem, iImage, false);
+ else if (itemType == CLCIT_INFO)
+ setAll(hCList, hItem, iImage, true);
+ else if (itemType == CLCIT_GROUP) {
+ if (hItem = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_CHILD, reinterpret_cast<LPARAM>(hItem))))
+ setAll(hCList, hItem, iImage, true);
+ }
+
+ // update groups
+ updateAllGroups(hCList, reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_ROOT, 0)), m_hItemAll);
+
+ // mark as dirty
+ m_bChanged = true;
+ getParent()->settingsChanged();
}
+ break;
}
- break;
+ }
+ break;
- case WM_DESTROY:
- IconLib::unregisterCallback(staticRecreateIcons, reinterpret_cast<LPARAM>(this));
- ImageList_Destroy(reinterpret_cast<HIMAGELIST>(SendDlgItemMessage(getHWnd(), IDC_CONTACTS, CLM_GETEXTRAIMAGELIST, 0, 0)));
- break;
+ case WM_DESTROY:
+ IconLib::unregisterCallback(staticRecreateIcons, reinterpret_cast<LPARAM>(this));
+ ImageList_Destroy(reinterpret_cast<HIMAGELIST>(SendDlgItemMessage(getHWnd(), IDC_CONTACTS, CLM_GETEXTRAIMAGELIST, 0, 0)));
+ break;
}
return FALSE;
@@ -143,10 +121,10 @@ void DlgOption::SubExclude::onWMInitDialog()
SendMessage(hCList, CLM_SETEXTRACOLUMNS, 1, 0);
CLCINFOITEM cii = { 0 };
-
+
cii.cbSize = sizeof(cii);
cii.flags = CLCIIF_GROUPFONT;
- cii.pszText = i18n(muT("** All contacts **"));
+ cii.pszText = TranslateT("** All contacts **");
m_hItemAll = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_ADDINFOITEM, 0, reinterpret_cast<LPARAM>(&cii)));
// lock exlucde contacts
@@ -168,7 +146,7 @@ void DlgOption::SubExclude::staticRecreateIcons(LPARAM lParam)
array_each_(i, ExtraIcons)
{
ImageList_AddIcon(hIml, IconLib::getIcon(ExtraIcons[i]));
- }
+ }
}
void DlgOption::SubExclude::loadSettings()
@@ -184,8 +162,7 @@ void DlgOption::SubExclude::loadSettings()
void DlgOption::SubExclude::saveSettings()
{
- if (m_bChanged)
- {
+ if (m_bChanged) {
// update db
HWND hCList = GetDlgItem(getHWnd(), IDC_CONTACTS);
MirandaSettings db;
@@ -202,13 +179,9 @@ void DlgOption::SubExclude::saveSettings()
bool bExcludeOld = db.settingExists(con::SettExclude);
if (bExcludeOld && iImage == 0)
- {
db.delSetting(con::SettExclude);
- }
else if (!bExcludeOld && iImage == 1)
- {
db.writeBool(con::SettExclude, true);
- }
}
hContact = db_find_next(hContact);
@@ -227,10 +200,8 @@ void DlgOption::SubExclude::customizeList(HWND hCList)
SendMessage(hCList, CLM_SETLEFTMARGIN, 2, 0);
SendMessage(hCList, CLM_SETINDENT, 10, 0);
- for(int i = 0; i <= FONTID_MAX; ++i)
- {
+ for (int i = 0; i <= FONTID_MAX; ++i)
SendMessage(hCList, CLM_SETTEXTCOLOR, i, GetSysColor(COLOR_WINDOWTEXT));
- }
SetWindowLong(hCList, GWL_STYLE, GetWindowLong(hCList, GWL_STYLE) | CLS_SHOWHIDDEN);
}
@@ -246,15 +217,11 @@ void DlgOption::SubExclude::updateAllGroups(HWND hCList, HANDLE hFirstItem, HAND
HANDLE hItem = (typeOfFirst == CLCIT_GROUP) ? hFirstItem : reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, reinterpret_cast<LPARAM>(hFirstItem)));
// MEMO: no short-circuit, otherwise subgroups won't be updated
- while (hItem /* && (bIconOn || !bHasChilds) */)
- {
+ while (hItem /* && (bIconOn || !bHasChilds) */) {
HANDLE hChildItem = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_CHILD, reinterpret_cast<LPARAM>(hItem)));
-
if (hChildItem)
- {
updateAllGroups(hCList, hChildItem, hItem);
- }
-
+
int iImage = SendMessage(hCList, CLM_GETEXTRAIMAGE, reinterpret_cast<WPARAM>(hItem), MAKELPARAM(0, 0));
bIconOn = bIconOn && (iImage != 0);
@@ -262,14 +229,13 @@ void DlgOption::SubExclude::updateAllGroups(HWND hCList, HANDLE hFirstItem, HAND
hItem = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, reinterpret_cast<LPARAM>(hItem)));
}
-
+
// contacts
hItem = (typeOfFirst == CLCIT_CONTACT) ? hFirstItem : reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, reinterpret_cast<LPARAM>(hFirstItem)));
- while (hItem && (bIconOn || !bHasChilds))
- {
+ while (hItem && (bIconOn || !bHasChilds)) {
int iImage = SendMessage(hCList, CLM_GETEXTRAIMAGE, reinterpret_cast<WPARAM>(hItem), MAKELPARAM(0, 0));
-
+
bIconOn = bIconOn && (iImage != 0);
bHasChilds = bHasChilds || (iImage != 0xFF);
@@ -291,7 +257,7 @@ void DlgOption::SubExclude::updateAllContacts(HWND hCList)
HANDLE hItem = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_FINDCONTACT, hContact, 0));
if (hItem) {
db.setContact(hContact);
-
+
if (SendMessage(hCList, CLM_GETEXTRAIMAGE, reinterpret_cast<WPARAM>(hItem), MAKELPARAM(0, 0)) == 0xFF)
SendMessage(hCList, CLM_SETEXTRAIMAGE, reinterpret_cast<WPARAM>(hItem), MAKELPARAM(0, db.settingExists(con::SettExclude) ? 1 : 0));
}
@@ -304,19 +270,14 @@ void DlgOption::SubExclude::setAll(HWND hCList, HANDLE hFirstItem, int iImage, b
{
int typeOfFirst = SendMessage(hCList, CLM_GETITEMTYPE, reinterpret_cast<WPARAM>(hFirstItem), 0);
- if (bIterate)
- {
+ if (bIterate) {
// check groups
HANDLE hItem = (typeOfFirst == CLCIT_GROUP) ? hFirstItem : reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, reinterpret_cast<LPARAM>(hFirstItem)));
- while (hItem)
- {
+ while (hItem) {
HANDLE hChildItem = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_CHILD, reinterpret_cast<LPARAM>(hItem)));
-
if (hChildItem)
- {
setAll(hCList, hChildItem, iImage, true);
- }
hItem = reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, reinterpret_cast<LPARAM>(hItem)));
}
@@ -324,15 +285,10 @@ void DlgOption::SubExclude::setAll(HWND hCList, HANDLE hFirstItem, int iImage, b
// check contacts
HANDLE hItem = (typeOfFirst == CLCIT_CONTACT) ? hFirstItem : reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, reinterpret_cast<LPARAM>(hFirstItem)));
-
- while (hItem)
- {
+ while (hItem) {
int iOldIcon = SendMessage(hCList, CLM_GETEXTRAIMAGE, reinterpret_cast<WPARAM>(hItem), MAKELPARAM(0, 0));
-
if (iOldIcon != 0xFF && iOldIcon != iImage)
- {
SendMessage(hCList, CLM_SETEXTRAIMAGE, reinterpret_cast<WPARAM>(hItem), MAKELPARAM(0, iImage));
- }
hItem = bIterate ? reinterpret_cast<HANDLE>(SendMessage(hCList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, reinterpret_cast<LPARAM>(hItem))) : NULL;
}
diff --git a/plugins/HistoryStats/src/dlgoption_subglobal.cpp b/plugins/HistoryStats/src/dlgoption_subglobal.cpp
index 907d6a374e..645a3876f0 100644
--- a/plugins/HistoryStats/src/dlgoption_subglobal.cpp
+++ b/plugins/HistoryStats/src/dlgoption_subglobal.cpp
@@ -9,139 +9,127 @@
INT_PTR CALLBACK DlgOption::SubGlobal::staticInfoProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hDlg);
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hDlg);
+ {
- SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
+ SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
- utils::centerDialog(hDlg);
+ utils::centerDialog(hDlg);
- // fill with info
- const SupportInfo& info = *reinterpret_cast<const SupportInfo*>(lParam);
+ // fill with info
+ const SupportInfo& info = *reinterpret_cast<const SupportInfo*>(lParam);
- SetDlgItemText(hDlg, IDC_PLUGIN, info.szPlugin);
- SetDlgItemText(hDlg, IDC_FEATURES, i18n(info.szTeaser));
- SetDlgItemText(hDlg, IDC_DESCRIPTION, i18n(info.szDescription));
+ SetDlgItemText(hDlg, IDC_PLUGIN, info.szPlugin);
+ SetDlgItemText(hDlg, IDC_FEATURES, TranslateTS(info.szTeaser));
+ SetDlgItemText(hDlg, IDC_DESCRIPTION, TranslateTS(info.szDescription));
- static const WORD LinkIDs[] = { IDC_LINK2, IDC_LINK1 };
+ static const WORD LinkIDs[] = { IDC_LINK2, IDC_LINK1 };
- ext::string linkTexts = i18n(info.szLinkTexts);
- ext::string linkURLs = info.szLinkURLs;
- int nCurLink = 0;
+ ext::string linkTexts = TranslateTS(info.szLinkTexts);
+ ext::string linkURLs = info.szLinkURLs;
+ int nCurLink = 0;
- if (!linkTexts.empty())
- {
- while (!linkTexts.empty() && nCurLink < array_len(LinkIDs))
- {
- ext::string::size_type posTexts = linkTexts.rfind(muC('|'));
- ext::string::size_type posURLs = linkURLs.rfind(muC('|'));
+ if (!linkTexts.empty()) {
+ while (!linkTexts.empty() && nCurLink < array_len(LinkIDs)) {
+ ext::string::size_type posTexts = linkTexts.rfind('|');
+ ext::string::size_type posURLs = linkURLs.rfind('|');
- if (posTexts == ext::string::npos || posURLs == ext::string::npos)
- {
- posTexts = posURLs = -1;
- }
+ if (posTexts == ext::string::npos || posURLs == ext::string::npos) {
+ posTexts = posURLs = -1;
+ }
- ext::string linkLabel = linkURLs.substr(posURLs + 1);
+ ext::string linkLabel = linkURLs.substr(posURLs + 1);
- linkLabel += muT(" [");
- linkLabel += linkTexts.substr(posTexts + 1);
- linkLabel += muT("]");
+ linkLabel += _T(" [");
+ linkLabel += linkTexts.substr(posTexts + 1);
+ linkLabel += _T("]");
- SetDlgItemText(hDlg, LinkIDs[nCurLink], linkLabel.c_str());
+ SetDlgItemText(hDlg, LinkIDs[nCurLink], linkLabel.c_str());
- linkTexts.erase((posTexts != -1) ? posTexts : 0);
- linkURLs.erase((posURLs != -1) ? posURLs : 0);
+ linkTexts.erase((posTexts != -1) ? posTexts : 0);
+ linkURLs.erase((posURLs != -1) ? posURLs : 0);
- ++nCurLink;
- }
+ ++nCurLink;
}
+ }
- int nHeightAdd = 0;
+ int nHeightAdd = 0;
- while (nCurLink < array_len(LinkIDs))
- {
- HWND hLink = GetDlgItem(hDlg, LinkIDs[nCurLink]);
- RECT rLink;
+ while (nCurLink < array_len(LinkIDs)) {
+ HWND hLink = GetDlgItem(hDlg, LinkIDs[nCurLink]);
+ RECT rLink;
- GetWindowRect(hLink, &rLink);
- nHeightAdd += rLink.bottom - rLink.top;
+ GetWindowRect(hLink, &rLink);
+ nHeightAdd += rLink.bottom - rLink.top;
- ShowWindow(hLink, SW_HIDE);
- EnableWindow(hLink, FALSE);
+ ShowWindow(hLink, SW_HIDE);
+ EnableWindow(hLink, FALSE);
- ++nCurLink;
- }
+ ++nCurLink;
+ }
- if (nHeightAdd > 0)
- {
- RECT rDetails;
-
- GetWindowRect(GetDlgItem(hDlg, IDC_DESCRIPTION), &rDetails);
- SetWindowPos(GetDlgItem(hDlg, IDC_DESCRIPTION), NULL, 0, 0, rDetails.right - rDetails.left, rDetails.bottom - rDetails.top + nHeightAdd, SWP_NOMOVE | SWP_NOZORDER);
- }
+ if (nHeightAdd > 0) {
+ RECT rDetails;
+
+ GetWindowRect(GetDlgItem(hDlg, IDC_DESCRIPTION), &rDetails);
+ SetWindowPos(GetDlgItem(hDlg, IDC_DESCRIPTION), NULL, 0, 0, rDetails.right - rDetails.left, rDetails.bottom - rDetails.top + nHeightAdd, SWP_NOMOVE | SWP_NOZORDER);
}
- return TRUE;
+ }
+ return TRUE;
- case WM_COMMAND:
- switch (LOWORD(wParam))
- {
- case IDOK:
- EndDialog(hDlg, -1);
- return TRUE;
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ EndDialog(hDlg, -1);
+ return TRUE;
- case IDCANCEL:
- EndDialog(hDlg, -1);
- return TRUE;
+ case IDCANCEL:
+ EndDialog(hDlg, -1);
+ return TRUE;
- case IDC_LINK1:
- case IDC_LINK2:
- if (HIWORD(wParam) == STN_CLICKED)
- {
- HWND hLink = reinterpret_cast<HWND>(lParam);
- int nLen = GetWindowTextLength(hLink);
- mu_text* szTitle = new mu_text[nLen + 1];
-
- if (GetWindowText(hLink, szTitle, nLen + 1))
- {
- mu_text* szEndOfURL = (mu_text*)ext::strfunc::str(szTitle, muT(" ["));
- if (szEndOfURL) {
- *szEndOfURL = muC('\0');
- g_pSettings->openURL(szTitle);
- }
- }
-
- delete szTitle;
+ case IDC_LINK1:
+ case IDC_LINK2:
+ if (HIWORD(wParam) == STN_CLICKED) {
+ HWND hLink = reinterpret_cast<HWND>(lParam);
+ int nLen = GetWindowTextLength(hLink);
+ TCHAR* szTitle = new TCHAR[nLen + 1];
+
+ if (GetWindowText(hLink, szTitle, nLen + 1)) {
+ TCHAR* szEndOfURL = (TCHAR*)ext::strfunc::str(szTitle, _T(" ["));
+ if (szEndOfURL) {
+ *szEndOfURL = '\0';
+ g_pSettings->openURL(szTitle);
}
- return TRUE;
+ }
+
+ delete szTitle;
}
- break;
+ return TRUE;
+ }
+ break;
- case WM_CTLCOLORSTATIC:
- {
- HWND hStatic = reinterpret_cast<HWND>(lParam);
- mu_text szClassName[64];
+ case WM_CTLCOLORSTATIC:
+ HWND hStatic = reinterpret_cast<HWND>(lParam);
+ TCHAR szClassName[64];
- if (GetClassName(hStatic, szClassName, array_len(szClassName)) && ext::strfunc::cmp(szClassName, WC_EDIT) == 0)
- {
- HDC hDC = reinterpret_cast<HDC>(wParam);
+ if (GetClassName(hStatic, szClassName, array_len(szClassName)) && ext::strfunc::cmp(szClassName, WC_EDIT) == 0) {
+ HDC hDC = reinterpret_cast<HDC>(wParam);
- SetBkColor(hDC, GetSysColor(COLOR_WINDOW));
- SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
+ SetBkColor(hDC, GetSysColor(COLOR_WINDOW));
+ SetTextColor(hDC, GetSysColor(COLOR_WINDOWTEXT));
- return reinterpret_cast<BOOL>(GetSysColorBrush(COLOR_WINDOW));
- }
- }
- break;
+ return reinterpret_cast<BOOL>(GetSysColorBrush(COLOR_WINDOW));
+ }
+ break;
}
return FALSE;
}
-DlgOption::SubGlobal::SubGlobal()
- : m_hOnStartup(NULL),
+DlgOption::SubGlobal::SubGlobal() :
+ m_hOnStartup(NULL),
m_hShowMainMenu(NULL),
m_hShowMainMenuSub(NULL),
m_hShowContactMenu(NULL),
@@ -163,72 +151,59 @@ DlgOption::SubGlobal::~SubGlobal()
BOOL DlgOption::SubGlobal::handleMsg(UINT msg, WPARAM wParam, LPARAM lParam)
{
- switch (msg)
- {
- case WM_WINDOWPOSCHANGED:
- rearrangeControls();
+ switch (msg) {
+ case WM_WINDOWPOSCHANGED:
+ rearrangeControls();
+ return TRUE;
+
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDC_INFOLABEL && HIWORD(wParam) == STN_CLICKED) {
+ m_bShowInfo = !m_bShowInfo;
+ toggleInfo();
return TRUE;
+ }
+ break;
- case WM_COMMAND:
- if (LOWORD(wParam) == IDC_INFOLABEL && HIWORD(wParam) == STN_CLICKED)
- {
- m_bShowInfo = !m_bShowInfo;
- toggleInfo();
- return TRUE;
- }
- break;
-
- case WM_NOTIFY:
- {
- NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
-
- if (p->idFrom == IDC_INFO)
- {
- NMTREEVIEW* pNM = reinterpret_cast<NMTREEVIEW*>(lParam);
+ case WM_NOTIFY:
+ NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
+ if (p->idFrom == IDC_INFO) {
+ NMTREEVIEW* pNM = reinterpret_cast<NMTREEVIEW*>(lParam);
- if (p->code == NM_DBLCLK)
- {
- DWORD dwPoint = GetMessagePos();
- POINTS pts = MAKEPOINTS(dwPoint);
- TVHITTESTINFO tvhti = { { pts.x, pts.y } };
+ if (p->code == NM_DBLCLK) {
+ DWORD dwPoint = GetMessagePos();
+ POINTS pts = MAKEPOINTS(dwPoint);
+ TVHITTESTINFO tvhti = { { pts.x, pts.y } };
- ScreenToClient(pNM->hdr.hwndFrom, &tvhti.pt);
+ ScreenToClient(pNM->hdr.hwndFrom, &tvhti.pt);
- if (TreeView_HitTest(pNM->hdr.hwndFrom, &tvhti) && tvhti.flags & TVHT_ONITEM)
- {
- TVITEM tvi;
+ if (TreeView_HitTest(pNM->hdr.hwndFrom, &tvhti) && tvhti.flags & TVHT_ONITEM) {
+ TVITEM tvi;
- tvi.mask = TVIF_HANDLE | TVIF_PARAM;
- tvi.hItem = tvhti.hItem;
+ tvi.mask = TVIF_HANDLE | TVIF_PARAM;
+ tvi.hItem = tvhti.hItem;
- if (TreeView_GetItem(pNM->hdr.hwndFrom, &tvi) && tvi.lParam)
- {
- onShowSupportInfo(*reinterpret_cast<SupportInfo*>(tvi.lParam));
- return TRUE;
- }
- }
- }
- else if (p->code == TVN_ITEMEXPANDING)
- {
- if (pNM->action == TVE_COLLAPSE || pNM->action == TVE_COLLAPSERESET ||
- (pNM->action == TVE_TOGGLE && pNM->itemNew.state & TVIS_EXPANDED))
- {
- SetWindowLong(getHWnd(), DWLP_MSGRESULT, TRUE);
- return TRUE;
- }
- }
- }
- else if (p->idFrom == IDC_OPTIONS)
- {
- if (p->code == OptionsCtrl::OCN_MODIFIED)
- {
- getParent()->settingsChanged();
- getParent()->updateProblemInfo();
+ if (TreeView_GetItem(pNM->hdr.hwndFrom, &tvi) && tvi.lParam) {
+ onShowSupportInfo(*reinterpret_cast<SupportInfo*>(tvi.lParam));
return TRUE;
}
}
}
- break;
+ else if (p->code == TVN_ITEMEXPANDING) {
+ if (pNM->action == TVE_COLLAPSE || pNM->action == TVE_COLLAPSERESET ||
+ (pNM->action == TVE_TOGGLE && pNM->itemNew.state & TVIS_EXPANDED)) {
+ SetWindowLong(getHWnd(), DWLP_MSGRESULT, TRUE);
+ return TRUE;
+ }
+ }
+ }
+ else if (p->idFrom == IDC_OPTIONS) {
+ if (p->code == OptionsCtrl::OCN_MODIFIED) {
+ getParent()->settingsChanged();
+ getParent()->updateProblemInfo();
+ return TRUE;
+ }
+ }
+ break;
}
return FALSE;
@@ -244,22 +219,22 @@ void DlgOption::SubGlobal::onWMInitDialog()
// settings
OptionsCtrl::Item hTemp;
- /**/hTemp = m_Options.insertGroup(NULL, i18n(muT("Integration")), OptionsCtrl::OCF_ROOTGROUP);
- /**/ m_hOnStartup = m_Options.insertCheck(hTemp, i18n(muT("Create statistics on Miranda IM's startup")));
- /**/ m_hShowMainMenu = m_Options.insertCheck(hTemp, i18n(muT("Add menu items to main menu")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hShowMainMenuSub = m_Options.insertCheck(m_hShowMainMenu, i18n(muT("Put menu items into submenu")));
- /**/ m_hShowContactMenu = m_Options.insertCheck(hTemp, i18n(muT("Add menu items to contact menu")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hShowContactMenuPseudo = m_Options.insertCheck(m_hShowContactMenu, i18n(muT("Don't hide menu items for pseudo protocols")));
- /**/ m_hProtocols = m_Options.insertGroup(m_hShowContactMenu, i18n(muT("Hide menu items for protocol...")));
- /**/hTemp = m_Options.insertGroup(NULL, i18n(muT("Graphics")), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
- /**/ m_hGraphicsMode = m_Options.insertRadio(hTemp, NULL, i18n(muT("Only use HTML to simulate graphics")));
- /**/ m_hGraphicsModePNG = m_Options.insertRadio(hTemp, m_hGraphicsMode, i18n(muT("Generate PNG files to represent graphics")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hPNGMode = m_Options.insertRadio(m_hGraphicsModePNG, NULL, i18n(muT("Fall back to HTML output, if column options require HTML output")));
- /**/ m_Options.insertRadio(m_hGraphicsModePNG, m_hPNGMode, i18n(muT("Enforce PNG output, possibly ignoring some column options")));
- /**/ m_Options.insertRadio(m_hGraphicsModePNG, m_hPNGMode, i18n(muT("Prefer HTML output over PNG output, if available")));
- /**/hTemp = m_Options.insertGroup(NULL, i18n(muT("Miscellaneous")), OptionsCtrl::OCF_ROOTGROUP);
- /**/ m_hThreadLowPriority = m_Options.insertCheck(hTemp, i18n(muT("Generate statistics in background thread with low priority")));
- /**/ m_hPathToBrowser = m_Options.insertEdit(hTemp, i18n(muT("Path to browser (leave blank for system default)")));
+ hTemp = m_Options.insertGroup(NULL, TranslateT("Integration"), OptionsCtrl::OCF_ROOTGROUP);
+ m_hOnStartup = m_Options.insertCheck(hTemp, TranslateT("Create statistics on Miranda IM's startup"));
+ m_hShowMainMenu = m_Options.insertCheck(hTemp, TranslateT("Add menu items to main menu"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hShowMainMenuSub = m_Options.insertCheck(m_hShowMainMenu, TranslateT("Put menu items into submenu"));
+ m_hShowContactMenu = m_Options.insertCheck(hTemp, TranslateT("Add menu items to contact menu"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hShowContactMenuPseudo = m_Options.insertCheck(m_hShowContactMenu, TranslateT("Don't hide menu items for pseudo protocols"));
+ m_hProtocols = m_Options.insertGroup(m_hShowContactMenu, TranslateT("Hide menu items for protocol..."));
+ hTemp = m_Options.insertGroup(NULL, TranslateT("Graphics"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
+ m_hGraphicsMode = m_Options.insertRadio(hTemp, NULL, TranslateT("Only use HTML to simulate graphics"));
+ m_hGraphicsModePNG = m_Options.insertRadio(hTemp, m_hGraphicsMode, TranslateT("Generate PNG files to represent graphics"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hPNGMode = m_Options.insertRadio(m_hGraphicsModePNG, NULL, TranslateT("Fall back to HTML output, if column options require HTML output"));
+ m_Options.insertRadio(m_hGraphicsModePNG, m_hPNGMode, TranslateT("Enforce PNG output, possibly ignoring some column options"));
+ m_Options.insertRadio(m_hGraphicsModePNG, m_hPNGMode, TranslateT("Prefer HTML output over PNG output, if available"));
+ hTemp = m_Options.insertGroup(NULL, TranslateT("Miscellaneous"), OptionsCtrl::OCF_ROOTGROUP);
+ m_hThreadLowPriority = m_Options.insertCheck(hTemp, TranslateT("Generate statistics in background thread with low priority"));
+ m_hPathToBrowser = m_Options.insertEdit(hTemp, TranslateT("Path to browser (leave blank for system default)"));
// insert known protocols
m_hHideContactMenuProtos.clear();
@@ -267,9 +242,8 @@ void DlgOption::SubGlobal::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_hHideContactMenuProtos.push_back(m_Options.insertCheck(
m_hProtocols,
@@ -289,37 +263,34 @@ void DlgOption::SubGlobal::onWMInitDialog()
m_bShowInfo = g_pSettings->getShowSupportInfo();
toggleInfo();
}
-
+
void DlgOption::SubGlobal::loadSettings()
{
// read settings from local settings store
Settings& localS = getParent()->getLocalSettings();
- m_Options.checkItem (m_hOnStartup , localS.m_OnStartup );
- m_Options.checkItem (m_hShowMainMenu , localS.m_ShowMainMenu );
- m_Options.checkItem (m_hShowMainMenuSub , localS.m_ShowMainMenuSub );
- m_Options.checkItem (m_hShowContactMenu , localS.m_ShowContactMenu );
- m_Options.checkItem (m_hShowContactMenuPseudo, localS.m_ShowContactMenuPseudo);
- m_Options.setRadioChecked(m_hGraphicsMode , localS.m_GraphicsMode );
- m_Options.setRadioChecked(m_hPNGMode , localS.m_PNGMode );
- m_Options.checkItem (m_hThreadLowPriority , localS.m_ThreadLowPriority );
- m_Options.setEditString (m_hPathToBrowser , localS.m_PathToBrowser.c_str());
+ m_Options.checkItem(m_hOnStartup, localS.m_OnStartup);
+ m_Options.checkItem(m_hShowMainMenu, localS.m_ShowMainMenu);
+ m_Options.checkItem(m_hShowMainMenuSub, localS.m_ShowMainMenuSub);
+ m_Options.checkItem(m_hShowContactMenu, localS.m_ShowContactMenu);
+ m_Options.checkItem(m_hShowContactMenuPseudo, localS.m_ShowContactMenuPseudo);
+ m_Options.setRadioChecked(m_hGraphicsMode, localS.m_GraphicsMode);
+ m_Options.setRadioChecked(m_hPNGMode, localS.m_PNGMode);
+ m_Options.checkItem(m_hThreadLowPriority, localS.m_ThreadLowPriority);
+ m_Options.setEditString(m_hPathToBrowser, localS.m_PathToBrowser.c_str());
// 'set check' on hidden contact menu items protocols
citer_each_(std::vector<OptionsCtrl::Check>, i, m_hHideContactMenuProtos)
{
- 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_HideContactMenuProtos.find(protoName) != localS.m_HideContactMenuProtos.end());
}
// check for availability of 'libpng'
- if (!Canvas::hasPNG())
- {
+ if (!Canvas::hasPNG()) {
if (m_Options.isItemChecked(m_hGraphicsModePNG))
- {
m_Options.setRadioChecked(m_hGraphicsMode, Settings::gmHTML);
- }
m_Options.enableItem(m_hGraphicsModePNG, false);
}
@@ -329,23 +300,21 @@ void DlgOption::SubGlobal::saveSettings()
{
Settings& localS = getParent()->getLocalSettings();
- localS.m_OnStartup = m_Options.isItemChecked (m_hOnStartup );
- localS.m_ShowMainMenu = m_Options.isItemChecked (m_hShowMainMenu );
- localS.m_ShowMainMenuSub = m_Options.isItemChecked (m_hShowMainMenuSub );
- localS.m_ShowContactMenu = m_Options.isItemChecked (m_hShowContactMenu );
- localS.m_ShowContactMenuPseudo = m_Options.isItemChecked (m_hShowContactMenuPseudo);
- localS.m_GraphicsMode = m_Options.getRadioChecked(m_hGraphicsMode );
- localS.m_PNGMode = m_Options.getRadioChecked(m_hPNGMode );
- localS.m_ThreadLowPriority = m_Options.isItemChecked (m_hThreadLowPriority );
- localS.m_PathToBrowser = m_Options.getEditString (m_hPathToBrowser );
+ localS.m_OnStartup = m_Options.isItemChecked(m_hOnStartup);
+ localS.m_ShowMainMenu = m_Options.isItemChecked(m_hShowMainMenu);
+ localS.m_ShowMainMenuSub = m_Options.isItemChecked(m_hShowMainMenuSub);
+ localS.m_ShowContactMenu = m_Options.isItemChecked(m_hShowContactMenu);
+ localS.m_ShowContactMenuPseudo = m_Options.isItemChecked(m_hShowContactMenuPseudo);
+ localS.m_GraphicsMode = m_Options.getRadioChecked(m_hGraphicsMode);
+ localS.m_PNGMode = m_Options.getRadioChecked(m_hPNGMode);
+ localS.m_ThreadLowPriority = m_Options.isItemChecked(m_hThreadLowPriority);
+ localS.m_PathToBrowser = m_Options.getEditString(m_hPathToBrowser);
localS.m_HideContactMenuProtos.clear();
vector_each_(i, m_hHideContactMenuProtos)
{
if (m_Options.isItemChecked(m_hHideContactMenuProtos[i]))
- {
- localS.m_HideContactMenuProtos.insert(reinterpret_cast<mu_ansi*>(m_Options.getItemData(m_hHideContactMenuProtos[i])));
- }
+ localS.m_HideContactMenuProtos.insert(reinterpret_cast<char*>(m_Options.getItemData(m_hHideContactMenuProtos[i])));
}
}
@@ -353,25 +322,25 @@ void DlgOption::SubGlobal::initSupportInfo()
{
static const SupportInfo Infos[] = {
{
- muT("MetaContacts"),
- I18N(muT("Create statistics for meta-contacts and their subcontacts")),
- I18N(muT("The following information are only relevant if your already use MetaContacts. In case you do please use version 0.9.10.6 or above.\r\n\r\nHistoryStats perfectly integrates with MetaContacts and is able to collect the data from the meta-contact as well as from the subcontacts. It is able to intelligently merge all subcontacts histories and more. You can configure MetContacts integration in the \"Input\" options.")),
- I18N(muT("MetaContacts Plugin")),
- muT("http://addons.miranda-im.org/details.php?action=viewfile&id=1595")
+ _T("MetaContacts"),
+ LPGENT("Create statistics for meta-contacts and their subcontacts"),
+ LPGENT("The following information are only relevant if your already use MetaContacts. In case you do please use version 0.9.10.6 or above.\r\n\r\nHistoryStats perfectly integrates with MetaContacts and is able to collect the data from the meta-contact as well as from the subcontacts. It is able to intelligently merge all subcontacts histories and more. You can configure MetContacts integration in the \"Input\" options."),
+ LPGENT("MetaContacts Plugin"),
+ _T("http://addons.miranda-im.org/details.php?action=viewfile&id=1595")
},
{
- muT("Updater"),
- I18N(muT("Automatically get updates of HistoryStats")),
- I18N(muT("Use this plugin if you'd like to be automatically notified when a new version of HistoryStats is published. This plugin can install the updated version, too. As always, be sure to use a recent version though this shouldn't be a big problem with this plugin.")),
- I18N(muT("Updater|Updater (Unicode)")),
- muT("http://addons.miranda-im.org/details.php?action=viewfile&id=2254|http://addons.miranda-im.org/details.php?action=viewfile&id=2596")
+ _T("Updater"),
+ LPGENT("Automatically get updates of HistoryStats"),
+ LPGENT("Use this plugin if you'd like to be automatically notified when a new version of HistoryStats is published. This plugin can install the updated version, too. As always, be sure to use a recent version though this shouldn't be a big problem with this plugin."),
+ LPGENT("Updater|Updater (Unicode)"),
+ _T("http://addons.miranda-im.org/details.php?action=viewfile&id=2254|http://addons.miranda-im.org/details.php?action=viewfile&id=2596")
},
{
- muT("IcoLib"),
- I18N(muT("Easily exchange icons in HistoryStats' user interface")),
- I18N(muT("Use this plugin if you'd like to customize most of the icons HistoryStats' user interface. Please be sure to use version 0.0.1.0 or above. Otherwise HistoryStats won't show up in IcoLib's options. If you're running Miranda IM 0.7.0 alpha #3 or above you don't need a separate plugin for this.")),
- I18N(muT("Icons Library Manager")),
- muT("http://addons.miranda-im.org/details.php?action=viewfile&id=2700")
+ _T("IcoLib"),
+ LPGENT("Easily exchange icons in HistoryStats' user interface"),
+ LPGENT("Use this plugin if you'd like to customize most of the icons HistoryStats' user interface. Please be sure to use version 0.0.1.0 or above. Otherwise HistoryStats won't show up in IcoLib's options. If you're running Miranda IM 0.7.0 alpha #3 or above you don't need a separate plugin for this."),
+ LPGENT("Icons Library Manager"),
+ _T("http://addons.miranda-im.org/details.php?action=viewfile&id=2700")
},
};
@@ -379,11 +348,10 @@ void DlgOption::SubGlobal::initSupportInfo()
SetWindowLong(hInfo, GWL_STYLE, GetWindowLong(hInfo, GWL_STYLE) | TVS_NOHSCROLL);
- // fill with data
- TVINSERTSTRUCT tvi;
-
SendMessage(hInfo, WM_SETREDRAW, FALSE, 0);
+ // fill with data
+ TVINSERTSTRUCT tvi;
tvi.hParent = TVI_ROOT;
tvi.hInsertAfter = TVI_LAST;
tvi.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_STATE;
@@ -391,16 +359,15 @@ void DlgOption::SubGlobal::initSupportInfo()
tvi.item.state = TVIS_EXPANDED | TVIS_BOLD;
tvi.item.stateMask = TVIS_EXPANDED | TVIS_BOLD;
- tvi.item.pszText = const_cast<mu_text*>(i18n(muT("Supported plugins (double-click to learn more):")));
+ tvi.item.pszText = const_cast<TCHAR*>(TranslateT("Supported plugins (double-click to learn more):"));
tvi.hParent = TreeView_InsertItem(hInfo, &tvi);
tvi.item.stateMask &= ~TVIS_BOLD;
array_each_(i, Infos)
{
- tvi.item.pszText = const_cast<mu_text*>(Infos[i].szPlugin);
+ tvi.item.pszText = const_cast<TCHAR*>(Infos[i].szPlugin);
tvi.item.lParam = reinterpret_cast<LPARAM>(&Infos[i]);
-
TreeView_InsertItem(hInfo, &tvi);
}
@@ -412,14 +379,13 @@ void DlgOption::SubGlobal::rearrangeControls()
RECT rClient, rWnd;
int offsetY;
- if (m_nInfoHeight == 0)
- {
+ if (m_nInfoHeight == 0) {
m_nInfoHeight = utils::getWindowRect(getHWnd(), IDC_INFO).bottom;
m_nInfoHeight -= utils::getWindowRect(getHWnd(), IDC_INFOLABEL).bottom;
}
GetClientRect(getHWnd(), &rClient);
-
+
// support info list
rWnd = utils::getWindowRect(getHWnd(), IDC_INFO);
offsetY = rClient.bottom + (m_bShowInfo ? 0 : m_nInfoHeight) - rWnd.bottom;
@@ -443,9 +409,9 @@ void DlgOption::SubGlobal::rearrangeControls()
void DlgOption::SubGlobal::toggleInfo()
{
HWND hInfo = GetDlgItem(getHWnd(), IDC_INFO);
- const mu_text* szInfoLabelText = m_bShowInfo ? I18N(muT("HistoryStats supports several plugins. Click to hide info...")) : I18N(muT("HistoryStats supports several plugins. Click to learn more..."));
+ const TCHAR* szInfoLabelText = m_bShowInfo ? LPGENT("HistoryStats supports several plugins. Click to hide info...") : LPGENT("HistoryStats supports several plugins. Click to learn more...");
- SetDlgItemText(getHWnd(), IDC_INFOLABEL, i18n(szInfoLabelText));
+ SetDlgItemText(getHWnd(), IDC_INFOLABEL, TranslateTS(szInfoLabelText));
ShowWindow(hInfo, m_bShowInfo ? SW_SHOW : SW_HIDE);
EnableWindow(hInfo, BOOL_(m_bShowInfo));
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])));
}
}
diff --git a/plugins/HistoryStats/src/dlgoption_suboutput.cpp b/plugins/HistoryStats/src/dlgoption_suboutput.cpp
index aa10236451..704f837bb2 100644
--- a/plugins/HistoryStats/src/dlgoption_suboutput.cpp
+++ b/plugins/HistoryStats/src/dlgoption_suboutput.cpp
@@ -5,38 +5,38 @@
* DlgOption::SubOutput
*/
-DlgOption::SubOutput::SubOutput()
- : m_hRemoveEmptyContacts(NULL)
- , m_hRemoveInChatsZero(NULL)
- , m_hRemoveInBytesZero(NULL)
- , m_hRemoveOutChatsZero(NULL)
- , m_hRemoveOutBytesZero(NULL)
- , m_hOmitContacts(NULL)
- , m_hOmitByValue(NULL)
- , m_hOmitByValueData(NULL)
- , m_hOmitByValueLimit(NULL)
- , m_hOmitByTime(NULL)
- , m_hOmitByTimeDays(NULL)
- , m_hOmitByRank(NULL)
- , m_hOmitNumOnTop(NULL)
- , m_hOmittedInTotals(NULL)
- , m_hOmittedInExtraRow(NULL)
- , m_hCalcTotals(NULL)
- , m_hTableHeader(NULL)
- , m_hTableHeaderRepeat(NULL)
- , m_hTableHeaderVerbose(NULL)
- , m_hHeaderTooltips(NULL)
- , m_hHeaderTooltipsIfCustom(NULL)
- , m_hSort(NULL)
- , m_hNick(NULL)
- , m_hOutputVariables(NULL)
- , m_hOutputFile(NULL)
- , m_hOutputExtraToFolder(NULL)
- , m_hOutputExtraFolder(NULL)
- , m_hOverwriteAlways(NULL)
- , m_hAutoOpenOptions(NULL)
- , m_hAutoOpenStartup(NULL)
- , m_hAutoOpenMenu(NULL)
+DlgOption::SubOutput::SubOutput() :
+ m_hRemoveEmptyContacts(NULL),
+ m_hRemoveInChatsZero(NULL),
+ m_hRemoveInBytesZero(NULL),
+ m_hRemoveOutChatsZero(NULL),
+ m_hRemoveOutBytesZero(NULL),
+ m_hOmitContacts(NULL),
+ m_hOmitByValue(NULL),
+ m_hOmitByValueData(NULL),
+ m_hOmitByValueLimit(NULL),
+ m_hOmitByTime(NULL),
+ m_hOmitByTimeDays(NULL),
+ m_hOmitByRank(NULL),
+ m_hOmitNumOnTop(NULL),
+ m_hOmittedInTotals(NULL),
+ m_hOmittedInExtraRow(NULL),
+ m_hCalcTotals(NULL),
+ m_hTableHeader(NULL),
+ m_hTableHeaderRepeat(NULL),
+ m_hTableHeaderVerbose(NULL),
+ m_hHeaderTooltips(NULL),
+ m_hHeaderTooltipsIfCustom(NULL),
+ m_hSort(NULL),
+ m_hNick(NULL),
+ m_hOutputVariables(NULL),
+ m_hOutputFile(NULL),
+ m_hOutputExtraToFolder(NULL),
+ m_hOutputExtraFolder(NULL),
+ m_hOverwriteAlways(NULL),
+ m_hAutoOpenOptions(NULL),
+ m_hAutoOpenStartup(NULL),
+ m_hAutoOpenMenu(NULL)
{
array_each_(i, m_hSortBy)
{
@@ -55,38 +55,33 @@ DlgOption::SubOutput::~SubOutput()
BOOL DlgOption::SubOutput::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);
- }
- break;
-
- case WM_NOTIFY:
- {
- NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
-
- if (p->idFrom == IDC_OPTIONS)
- {
- if (p->code == OptionsCtrl::OCN_MODIFIED)
- {
- OptionsCtrl::NMOPTIONSCTRL* pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
-
- onChanged(pNM->hItem);
- 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);
+ }
+ break;
+
+ case WM_NOTIFY:
+ NMHDR* p = reinterpret_cast<NMHDR*>(lParam);
+
+ if (p->idFrom == IDC_OPTIONS) {
+ if (p->code == OptionsCtrl::OCN_MODIFIED) {
+ OptionsCtrl::NMOPTIONSCTRL* pNM = reinterpret_cast<OptionsCtrl::NMOPTIONSCTRL*>(lParam);
+
+ onChanged(pNM->hItem);
+ return TRUE;
}
- break;
+ }
+ break;
}
return FALSE;
@@ -103,83 +98,83 @@ void DlgOption::SubOutput::onWMInitDialog()
OptionsCtrl::Item hTemp;
OptionsCtrl::Item hTemp2;
- /**/hTemp = m_Options.insertGroup(NULL, i18n(muT("Contact filtering and totals")), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
- /**/ m_hRemoveEmptyContacts = m_Options.insertCheck(hTemp, i18n(muT("Remove contacts with empty history")));
- /**/ m_hRemoveOutChatsZero = m_Options.insertCheck(hTemp, i18n(muT("Remove contacts with only incoming chats")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hRemoveOutBytesZero = m_Options.insertCheck(m_hRemoveOutChatsZero, i18n(muT("Remove only if you never answered")));
- /**/ m_hRemoveInChatsZero = m_Options.insertCheck(hTemp, i18n(muT("Remove contacts with only outgoing chats")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hRemoveInBytesZero = m_Options.insertCheck(m_hRemoveInChatsZero, i18n(muT("Remove only if contact never answered")));
- /**/ m_hOmitContacts = m_Options.insertCheck(hTemp, i18n(muT("Limit number of contacts in statistics")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ hTemp2 = m_Options.insertGroup(m_hOmitContacts, i18n(muT("Criteria")));
- /**/ m_hOmitByValue = m_Options.insertCheck(hTemp2, i18n(muT("Omit contacts that didn't produce a certain amount of data")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hOmitByValueData = m_Options.insertCombo(m_hOmitByValue, i18n(muT("Omit if")));
- /**/ m_hOmitByValueLimit = m_Options.insertEdit(m_hOmitByValue, i18n(muT("...is less than")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ m_hOmitByTime = m_Options.insertCheck(hTemp2, i18n(muT("Omit contacts that were inactive for some time")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hOmitByTimeDays = m_Options.insertEdit(m_hOmitByTime, i18n(muT("Maximum inactivity time (days)")), muT(""), OptionsCtrl::OCF_NUMBER);
- /**/ m_hOmitByRank = m_Options.insertCheck(hTemp2, i18n(muT("Omit all contacts not in \"Top n\"")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hOmitNumOnTop = m_Options.insertEdit(m_hOmitByRank, i18n(muT("Number of contacts in \"Top n\"")), muT("10"), OptionsCtrl::OCF_NUMBER);
- /**/ m_hOmittedInTotals = m_Options.insertCheck(m_hOmitContacts, i18n(muT("Include omitted contacts in totals")));
- /**/ m_hOmittedInExtraRow = m_Options.insertCheck(m_hOmitContacts, i18n(muT("Include totals of omitted contacts in additional row")));
- /**/ m_hCalcTotals = m_Options.insertCheck(hTemp, i18n(muT("Include totals in statistics")));
- /**/hTemp = m_Options.insertGroup(NULL, i18n(muT("Table header")), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
- /**/ m_hTableHeader = m_Options.insertCheck(hTemp, i18n(muT("Output header")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK | OptionsCtrl::OCF_DISABLED | OptionsCtrl::OCF_NODISABLECHILDS);
- /**/ m_hTableHeaderRepeat = m_Options.insertEdit(m_hTableHeader, i18n(muT("Repeat header every n contacts (0=don't repeat)")), muT("0"), OptionsCtrl::OCF_NUMBER);
- /**/ m_hTableHeaderVerbose = m_Options.insertCheck(m_hTableHeader, i18n(muT("Make column titles more verbose")));
- /**/ m_hHeaderTooltips = m_Options.insertCheck(m_hTableHeader, i18n(muT("Show tooltips with detailed information in column titles")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hHeaderTooltipsIfCustom = m_Options.insertCheck(m_hHeaderTooltips, i18n(muT("Only show if a custom title was entered or if titles are not verbose")));
- /**/m_hSort = m_Options.insertGroup(NULL, i18n(muT("Sorting")), OptionsCtrl::OCF_ROOTGROUP);
- /**/hTemp = m_Options.insertGroup(NULL, i18n(muT("HTML file generation")), OptionsCtrl::OCF_ROOTGROUP);
- /**/ m_hNick = m_Options.insertEdit(hTemp, i18n(muT("Own nick for statistics")));
- /**/ hTemp2 = m_Options.insertGroup(hTemp, i18n(muT("Output files and folders")));
- /**/ m_hOutputVariables = m_Options.insertCheck(hTemp2, i18n(muT("Substitute variables in output file name and subfolder for additional files")));
- /**/ m_hOutputFile = m_Options.insertEdit(hTemp2, i18n(muT("Output file")));
- /**/ m_hOutputExtraToFolder = m_Options.insertCheck(hTemp2, i18n(muT("Output additional files to subfolder")), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
- /**/ m_hOutputExtraFolder = m_Options.insertEdit(m_hOutputExtraToFolder, i18n(muT("Subfolder for additional files")));
- /**/ m_hOverwriteAlways = m_Options.insertCheck(hTemp2, i18n(muT("Always overwrite already existing files (dangerous!)")));
- /**/ hTemp2 = m_Options.insertGroup(hTemp, i18n(muT("Auto open statistics after being generated...")));
- /**/ m_hAutoOpenOptions = m_Options.insertCheck(hTemp2, i18n(muT("...via button \"Create statistics\" in options")));
- /**/ m_hAutoOpenStartup = m_Options.insertCheck(hTemp2, i18n(muT("...on Miranda IM's startup")));
- /**/ m_hAutoOpenMenu = m_Options.insertCheck(hTemp2, i18n(muT("...via Miranda IM's main menu")));
+ hTemp = m_Options.insertGroup(NULL, TranslateT("Contact filtering and totals"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
+ m_hRemoveEmptyContacts = m_Options.insertCheck(hTemp, TranslateT("Remove contacts with empty history"));
+ m_hRemoveOutChatsZero = m_Options.insertCheck(hTemp, TranslateT("Remove contacts with only incoming chats"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hRemoveOutBytesZero = m_Options.insertCheck(m_hRemoveOutChatsZero, TranslateT("Remove only if you never answered"));
+ m_hRemoveInChatsZero = m_Options.insertCheck(hTemp, TranslateT("Remove contacts with only outgoing chats"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hRemoveInBytesZero = m_Options.insertCheck(m_hRemoveInChatsZero, TranslateT("Remove only if contact never answered"));
+ m_hOmitContacts = m_Options.insertCheck(hTemp, TranslateT("Limit number of contacts in statistics"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ hTemp2 = m_Options.insertGroup(m_hOmitContacts, TranslateT("Criteria"));
+ m_hOmitByValue = m_Options.insertCheck(hTemp2, TranslateT("Omit contacts that didn't produce a certain amount of data"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hOmitByValueData = m_Options.insertCombo(m_hOmitByValue, TranslateT("Omit if"));
+ m_hOmitByValueLimit = m_Options.insertEdit(m_hOmitByValue, TranslateT("...is less than"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hOmitByTime = m_Options.insertCheck(hTemp2, TranslateT("Omit contacts that were inactive for some time"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hOmitByTimeDays = m_Options.insertEdit(m_hOmitByTime, TranslateT("Maximum inactivity time (days)"), _T(""), OptionsCtrl::OCF_NUMBER);
+ m_hOmitByRank = m_Options.insertCheck(hTemp2, TranslateT("Omit all contacts not in \"Top n\""), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hOmitNumOnTop = m_Options.insertEdit(m_hOmitByRank, TranslateT("Number of contacts in \"Top n\""), _T("10"), OptionsCtrl::OCF_NUMBER);
+ m_hOmittedInTotals = m_Options.insertCheck(m_hOmitContacts, TranslateT("Include omitted contacts in totals"));
+ m_hOmittedInExtraRow = m_Options.insertCheck(m_hOmitContacts, TranslateT("Include totals of omitted contacts in additional row"));
+ m_hCalcTotals = m_Options.insertCheck(hTemp, TranslateT("Include totals in statistics"));
+ hTemp = m_Options.insertGroup(NULL, TranslateT("Table header"), OptionsCtrl::OCF_ROOTGROUP | OptionsCtrl::OCF_NODISABLECHILDS);
+ m_hTableHeader = m_Options.insertCheck(hTemp, TranslateT("Output header"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK | OptionsCtrl::OCF_DISABLED | OptionsCtrl::OCF_NODISABLECHILDS);
+ m_hTableHeaderRepeat = m_Options.insertEdit(m_hTableHeader, TranslateT("Repeat header every n contacts (0=don't repeat)"), _T("0"), OptionsCtrl::OCF_NUMBER);
+ m_hTableHeaderVerbose = m_Options.insertCheck(m_hTableHeader, TranslateT("Make column titles more verbose"));
+ m_hHeaderTooltips = m_Options.insertCheck(m_hTableHeader, TranslateT("Show tooltips with detailed information in column titles"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hHeaderTooltipsIfCustom = m_Options.insertCheck(m_hHeaderTooltips, TranslateT("Only show if a custom title was entered or if titles are not verbose"));
+ m_hSort = m_Options.insertGroup(NULL, TranslateT("Sorting"), OptionsCtrl::OCF_ROOTGROUP);
+ hTemp = m_Options.insertGroup(NULL, TranslateT("HTML file generation"), OptionsCtrl::OCF_ROOTGROUP);
+ m_hNick = m_Options.insertEdit(hTemp, TranslateT("Own nick for statistics"));
+ hTemp2 = m_Options.insertGroup(hTemp, TranslateT("Output files and folders"));
+ m_hOutputVariables = m_Options.insertCheck(hTemp2, TranslateT("Substitute variables in output file name and subfolder for additional files"));
+ m_hOutputFile = m_Options.insertEdit(hTemp2, TranslateT("Output file"));
+ m_hOutputExtraToFolder = m_Options.insertCheck(hTemp2, TranslateT("Output additional files to subfolder"), OptionsCtrl::OCF_DISABLECHILDSONUNCHECK);
+ m_hOutputExtraFolder = m_Options.insertEdit(m_hOutputExtraToFolder, TranslateT("Subfolder for additional files"));
+ m_hOverwriteAlways = m_Options.insertCheck(hTemp2, TranslateT("Always overwrite already existing files (dangerous!)"));
+ hTemp2 = m_Options.insertGroup(hTemp, TranslateT("Auto open statistics after being generated..."));
+ m_hAutoOpenOptions = m_Options.insertCheck(hTemp2, TranslateT("...via button \"Create statistics\" in options"));
+ m_hAutoOpenStartup = m_Options.insertCheck(hTemp2, TranslateT("...on Miranda IM's startup"));
+ m_hAutoOpenMenu = m_Options.insertCheck(hTemp2, TranslateT("...via Miranda IM's main menu"));
// our sort levels
- static const mu_text* sortLevels[Settings::cNumSortLevels] = {
- I18N(muT("First sort by")),
- I18N(muT("Then sort by")),
- I18N(muT("Finally sort by"))
+ static const TCHAR* sortLevels[Settings::cNumSortLevels] = {
+ LPGENT("First sort by"),
+ LPGENT("Then sort by"),
+ LPGENT("Finally sort by")
};
// our sort keys
static const struct {
int key;
- mu_text* desc;
+ TCHAR* desc;
} sortKeys[] = {
- { Settings::skNick , I18N(muT("Nick")) },
- { Settings::skProtocol , I18N(muT("Protocol")) },
- { Settings::skGroup , I18N(muT("Group")) },
- { Settings::skBytesIn , I18N(muT("Characters (incoming, absolute)")) },
- { Settings::skBytesOut , I18N(muT("Characters (outgoing, absolute)")) },
- { Settings::skBytesTotal , I18N(muT("Characters (all, absolute)")) },
- { Settings::skBytesInAvg , I18N(muT("Characters (incoming, average)")) },
- { Settings::skBytesOutAvg , I18N(muT("Characters (outgoing, average)")) },
- { Settings::skBytesTotalAvg , I18N(muT("Characters (all, average)")) },
- { Settings::skMessagesIn , I18N(muT("Messages (incoming, absolute)")) },
- { Settings::skMessagesOut , I18N(muT("Messages (outgoing, absolute)")) },
- { Settings::skMessagesTotal , I18N(muT("Messages (all, absolute)")) },
- { Settings::skMessagesInAvg , I18N(muT("Messages (incoming, average)")) },
- { Settings::skMessagesOutAvg , I18N(muT("Messages (outgoing, average)")) },
- { Settings::skMessagesTotalAvg , I18N(muT("Messages (all, average)")) },
- { Settings::skChatsIn , I18N(muT("Chats (incoming, absolute)")) },
- { Settings::skChatsOut , I18N(muT("Chats (outgoing, absolute)")) },
- { Settings::skChatsTotal , I18N(muT("Chats (all, absolute)")) },
- { Settings::skChatsInAvg , I18N(muT("Chats (incoming, average)")) },
- { Settings::skChatsOutAvg , I18N(muT("Chats (outgoing, average)")) },
- { Settings::skChatsTotalAvg , I18N(muT("Chats (all, average)")) },
- { Settings::skChatDurationTotal , I18N(muT("Chat duration (total)")) },
- { Settings::skChatDurationMin , I18N(muT("Chat duration (minimum)")) },
- { Settings::skChatDurationAvg , I18N(muT("Chat duration (average)")) },
- { Settings::skChatDurationMax , I18N(muT("Chat duration (maximum)")) },
- { Settings::skTimeOfFirstMessage, I18N(muT("Time of first message to/from contact")) },
- { Settings::skTimeOfLastMessage , I18N(muT("Time of last message to/from contact")) },
+ { Settings::skNick , LPGENT("Nick") },
+ { Settings::skProtocol , LPGENT("Protocol") },
+ { Settings::skGroup , LPGENT("Group") },
+ { Settings::skBytesIn , LPGENT("Characters (incoming, absolute)") },
+ { Settings::skBytesOut , LPGENT("Characters (outgoing, absolute)") },
+ { Settings::skBytesTotal , LPGENT("Characters (all, absolute)") },
+ { Settings::skBytesInAvg , LPGENT("Characters (incoming, average)") },
+ { Settings::skBytesOutAvg , LPGENT("Characters (outgoing, average)") },
+ { Settings::skBytesTotalAvg , LPGENT("Characters (all, average)") },
+ { Settings::skMessagesIn , LPGENT("Messages (incoming, absolute)") },
+ { Settings::skMessagesOut , LPGENT("Messages (outgoing, absolute)") },
+ { Settings::skMessagesTotal , LPGENT("Messages (all, absolute)") },
+ { Settings::skMessagesInAvg , LPGENT("Messages (incoming, average)") },
+ { Settings::skMessagesOutAvg , LPGENT("Messages (outgoing, average)") },
+ { Settings::skMessagesTotalAvg , LPGENT("Messages (all, average)") },
+ { Settings::skChatsIn , LPGENT("Chats (incoming, absolute)") },
+ { Settings::skChatsOut , LPGENT("Chats (outgoing, absolute)") },
+ { Settings::skChatsTotal , LPGENT("Chats (all, absolute)") },
+ { Settings::skChatsInAvg , LPGENT("Chats (incoming, average)") },
+ { Settings::skChatsOutAvg , LPGENT("Chats (outgoing, average)") },
+ { Settings::skChatsTotalAvg , LPGENT("Chats (all, average)") },
+ { Settings::skChatDurationTotal , LPGENT("Chat duration (total)") },
+ { Settings::skChatDurationMin , LPGENT("Chat duration (minimum)") },
+ { Settings::skChatDurationAvg , LPGENT("Chat duration (average)") },
+ { Settings::skChatDurationMax , LPGENT("Chat duration (maximum)") },
+ { Settings::skTimeOfFirstMessage, LPGENT("Time of first message to/from contact") },
+ { Settings::skTimeOfLastMessage , LPGENT("Time of last message to/from contact") },
};
m_SortKeyToIndex.resize(Settings::skLAST - Settings::skFIRST + 1);
@@ -193,48 +188,48 @@ void DlgOption::SubOutput::onWMInitDialog()
array_each_(i, sortLevels)
{
- m_hSortBy[i] = m_Options.insertCombo(m_hSort, i18n(sortLevels[i]), (i == 0) ? 0 : OptionsCtrl::OCF_DISABLECHILDSONINDEX0);
+ m_hSortBy[i] = m_Options.insertCombo(m_hSort, TranslateTS(sortLevels[i]), (i == 0) ? 0 : OptionsCtrl::OCF_DISABLECHILDSONINDEX0);
if (i != 0)
{
- m_Options.addComboItem(m_hSortBy[i], i18n(muT("(nothing)")));
+ m_Options.addComboItem(m_hSortBy[i], TranslateT("(nothing)"));
}
array_each_(j, sortKeys)
{
- m_Options.addComboItem(m_hSortBy[i], i18n(sortKeys[j].desc));
+ m_Options.addComboItem(m_hSortBy[i], TranslateTS(sortKeys[j].desc));
}
- /**/m_hSortDir[i] = m_Options.insertRadio(m_hSortBy[i], NULL, i18n(muT("Ascending")));
- /**/ m_Options.insertRadio(m_hSortBy[i], m_hSortDir[i], i18n(muT("Descending")));
+ m_hSortDir[i] = m_Options.insertRadio(m_hSortBy[i], NULL, TranslateT("Ascending"));
+ m_Options.insertRadio(m_hSortBy[i], m_hSortDir[i], TranslateT("Descending"));
}
// our "omit by value" data
- static const mu_text* omitData[] = {
- I18N(muT("Characters (incoming, absolute)")),
- I18N(muT("Characters (outgoing, absolute)")),
- I18N(muT("Characters (all, absolute)")),
- I18N(muT("Characters (incoming, average per week)")),
- I18N(muT("Characters (outgoing, average per week)")),
- I18N(muT("Characters (all, average per week)")),
- I18N(muT("Messages (incoming, absolute)")),
- I18N(muT("Messages (outgoing, absolute)")),
- I18N(muT("Messages (all, absolute)")),
- I18N(muT("Messages (incoming, average per week)")),
- I18N(muT("Messages (outgoing, average per week)")),
- I18N(muT("Messages (all, average per week)")),
- I18N(muT("Chats (incoming, absolute)")),
- I18N(muT("Chats (outgoing, absolute)")),
- I18N(muT("Chats (all, absolute)")),
- I18N(muT("Chats (incoming, average per week)")),
- I18N(muT("Chats (outgoing, average per week)")),
- I18N(muT("Chats (all, average per week)")),
- I18N(muT("Chat duration (total, hours)")),
+ static const TCHAR* omitData[] = {
+ LPGENT("Characters (incoming, absolute)"),
+ LPGENT("Characters (outgoing, absolute)"),
+ LPGENT("Characters (all, absolute)"),
+ LPGENT("Characters (incoming, average per week)"),
+ LPGENT("Characters (outgoing, average per week)"),
+ LPGENT("Characters (all, average per week)"),
+ LPGENT("Messages (incoming, absolute)"),
+ LPGENT("Messages (outgoing, absolute)"),
+ LPGENT("Messages (all, absolute)"),
+ LPGENT("Messages (incoming, average per week)"),
+ LPGENT("Messages (outgoing, average per week)"),
+ LPGENT("Messages (all, average per week)"),
+ LPGENT("Chats (incoming, absolute)"),
+ LPGENT("Chats (outgoing, absolute)"),
+ LPGENT("Chats (all, absolute)"),
+ LPGENT("Chats (incoming, average per week)"),
+ LPGENT("Chats (outgoing, average per week)"),
+ LPGENT("Chats (all, average per week)"),
+ LPGENT("Chat duration (total, hours)"),
};
array_each_(i, omitData)
{
- m_Options.addComboItem(m_hOmitByValueData, i18n(omitData[i]));
+ m_Options.addComboItem(m_hOmitByValueData, TranslateTS(omitData[i]));
}
m_Options.ensureVisible(NULL);
@@ -338,13 +333,9 @@ void DlgOption::SubOutput::saveSettings()
void DlgOption::SubOutput::onChanged(HANDLE hItem)
{
if (hItem == m_hSortBy[1])
- {
m_Options.enableItem(m_hSortBy[2], m_Options.getComboSelected(m_hSortBy[1]) != 0);
- }
else if (hItem == m_hCalcTotals || hItem == m_hOmitContacts)
- {
m_Options.enableItem(m_hOmittedInTotals, m_Options.isItemChecked(m_hCalcTotals) && m_Options.isItemChecked(m_hOmitContacts));
- }
getParent()->settingsChanged();
}
diff --git a/plugins/HistoryStats/src/iconlib.cpp b/plugins/HistoryStats/src/iconlib.cpp
index 3647205764..3b7fe5d035 100644
--- a/plugins/HistoryStats/src/iconlib.cpp
+++ b/plugins/HistoryStats/src/iconlib.cpp
@@ -8,30 +8,30 @@ bool IconLib::m_bIcoLibAvailable = false;
HANDLE IconLib::m_hHookSkin2IconsChanged = NULL;
IconLib::IconInfo IconLib::m_IconInfo[] = {
- { IDI_HISTORYSTATS , muA("main_menu") , NULL , I18N(muT("Create statistics (main menu)")) },
- { IDI_HISTORYSTATS , muA("menu_show") , NULL , I18N(muT("Show statistics (main menu)")) },
- { IDI_HISTORYSTATS , muA("menu_config") , NULL , I18N(muT("Configure... (main menu)")) },
- { IDI_HISTORYSTATS , muA("contact_menu") , NULL , I18N(muT("Contact menu")) },
- { IDI_EXCLUDE_NO , muA("exclude_no") , NULL , I18N(muT("Unexcluded contacts")) },
- { IDI_EXCLUDE_YES , muA("exclude_yes") , NULL , I18N(muT("Excluded contacts")) },
- { IDI_TREE_CHECK1 , muA("tree_check1") , I18N(muT("Options tree")), I18N(muT("Checkbox")) },
- { IDI_TREE_CHECK2 , muA("tree_check2") , I18N(muT("Options tree")), I18N(muT("Checkbox (checked)")) },
- { IDI_TREE_CHECK3 , muA("tree_check3") , I18N(muT("Options tree")), I18N(muT("Checkbox (disabled)")) },
- { IDI_TREE_CHECK4 , muA("tree_check4") , I18N(muT("Options tree")), I18N(muT("Checkbox (checked & disabled)")) },
- { IDI_TREE_RADIO1 , muA("tree_radio1") , I18N(muT("Options tree")), I18N(muT("Radio button")) },
- { IDI_TREE_RADIO2 , muA("tree_radio2") , I18N(muT("Options tree")), I18N(muT("Radio button (checked)")) },
- { IDI_TREE_RADIO3 , muA("tree_radio3") , I18N(muT("Options tree")), I18N(muT("Radio button (disabled)")) },
- { IDI_TREE_RADIO4 , muA("tree_radio4") , I18N(muT("Options tree")), I18N(muT("Radio button (checked & disabled)")) },
- { IDI_TREE_EDIT1 , muA("tree_edit1") , I18N(muT("Options tree")), I18N(muT("Edit control")) },
- { IDI_TREE_EDIT2 , muA("tree_edit2") , I18N(muT("Options tree")), I18N(muT("Edit control (disabled)")) },
- { IDI_TREE_COMBO1 , muA("tree_combo1") , I18N(muT("Options tree")), I18N(muT("Combo box")) },
- { IDI_TREE_COMBO2 , muA("tree_combo2") , I18N(muT("Options tree")), I18N(muT("Combo box (disabled)")) },
- { IDI_TREE_FOLDER1 , muA("tree_folder1") , I18N(muT("Options tree")), I18N(muT("Folder")) },
- { IDI_TREE_FOLDER2 , muA("tree_folder2") , I18N(muT("Options tree")), I18N(muT("Folder (disabled)")) },
- { IDI_TREE_BUTTON1 , muA("tree_button1") , I18N(muT("Options tree")), I18N(muT("Button")) },
- { IDI_TREE_BUTTON2 , muA("tree_button2") , I18N(muT("Options tree")), I18N(muT("Button (disabled)")) },
- { IDI_TREE_DATETIME1, muA("tree_datetime1"), I18N(muT("Options tree")), I18N(muT("Date/time picker")) },
- { IDI_TREE_DATETIME2, muA("tree_datetime2"), I18N(muT("Options tree")), I18N(muT("Date/time picker (disabled)")) },
+ { IDI_HISTORYSTATS , "main_menu" , NULL, LPGENT("Create statistics (main menu)") },
+ { IDI_HISTORYSTATS , "menu_show" , NULL, LPGENT("Show statistics (main menu)") },
+ { IDI_HISTORYSTATS , "menu_config" , NULL, LPGENT("Configure... (main menu)") },
+ { IDI_HISTORYSTATS , "contact_menu" , NULL, LPGENT("Contact menu") },
+ { IDI_EXCLUDE_NO , "exclude_no" , NULL, LPGENT("Unexcluded contacts") },
+ { IDI_EXCLUDE_YES , "exclude_yes" , NULL, LPGENT("Excluded contacts") },
+ { IDI_TREE_CHECK1 , "tree_check1" , LPGENT("Options tree"), LPGENT("Checkbox") },
+ { IDI_TREE_CHECK2 , "tree_check2" , LPGENT("Options tree"), LPGENT("Checkbox (checked)") },
+ { IDI_TREE_CHECK3 , "tree_check3" , LPGENT("Options tree"), LPGENT("Checkbox (disabled)") },
+ { IDI_TREE_CHECK4 , "tree_check4" , LPGENT("Options tree"), LPGENT("Checkbox (checked & disabled)") },
+ { IDI_TREE_RADIO1 , "tree_radio1" , LPGENT("Options tree"), LPGENT("Radio button") },
+ { IDI_TREE_RADIO2 , "tree_radio2" , LPGENT("Options tree"), LPGENT("Radio button (checked)") },
+ { IDI_TREE_RADIO3 , "tree_radio3" , LPGENT("Options tree"), LPGENT("Radio button (disabled)") },
+ { IDI_TREE_RADIO4 , "tree_radio4" , LPGENT("Options tree"), LPGENT("Radio button (checked & disabled)") },
+ { IDI_TREE_EDIT1 , "tree_edit1" , LPGENT("Options tree"), LPGENT("Edit control") },
+ { IDI_TREE_EDIT2 , "tree_edit2" , LPGENT("Options tree"), LPGENT("Edit control (disabled)") },
+ { IDI_TREE_COMBO1 , "tree_combo1" , LPGENT("Options tree"), LPGENT("Combo box") },
+ { IDI_TREE_COMBO2 , "tree_combo2" , LPGENT("Options tree"), LPGENT("Combo box (disabled)") },
+ { IDI_TREE_FOLDER1 , "tree_folder1" , LPGENT("Options tree"), LPGENT("Folder") },
+ { IDI_TREE_FOLDER2 , "tree_folder2" , LPGENT("Options tree"), LPGENT("Folder (disabled)") },
+ { IDI_TREE_BUTTON1 , "tree_button1" , LPGENT("Options tree"), LPGENT("Button") },
+ { IDI_TREE_BUTTON2 , "tree_button2" , LPGENT("Options tree"), LPGENT("Button (disabled)") },
+ { IDI_TREE_DATETIME1, "tree_datetime1", LPGENT("Options tree"), LPGENT("Date/time picker") },
+ { IDI_TREE_DATETIME2, "tree_datetime2", LPGENT("Options tree"), LPGENT("Date/time picker (disabled)") },
};
ext::string IconLib::m_Section;
@@ -55,42 +55,37 @@ void IconLib::init()
m_IconInfo[i].hIcon = NULL;
}
- if (m_bIcoLibAvailable = mu::icolib::_available())
- {
+ if (m_bIcoLibAvailable = mu::icolib::_available()) {
bool bIcoLibTested = false;
- mu_ansi szModule[MAX_PATH];
+ char szModule[MAX_PATH];
GetModuleFileNameA(g_hInst, szModule, MAX_PATH);
- m_Section = muT("HistoryStats");
- m_IconName = muA("historystats_");
+ m_Section = _T("HistoryStats");
+ m_IconName = "historystats_";
array_each_(i, m_IconInfo)
{
ext::string strSection = m_Section;
- if (m_IconInfo[i].szSection)
- {
- strSection += muT("/");
- strSection += i18n(m_IconInfo[i].szSection);
+ if (m_IconInfo[i].szSection) {
+ strSection += _T("/");
+ strSection += TranslateTS(m_IconInfo[i].szSection);
}
mu::icolib::addIcon(
strSection.c_str(),
- i18n(m_IconInfo[i].szDescription),
+ TranslateTS(m_IconInfo[i].szDescription),
(m_IconName + m_IconInfo[i].szIconName).c_str(),
szModule,
-m_IconInfo[i].wID);
- if (!bIcoLibTested)
- {
+ if (!bIcoLibTested) {
bIcoLibTested = true;
- if (!getIcon(static_cast<IconIndex>(i)))
- {
+ if (!getIcon(static_cast<IconIndex>(i))) {
m_bIcoLibAvailable = false;
-
break;
}
}
@@ -99,8 +94,7 @@ void IconLib::init()
m_hHookSkin2IconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, handleCallbacks);
}
- if (!m_bIcoLibAvailable)
- {
+ if (!m_bIcoLibAvailable) {
array_each_(i, m_IconInfo)
{
m_IconInfo[i].hIcon = reinterpret_cast<HICON>(LoadImage(
@@ -128,8 +122,7 @@ void IconLib::uninit()
{
array_each_(i, m_IconInfo)
{
- if (m_IconInfo[i].hIcon)
- {
+ if (m_IconInfo[i].hIcon) {
DestroyIcon(m_IconInfo[i].hIcon);
m_IconInfo[i].hIcon = NULL;
}
@@ -139,11 +132,7 @@ void IconLib::uninit()
HICON IconLib::getIcon(IconIndex index)
{
if (m_bIcoLibAvailable)
- {
return mu::icolib::getIcon((m_IconName + m_IconInfo[index].szIconName).c_str());
- }
- else
- {
- return m_IconInfo[index].hIcon;
- }
+
+ return m_IconInfo[index].hIcon;
}
diff --git a/plugins/HistoryStats/src/iconlib.h b/plugins/HistoryStats/src/iconlib.h
index bc4ab3b1c7..94180e939e 100644
--- a/plugins/HistoryStats/src/iconlib.h
+++ b/plugins/HistoryStats/src/iconlib.h
@@ -43,9 +43,9 @@ private:
struct IconInfo
{
WORD wID;
- mu_ansi* szIconName;
- mu_text* szSection;
- mu_text* szDescription;
+ char* szIconName;
+ TCHAR* szSection;
+ TCHAR* szDescription;
HICON hIcon;
};
diff --git a/plugins/HistoryStats/src/main.cpp b/plugins/HistoryStats/src/main.cpp
index 6250d5af43..8d0d5470e4 100644
--- a/plugins/HistoryStats/src/main.cpp
+++ b/plugins/HistoryStats/src/main.cpp
@@ -8,7 +8,6 @@
#include "column.h"
#include "bandctrlimpl.h"
#include "optionsctrlimpl.h"
-#include "themeapi.h"
#include "iconlib.h"
#include "dlgconfigure.h"
@@ -140,11 +139,9 @@ static INT_PTR MenuShowStatistics(WPARAM wParam, LPARAM lParam)
}
else
{
- MessageBox(
- 0,
- i18n(muT("The statistics can't be found. Either you never created them or the last created statistics were moved to a different location and can't be found anymore.")),
- i18n(muT("HistoryStats - Warning")),
- MB_ICONWARNING | MB_OK);
+ MessageBox(NULL,
+ TranslateT("The statistics can't be found. Either you never created them or the last created statistics were moved to a different location and can't be found anymore."),
+ TranslateT("HistoryStats - Warning"), MB_ICONWARNING | MB_OK);
}
return 0;
@@ -172,30 +169,30 @@ void AddMainMenu()
CreateServiceFunction(con::SvcConfigure, MenuConfigure);
g_hMenuCreateStatistics = mu::clist::addMainMenuItem(
- I18N(muT("Create statistics")), // MEMO: implicit translation
+ LPGENT("Create statistics"), // MEMO: implicit translation
0,
1910000000,
IconLib::getIcon(IconLib::iiMenuCreateStatistics),
con::SvcCreateStatistics,
- bInPopup ? I18N(muT("Statistics")) : NULL, // MEMO: implicit translation
+ bInPopup ? LPGENT("Statistics") : NULL, // MEMO: implicit translation
bInPopup ? 1910000000 : 0);
g_hMenuShowStatistics = mu::clist::addMainMenuItem(
- I18N(muT("Show statistics")), // MEMO: implicit translation
+ LPGENT("Show statistics"), // MEMO: implicit translation
0,
1910000001,
IconLib::getIcon(IconLib::iiMenuShowStatistics),
con::SvcShowStatistics,
- bInPopup ? I18N(muT("Statistics")) : NULL, // MEMO: implicit translation
+ bInPopup ? LPGENT("Statistics") : NULL, // MEMO: implicit translation
bInPopup ? 1910000000 : 0);
g_hMenuConfigure = mu::clist::addMainMenuItem(
- bInPopup ? I18N(muT("Configure...")) : I18N(muT("Configure statistics...")), // MEMO: implicit translation
+ bInPopup ? LPGENT("Configure...") : LPGENT("Configure statistics..."), // MEMO: implicit translation
0,
1910000002,
IconLib::getIcon(IconLib::iiMenuConfigure),
con::SvcConfigure,
- bInPopup ? I18N(muT("Statistics")) : NULL, // MEMO: implicit translation
+ bInPopup ? LPGENT("Statistics") : NULL, // MEMO: implicit translation
bInPopup ? 1910000000 : 0);
}
@@ -238,13 +235,13 @@ static INT_PTR MenuHistoryPaste(WPARAM wParam, LPARAM lParam)
}
// ask user if this is really what he wants
- ext::string strConfirm = ext::str(ext::kformat(i18n(muT("You're going to copy the complete history of #{source_name} (#{source_proto}) to #{target_name} (#{target_proto}). Afterwards, the target history will contain entries from both histories. There is no way to revert this operation. Be careful! This is a rather big operation and has the potential to damage your database. Be sure to have a backup of this database before performing this operation.\r\n\r\nAre you sure you would like to continue?")))
- % muT("#{source_name}") * mu::clist::getContactDisplayName(g_hHistoryCopyContact)
- % muT("#{source_proto}") * utils::fromA(GetContactProto(g_hHistoryCopyContact))
- % muT("#{target_name}") * mu::clist::getContactDisplayName(hTarget)
- % muT("#{target_proto}") * utils::fromA(GetContactProto(hTarget)));
+ ext::string strConfirm = ext::str(ext::kformat(TranslateT("You're going to copy the complete history of #{source_name} (#{source_proto}) to #{target_name} (#{target_proto}). Afterwards, the target history will contain entries from both histories. There is no way to revert this operation. Be careful! This is a rather big operation and has the potential to damage your database. Be sure to have a backup of this database before performing this operation.\r\n\r\nAre you sure you would like to continue?")))
+ % _T("#{source_name}") * mu::clist::getContactDisplayName(g_hHistoryCopyContact)
+ % _T("#{source_proto}") * utils::fromA(GetContactProto(g_hHistoryCopyContact))
+ % _T("#{target_name}") * mu::clist::getContactDisplayName(hTarget)
+ % _T("#{target_proto}") * utils::fromA(GetContactProto(hTarget)));
- if (MessageBox(0, strConfirm.c_str(), i18n(muT("HistoryStats - Confirm")), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2) != IDYES)
+ if (MessageBox(0, strConfirm.c_str(), TranslateT("HistoryStats - Confirm")), MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2) != IDYES)
{
return 0;
}
@@ -292,12 +289,12 @@ static INT_PTR MenuHistoryPaste(WPARAM wParam, LPARAM lParam)
mu::db::setSafetyMode(true);
// output summary
- ext::string strSummary = ext::str(ext::kformat(i18n(muT("Successfully read #{success} events of which #{fail_add} couldn't be added to the target history. #{fail} events couldn't be read from the source history.")))
- % muT("#{success}") * dwCountSuccess
- % muT("#{fail}") * dwCountFailRead
- % muT("#{fail_add}") * dwCountFailAdd);
+ ext::string strSummary = ext::str(ext::kformat(TranslateT("Successfully read #{success} events of which #{fail_add} couldn't be added to the target history. #{fail} events couldn't be read from the source history.")))
+ % _T("#{success}") * dwCountSuccess
+ % _T("#{fail}") * dwCountFailRead
+ % _T("#{fail_add}") * dwCountFailAdd);
- MessageBox(0, strSummary.c_str(), i18n(muT("HistoryStats - Information")), MB_ICONINFORMATION);
+ MessageBox(0, strSummary.c_str(), TranslateT("HistoryStats - Information")), MB_ICONINFORMATION);
g_hHistoryCopyContact = NULL;
@@ -309,17 +306,15 @@ static int EventPreBuildContactMenu(WPARAM hContact, LPARAM lParam)
{
if (hContact)
{
- const mu_ansi* szProto = GetContactProto(hContact);
+ const char* szProto = GetContactProto(hContact);
if ((!g_pSettings->m_ShowContactMenuPseudo && (!szProto || !(mu::protosvc::getCaps(szProto, PFLAGNUM_2) & ~mu::protosvc::getCaps(szProto, PFLAGNUM_5)))) ||
g_pSettings->m_HideContactMenuProtos.find(szProto) != g_pSettings->m_HideContactMenuProtos.end())
{
mu::clist::modifyMenuItem(g_hMenuToggleExclude, CMIM_FLAGS, NULL, CMIF_HIDDEN);
}
- else
- {
+ else {
MirandaSettings db;
-
db.setContact(hContact);
db.setModule(con::ModHistoryStats);
@@ -327,9 +322,7 @@ static int EventPreBuildContactMenu(WPARAM hContact, LPARAM lParam)
// avoid collision with options page
if (g_bExcludeLock)
- {
menuState |= CMIF_GRAYED;
- }
// set menu state
mu::clist::modifyMenuItem(g_hMenuToggleExclude, CMIM_FLAGS, NULL, menuState);
@@ -355,7 +348,7 @@ void AddContactMenu()
CreateServiceFunction(con::SvcToggleExclude, MenuToggleExclude);
g_hMenuToggleExclude = mu::clist::addContactMenuItem(
- I18N(muT("Exclude from statistics")), // MEMO: implicit translation
+ LPGENT("Exclude from statistics"), // MEMO: implicit translation
0,
800000,
IconLib::getIcon(IconLib::iiContactMenu),
@@ -366,14 +359,14 @@ void AddContactMenu()
CreateServiceFunction(con::SvcHistoryPaste, MenuHistoryPaste);
g_hMenuHistoryCopy = mu::clist::addContactMenuItem(
- I18N(muT("Copy history")), // MEMO: implicit translation
+ LPGENT("Copy history")), // MEMO: implicit translation
0,
800001,
NULL,
con::SvcHistoryCopy);
g_hMenuHistoryPaste = mu::clist::addContactMenuItem(
- I18N(muT("Paste history...")), // MEMO: implicit translation
+ LPGENT("Paste history...")), // MEMO: implicit translation
0,
800002,
NULL,
@@ -391,8 +384,8 @@ static int EventOptInitialise(WPARAM wParam, LPARAM lParam)
{
mu::opt::addPage(
wParam,
- i18n(muT("History")),
- i18n(muT("Statistics")),
+ TranslateT("History"),
+ TranslateT("Statistics"),
NULL,
DlgOption::staticDlgProc,
MAKEINTRESOURCEA(IDD_OPTIONS),
@@ -427,9 +420,7 @@ static int EventModulesLoaded(WPARAM wParam, LPARAM lParam)
// create statistics on startup, if activated
if (g_pSettings->m_OnStartup)
- {
Statistic::run(*g_pSettings, Statistic::fromStartup, g_hInst);
- }
return 0;
}
@@ -440,19 +431,11 @@ static int EventModulesLoaded(WPARAM wParam, LPARAM lParam)
extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
- switch (fdwReason)
- {
- case DLL_PROCESS_ATTACH:
- {
- DisableThreadLibraryCalls(hinstDLL);
- g_hInst = hinstDLL;
-
-#if defined(_DEBUG)
- // dump memory leak report at end of program
- _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
-#endif
- }
- break;
+ switch (fdwReason) {
+ case DLL_PROCESS_ATTACH:
+ DisableThreadLibraryCalls(hinstDLL);
+ g_hInst = hinstDLL;
+ break;
}
return TRUE;
@@ -460,7 +443,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvRe
extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
- OutputDebugString(muT("HistoryStats: MirandaPluginInfoEx() was called.\n"));
+ OutputDebugString(_T("HistoryStats: MirandaPluginInfoEx() was called.\n"));
// MEMO: (don't) fail, if version is below minimum
return &g_pluginInfoEx;
@@ -468,9 +451,6 @@ extern "C" __declspec(dllexport) const PLUGININFOEX* MirandaPluginInfoEx(DWORD m
extern "C" __declspec(dllexport) int Load()
{
- // init themeing api
- ThemeAPI::init();
-
// init COM, needed for GUID generation
CoInitialize(NULL);
@@ -479,8 +459,8 @@ extern "C" __declspec(dllexport) int Load()
{
MessageBox(
0,
- muT("Failed to register a required window class. Can't continue loading plugin."),
- muT("HistoryStats - Error"),
+ _T("Failed to register a required window class. Can't continue loading plugin."),
+ _T("HistoryStats - Error"),
MB_OK | MB_ICONERROR);
return 1;
@@ -491,11 +471,11 @@ extern "C" __declspec(dllexport) int Load()
{
MessageBox(
0,
- muT("This version of HistoryStats isn't compatible with your Miranda IM ")
- muT("version. Possibly, your Miranda IM is outdated or you are trying to ")
- muT("use the Unicode version with a non-Unicode Miranda IM.\r\n\r\n")
- muT("Please go to the plugin's homepage and check the requirements."),
- muT("HistoryStats - Error"),
+ _T("This version of HistoryStats isn't compatible with your Miranda IM ")
+ _T("version. Possibly, your Miranda IM is outdated or you are trying to ")
+ _T("use the Unicode version with a non-Unicode Miranda IM.\r\n\r\n")
+ _T("Please go to the plugin's homepage and check the requirements."),
+ _T("HistoryStats - Error"),
MB_OK | MB_ICONERROR);
return 1;
@@ -541,9 +521,5 @@ extern "C" __declspec(dllexport) int Unload()
// uninit COM, needed for GUID generation
CoUninitialize();
-
- // free themeing api
- ThemeAPI::uninit();
-
return 0;
}
diff --git a/plugins/HistoryStats/src/message.cpp b/plugins/HistoryStats/src/message.cpp
index b72f92bfda..505d1b8e87 100644
--- a/plugins/HistoryStats/src/message.cpp
+++ b/plugins/HistoryStats/src/message.cpp
@@ -9,61 +9,49 @@
void Message::makeRawAvailable()
{
- do
- {
-#if defined(MU_WIDE)
- if (m_Available & PtrIsNonT)
- {
- m_Raw = utils::fromA(ext::a::string(reinterpret_cast<const mu_ansi*>(m_RawSource), m_nLength));
+ do {
+ if (m_Available & PtrIsNonT) {
+ m_Raw = utils::fromA(ext::a::string(reinterpret_cast<const char*>(m_RawSource), m_nLength));
m_Available |= Raw;
-
break;
}
-#endif // MU_WIDE
- if (m_Available & PtrIsUTF8)
- {
- m_Raw = utils::fromUTF8(reinterpret_cast<const mu_ansi*>(m_RawSource));
+ if (m_Available & PtrIsUTF8) {
+ m_Raw = utils::fromUTF8(reinterpret_cast<const char*>(m_RawSource));
m_Available |= Raw;
-
break;
}
- m_Raw.assign(reinterpret_cast<const mu_text*>(m_RawSource), m_nLength);
+ m_Raw.assign(reinterpret_cast<const TCHAR*>(m_RawSource), m_nLength);
m_Available |= Raw;
- } while(false);
+ }
+ while (false);
if (m_bStripRawRTF)
- {
stripRawRTF();
- }
if (m_bStripBBCodes)
- {
stripBBCodes();
- }
}
void Message::stripRawRTF()
{
- if (m_Raw.substr(0, 6) == muT("{\\rtf1"))
- {
+ if (m_Raw.substr(0, 6) == _T("{\\rtf1"))
m_Raw = RTFFilter::filter(m_Raw);
- }
}
void Message::stripBBCodes()
{
- static const mu_text* szSimpleBBCodes[][2] = {
- { muT("[b]"), muT("[/b]") },
- { muT("[u]"), muT("[/u]") },
- { muT("[i]"), muT("[/i]") },
- { muT("[s]"), muT("[/s]") },
+ static const TCHAR* szSimpleBBCodes[][2] = {
+ { _T("[b]"), _T("[/b]") },
+ { _T("[u]"), _T("[/u]") },
+ { _T("[i]"), _T("[/i]") },
+ { _T("[s]"), _T("[/s]") },
};
- static const mu_text* szParamBBCodes[][2] = {
- { muT("[url=") , muT("[/url]") },
- { muT("[color="), muT("[/color]") },
+ static const TCHAR* szParamBBCodes[][2] = {
+ { _T("[url="), _T("[/url]") },
+ { _T("[color="), _T("[/color]") },
};
// convert raw string to lower case
@@ -72,26 +60,21 @@ void Message::stripBBCodes()
// remove simple BBcodes
array_each_(i, szSimpleBBCodes)
{
- const mu_text* szOpenTag = szSimpleBBCodes[i][0];
- const mu_text* szCloseTag = szSimpleBBCodes[i][1];
+ const TCHAR* szOpenTag = szSimpleBBCodes[i][0];
+ const TCHAR* szCloseTag = szSimpleBBCodes[i][1];
int lenOpen = ext::strfunc::len(szOpenTag);
int lenClose = ext::strfunc::len(szCloseTag);
-
+
ext::string::size_type posOpen = 0;
ext::string::size_type posClose = 0;
- while (true)
- {
+ while (true) {
if ((posOpen = strRawLC.find(szOpenTag, posOpen)) == ext::string::npos)
- {
break;
- }
if ((posClose = strRawLC.find(szCloseTag, posOpen + lenOpen)) == ext::string::npos)
- {
break;
- }
strRawLC.erase(posOpen, lenOpen);
strRawLC.erase(posClose - lenOpen, lenClose);
@@ -105,32 +88,25 @@ void Message::stripBBCodes()
// remove BBcodes with parameters
array_each_(i, szParamBBCodes)
{
- const mu_text* szOpenTag = szParamBBCodes[i][0];
- const mu_text* szCloseTag = szParamBBCodes[i][1];
-
+ const TCHAR* szOpenTag = szParamBBCodes[i][0];
+ const TCHAR* szCloseTag = szParamBBCodes[i][1];
+
int lenOpen = ext::strfunc::len(szOpenTag);
int lenClose = ext::strfunc::len(szCloseTag);
-
+
ext::string::size_type posOpen = 0;
ext::string::size_type posOpen2 = 0;
ext::string::size_type posClose = 0;
- while (true)
- {
+ while (true) {
if ((posOpen = strRawLC.find(szOpenTag, posOpen)) == ext::string::npos)
- {
break;
- }
- if ((posOpen2 = strRawLC.find(muC(']'), posOpen + lenOpen)) == ext::string::npos)
- {
+ if ((posOpen2 = strRawLC.find(']', posOpen + lenOpen)) == ext::string::npos)
break;
- }
if ((posClose = strRawLC.find(szCloseTag, posOpen2 + 1)) == ext::string::npos)
- {
break;
- }
strRawLC.erase(posOpen, posOpen2 - posOpen + 1);
strRawLC.erase(posClose - posOpen2 + posOpen - 1, lenClose);
@@ -144,11 +120,11 @@ void Message::stripBBCodes()
void Message::filterLinks()
{
- static const mu_text* szSpaces = muT(" \r\r\n");
- static const mu_text* szPrefixes = muT("([{<:\"'");
- static const mu_text* szSuffixes = muT(".,:;!?)]}>\"'");
- static const mu_text* szValidProtocol = muT("abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- static const mu_text* szValidHost = muT(".-abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ static const TCHAR* szSpaces = _T(" \r\r\n");
+ static const TCHAR* szPrefixes = _T("([{<:\"'");
+ static const TCHAR* szSuffixes = _T(".,:;!?)]}>\"'");
+ static const TCHAR* szValidProtocol = _T("abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+ static const TCHAR* szValidHost = _T(".-abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
// init with raw text
m_WithoutLinks = getRaw();
@@ -157,20 +133,16 @@ void Message::filterLinks()
ext::string::size_type pos = -1;
// detect: protocol://[user[:password]@]host[/path]
- while (true)
- {
- if ((pos = msg.find(muT("://"), pos + 1)) == ext::string::npos)
- {
+ while (true) {
+ if ((pos = msg.find(_T("://"), pos + 1)) == ext::string::npos)
break;
- }
// find start of URL
ext::string::size_type pos_proto = msg.find_last_not_of(szValidProtocol, pos - 1);
(pos_proto == ext::string::npos) ? pos_proto = 0 : ++pos_proto;
- if (pos_proto < pos)
- {
+ if (pos_proto < pos) {
// find end of URL
ext::string::size_type pos_last = msg.find_first_of(szSpaces, pos + 3);
@@ -178,35 +150,26 @@ void Message::filterLinks()
// filter suffixes (punctuation, parentheses, ...)
if (ext::strfunc::chr(szSuffixes, msg[pos_last]))
- {
--pos_last;
- }
// find slash: for host name validation
- ext::string::size_type pos_slash = msg.find(muC('/'), pos + 3);
+ ext::string::size_type pos_slash = msg.find('/', pos + 3);
if (pos_slash == ext::string::npos || pos_slash > pos_last)
- {
pos_slash = pos_last + 1;
- }
// find at: for host name validation
- ext::string::size_type pos_at = msg.find(muC('@'), pos + 3);
+ ext::string::size_type pos_at = msg.find('@', pos + 3);
if (pos_at == ext::string::npos || pos_at > pos_slash)
- {
pos_at = pos + 2;
- }
// check for valid host (x.x)
- if (pos_slash - pos_at > 3)
- {
+ if (pos_slash - pos_at > 3) {
ext::string::size_type pos_invalid = msg.find_first_not_of(szValidHost, pos_at + 1);
- if (pos_invalid == ext::string::npos || pos_invalid >= pos_slash)
- {
- if (std::count(msg.begin() + pos_at + 1, msg.begin() + pos_slash, muC('.')) >= 1)
- {
+ if (pos_invalid == ext::string::npos || pos_invalid >= pos_slash) {
+ if (std::count(msg.begin() + pos_at + 1, msg.begin() + pos_slash, '.') >= 1) {
ext::string link = msg.substr(pos_proto, pos_last - pos_proto + 1);
// remove extracted link from message text
@@ -219,16 +182,13 @@ void Message::filterLinks()
}
}
}
-
+
// detect: www.host[/path]
pos = -1;
- while (true)
- {
- if ((pos = msg.find(muT("www."), pos + 1)) == ext::string::npos)
- {
+ while (true) {
+ if ((pos = msg.find(_T("www."), pos + 1)) == ext::string::npos)
break;
- }
// find end of URL
ext::string::size_type pos_last = msg.find_first_of(szSpaces, pos + 4);
@@ -237,31 +197,24 @@ void Message::filterLinks()
// filter suffixes (punctuation, parentheses, ...)
if (ext::strfunc::chr(szSuffixes, msg[pos_last]))
- {
--pos_last;
- }
// find slash: for host name validation
- ext::string::size_type pos_slash = msg.find(muC('/'), pos + 4);
+ ext::string::size_type pos_slash = msg.find('/', pos + 4);
if (pos_slash == ext::string::npos || pos_slash > pos_last)
- {
pos_slash = pos_last + 1;
- }
// find at: for host name validation
ext::string::size_type pos_at = pos + 3;
// check for valid host (x.x)
- if (pos_slash - pos_at > 3)
- {
+ if (pos_slash - pos_at > 3) {
ext::string::size_type pos_invalid = msg.find_first_not_of(szValidHost, pos_at + 1);
- if (pos_invalid == ext::string::npos || pos_invalid >= pos_slash)
- {
- if (std::count(msg.begin() + pos_at + 1, msg.begin() + pos_slash, muC('.')) >= 1)
- {
- ext::string link = muT("http://") + msg.substr(pos, pos_last - pos + 1);
+ if (pos_invalid == ext::string::npos || pos_invalid >= pos_slash) {
+ if (std::count(msg.begin() + pos_at + 1, msg.begin() + pos_slash, '.') >= 1) {
+ ext::string link = _T("http://") + msg.substr(pos, pos_last - pos + 1);
// remove extracted link from message text
msg.erase(pos, link.length() - 7);
@@ -276,15 +229,11 @@ void Message::filterLinks()
// detect: user@host
pos = -1;
- while (true)
- {
- if ((pos = msg.find(muC('@'), pos + 1)) == ext::string::npos)
- {
+ while (true) {
+ if ((pos = msg.find('@', pos + 1)) == ext::string::npos)
break;
- }
- if (pos > 0 && pos < msg.length() - 1)
- {
+ if (pos > 0 && pos < msg.length() - 1) {
// find end of address
ext::string::size_type pos_last = msg.find_first_not_of(szValidHost, pos + 1);
@@ -292,9 +241,7 @@ void Message::filterLinks()
// filter suffixes (punctuation, parentheses, ...)
if (ext::strfunc::chr(szSuffixes, msg[pos_last]))
- {
--pos_last;
- }
// find start of address
ext::string::size_type pos_first = msg.find_last_of(szSpaces, pos - 1);
@@ -303,15 +250,11 @@ void Message::filterLinks()
// filter prefixes (punctuation, parentheses, ...)
if (ext::strfunc::chr(szPrefixes, msg[pos_first]))
- {
++pos_first;
- }
// check for valid host (x.x)
- if (pos_first < pos && pos_last - pos >= 3)
- {
- if (std::count(msg.begin() + pos + 1, msg.begin() + pos_last + 1, muC('.')) >= 1)
- {
+ if (pos_first < pos && pos_last - pos >= 3) {
+ if (std::count(msg.begin() + pos + 1, msg.begin() + pos_last + 1, '.') >= 1) {
ext::string link = msg.substr(pos_first, pos_last - pos_first + 1);
// remove extracted link from message text
@@ -319,9 +262,8 @@ void Message::filterLinks()
pos = pos_last - (link.length());
// prepend "mailto:" if missing
- if (link.substr(0, 7) != muT("mailto:"))
- {
- link.insert(0, muT("mailto:"));
+ if (link.substr(0, 7) != _T("mailto:")) {
+ link.insert(0, _T("mailto:"));
}
// TODO: put link in list
diff --git a/plugins/HistoryStats/src/message.h b/plugins/HistoryStats/src/message.h
index fe239c5be4..5d4cd97d99 100644
--- a/plugins/HistoryStats/src/message.h
+++ b/plugins/HistoryStats/src/message.h
@@ -57,23 +57,23 @@ public:
m_Timestamp = localTimestamp;
}
- void assignText(const mu_text* msg, ext::string::size_type len)
+ void assignText(const TCHAR* msg, ext::string::size_type len)
{
m_RawSource = msg;
m_nLength = len;
m_Available = 0;
}
-#if defined(MU_WIDE)
- void assignText(const mu_ansi* msg, ext::string::size_type len)
+#if defined(_UNICODE)
+ void assignText(const char* msg, ext::string::size_type len)
{
m_RawSource = msg;
m_nLength = len;
m_Available = PtrIsNonT;
}
-#endif // MU_WIDE
+#endif // _UNICODE
- void assignTextFromUTF8(const mu_ansi* msg, ext::string::size_type len)
+ void assignTextFromUTF8(const char* msg, ext::string::size_type len)
{
m_RawSource = msg;
m_nLength = len;
diff --git a/plugins/HistoryStats/src/mirandacontact.cpp b/plugins/HistoryStats/src/mirandacontact.cpp
index 367a36fb4e..ee967f1065 100644
--- a/plugins/HistoryStats/src/mirandacontact.cpp
+++ b/plugins/HistoryStats/src/mirandacontact.cpp
@@ -14,12 +14,10 @@ void MirandaContact::fetchSlot(int i)
{
ContactInfo& ci = m_CIs[i];
- if (!ci.hEvent)
- {
+ if (!ci.hEvent) {
free(ci.ei.dbe.pBlob);
m_CIs.erase(m_CIs.begin() + i);
-
return;
}
@@ -29,8 +27,7 @@ void MirandaContact::fetchSlot(int i)
ei.dbe.cbBlob = db_event_getBlobSize(ci.hEvent);
ei.dbe.cbSize = sizeof(ei.dbe);
- if (ei.dbe.cbBlob > ei.nAllocated)
- {
+ if (ei.dbe.cbBlob > ei.nAllocated) {
ei.nAllocated = ei.dbe.cbBlob;
ei.dbe.pBlob = reinterpret_cast<PBYTE>(realloc(ei.dbe.pBlob, ei.dbe.cbBlob + 1));
}
@@ -44,39 +41,32 @@ void MirandaContact::fetchSlot(int i)
void MirandaContact::stripMetaID(DBEVENTINFO& dbe)
{
- if (dbe.szModule == META_PROTO)
- {
- mu_ansi* pTextBegin = reinterpret_cast<mu_ansi*>(dbe.pBlob);
+ if (dbe.szModule == META_PROTO) {
+ char* pTextBegin = reinterpret_cast<char*>(dbe.pBlob);
- if (dbe.cbBlob >= 6 && !pTextBegin[dbe.cbBlob - 1])
- {
- mu_ansi* pIDEnd = pTextBegin + dbe.cbBlob - 1;
- mu_ansi* pIDBegin = pIDEnd;
- mu_ansi* pIDSep = NULL;
+ if (dbe.cbBlob >= 6 && !pTextBegin[dbe.cbBlob - 1]) {
+ char* pIDEnd = pTextBegin + dbe.cbBlob - 1;
+ char* pIDBegin = pIDEnd;
+ char* pIDSep = NULL;
while (pIDBegin >= pTextBegin + 2 && *--pIDBegin)
- {
- if (*pIDBegin == muC('*'))
- {
+ if (*pIDBegin == '*')
pIDSep = pIDBegin;
- }
- }
++pIDBegin;
- if (pIDSep && pIDBegin < pIDSep && !*(pIDBegin - 1))
- {
+ if (pIDSep && pIDBegin < pIDSep && !*(pIDBegin - 1)) {
dbe.cbBlob = pIDBegin - pTextBegin;
}
}
}
}
-MirandaContact::MirandaContact(const ext::string& strNick, const ext::string& strProtocol, const ext::string& strGroup, const SourceHandles& sources)
- : m_strNick(strNick)
- , m_strProtocol(strProtocol)
- , m_strGroup(strGroup)
- , m_Sources(sources)
+MirandaContact::MirandaContact(const ext::string& strNick, const ext::string& strProtocol, const ext::string& strGroup, const SourceHandles& sources) :
+ m_strNick(strNick),
+ m_strProtocol(strProtocol),
+ m_strGroup(strGroup),
+ m_Sources(sources)
{
}
@@ -88,19 +78,13 @@ MirandaContact::~MirandaContact()
void MirandaContact::merge(const MirandaContact& other)
{
if (m_strNick != other.m_strNick)
- {
- m_strNick = i18n(muT("(multiple)"));
- }
+ m_strNick = TranslateT("(multiple)");
if (m_strProtocol != other.m_strProtocol)
- {
- m_strProtocol = i18n(muT("(multiple)"));
- }
+ m_strProtocol = TranslateT("(multiple)");
if (m_strGroup != other.m_strGroup)
- {
- m_strGroup = i18n(muT("(multiple)"));
- }
+ m_strGroup = TranslateT("(multiple)");
citer_each_(SourceHandles, i, other.m_Sources)
{
@@ -116,8 +100,7 @@ void MirandaContact::beginRead()
// allocate required data
m_CIs.resize(m_Sources.size());
- for (int j = m_Sources.size() - 1; j >= 0; --j)
- {
+ for (int j = m_Sources.size() - 1; j >= 0; --j) {
ContactInfo& ci = m_CIs[j];
ci.hContact = m_Sources[j];
@@ -134,9 +117,8 @@ void MirandaContact::beginRead()
void MirandaContact::endRead()
{
#if defined(_DEBUG)
- if (m_CIs.size() + m_EIs.size() + m_SpareEIs.size() > 0)
- {
- ext::string strLog = ext::str(ext::format(muT("Freeing | CIs and |+| EIs...\n")) % m_CIs.size() % m_EIs.size() % m_SpareEIs.size());
+ if (m_CIs.size() + m_EIs.size() + m_SpareEIs.size() > 0) {
+ ext::string strLog = ext::str(ext::format(_T("Freeing | CIs and |+| EIs...\n")) % m_CIs.size() % m_EIs.size() % m_SpareEIs.size());
OutputDebugString(strLog.c_str());
}
@@ -164,8 +146,7 @@ void MirandaContact::endRead()
void MirandaContact::readNext()
{
- if (!m_EIs.empty())
- {
+ if (!m_EIs.empty()) {
m_SpareEIs.push_back(m_EIs.front());
m_EIs.pop_front();
}
@@ -182,16 +163,13 @@ void MirandaContactTolerantMerge::fillQueue()
// assume that items with +/- 30 seconds may be equal
static const int timestampTol = 30;
- while (!m_CIs.empty() && (m_EIs.size() < 2 || (m_EIs.back().dbe.timestamp - m_EIs.front().dbe.timestamp) <= timestampTol))
- {
+ while (!m_CIs.empty() && (m_EIs.size() < 2 || (m_EIs.back().dbe.timestamp - m_EIs.front().dbe.timestamp) <= timestampTol)) {
// find oldest next event in chains
int nNext = 0;
DWORD timestampFirst = m_CIs.front().ei.dbe.timestamp;
- for (int i = 1; i < m_CIs.size(); ++i)
- {
- if (m_CIs[i].ei.dbe.timestamp < timestampFirst)
- {
+ for (int i = 1; i < m_CIs.size(); ++i) {
+ if (m_CIs[i].ei.dbe.timestamp < timestampFirst) {
timestampFirst = m_CIs[i].ei.dbe.timestamp;
nNext = i;
}
@@ -199,7 +177,7 @@ void MirandaContactTolerantMerge::fillQueue()
// insert the fetched at correct position or throw away if duplicate
ContactInfo& ci = m_CIs[nNext];
-
+
std::list<EventInfo>::iterator insPos = m_EIs.end();
bool bIsDuplicate = false;
@@ -208,35 +186,30 @@ void MirandaContactTolerantMerge::fillQueue()
EventInfo& j_ei = *j;
int timestampDelta = j_ei.dbe.timestamp - ci.ei.dbe.timestamp;
- if (timestampDelta > 0)
- {
+ if (timestampDelta > 0) {
insPos = j;
}
if (j_ei.hContact != ci.ei.hContact &&
- timestampDelta >= -timestampTol && timestampDelta <= timestampTol &&
- j_ei.dbe.eventType == ci.ei.dbe.eventType &&
- (j_ei.dbe.flags & ~(DBEF_FIRST | DBEF_READ)) == (ci.ei.dbe.flags & ~(DBEF_FIRST | DBEF_READ)) &&
- j_ei.dbe.cbBlob == ci.ei.dbe.cbBlob &&
- memcmp(j_ei.dbe.pBlob, ci.ei.dbe.pBlob, j_ei.dbe.cbBlob) == 0)
- {
+ timestampDelta >= -timestampTol && timestampDelta <= timestampTol &&
+ j_ei.dbe.eventType == ci.ei.dbe.eventType &&
+ (j_ei.dbe.flags & ~(DBEF_FIRST | DBEF_READ)) == (ci.ei.dbe.flags & ~(DBEF_FIRST | DBEF_READ)) &&
+ j_ei.dbe.cbBlob == ci.ei.dbe.cbBlob &&
+ memcmp(j_ei.dbe.pBlob, ci.ei.dbe.pBlob, j_ei.dbe.cbBlob) == 0) {
bIsDuplicate = true;
break;
}
}
- if (!bIsDuplicate)
- {
+ if (!bIsDuplicate) {
m_EIs.insert(insPos, ci.ei);
- if (!m_SpareEIs.empty())
- {
+ if (!m_SpareEIs.empty()) {
ci.ei = m_SpareEIs.front();
m_SpareEIs.pop_front();
}
- else
- {
+ else {
ci.ei.dbe.pBlob = NULL;
ci.ei.nAllocated = 0;
}
@@ -255,16 +228,13 @@ void MirandaContactStrictMerge::fillQueue()
// assume that items with +/- 30 seconds may be equal
static const int timestampTol = 0;
- while (!m_CIs.empty() && (m_EIs.size() < 2 || (m_EIs.back().dbe.timestamp - m_EIs.front().dbe.timestamp) <= timestampTol))
- {
+ while (!m_CIs.empty() && (m_EIs.size() < 2 || (m_EIs.back().dbe.timestamp - m_EIs.front().dbe.timestamp) <= timestampTol)) {
// find oldest next event in chains
int nNext = 0;
DWORD timestampFirst = m_CIs.front().ei.dbe.timestamp;
- for (int i = 1; i < m_CIs.size(); ++i)
- {
- if (m_CIs[i].ei.dbe.timestamp < timestampFirst)
- {
+ for (int i = 1; i < m_CIs.size(); ++i) {
+ if (m_CIs[i].ei.dbe.timestamp < timestampFirst) {
timestampFirst = m_CIs[i].ei.dbe.timestamp;
nNext = i;
}
@@ -272,7 +242,7 @@ void MirandaContactStrictMerge::fillQueue()
// insert the fetched at correct position or throw away if duplicate
ContactInfo& ci = m_CIs[nNext];
-
+
std::list<EventInfo>::iterator insPos = m_EIs.end();
bool bIsDuplicate = false;
@@ -282,34 +252,28 @@ void MirandaContactStrictMerge::fillQueue()
int timestampDelta = j_ei.dbe.timestamp - ci.ei.dbe.timestamp;
if (timestampDelta > 0)
- {
insPos = j;
- }
if (j_ei.hContact != ci.ei.hContact &&
- timestampDelta >= -timestampTol && timestampDelta <= timestampTol &&
- j_ei.dbe.eventType == ci.ei.dbe.eventType &&
- (j_ei.dbe.flags & ~(DBEF_FIRST | DBEF_READ)) == (ci.ei.dbe.flags & ~(DBEF_FIRST | DBEF_READ)) &&
- j_ei.dbe.cbBlob == ci.ei.dbe.cbBlob &&
- memcmp(j_ei.dbe.pBlob, ci.ei.dbe.pBlob, j_ei.dbe.cbBlob) == 0)
- {
+ timestampDelta >= -timestampTol && timestampDelta <= timestampTol &&
+ j_ei.dbe.eventType == ci.ei.dbe.eventType &&
+ (j_ei.dbe.flags & ~(DBEF_FIRST | DBEF_READ)) == (ci.ei.dbe.flags & ~(DBEF_FIRST | DBEF_READ)) &&
+ j_ei.dbe.cbBlob == ci.ei.dbe.cbBlob &&
+ memcmp(j_ei.dbe.pBlob, ci.ei.dbe.pBlob, j_ei.dbe.cbBlob) == 0) {
bIsDuplicate = true;
break;
}
}
- if (!bIsDuplicate)
- {
+ if (!bIsDuplicate) {
m_EIs.insert(insPos, ci.ei);
- if (!m_SpareEIs.empty())
- {
+ if (!m_SpareEIs.empty()) {
ci.ei = m_SpareEIs.front();
m_SpareEIs.pop_front();
}
- else
- {
+ else {
ci.ei.dbe.pBlob = NULL;
ci.ei.nAllocated = 0;
}
@@ -325,16 +289,13 @@ void MirandaContactStrictMerge::fillQueue()
void MirandaContactNoMerge::fillQueue()
{
- while (!m_CIs.empty() && m_EIs.size() < 1)
- {
+ while (!m_CIs.empty() && m_EIs.size() < 1) {
// find oldest next event in chains
int nNext = 0;
DWORD timestampFirst = m_CIs.front().ei.dbe.timestamp;
- for (int i = 1; i < m_CIs.size(); ++i)
- {
- if (m_CIs[i].ei.dbe.timestamp < timestampFirst)
- {
+ for (int i = 1; i < m_CIs.size(); ++i) {
+ if (m_CIs[i].ei.dbe.timestamp < timestampFirst) {
timestampFirst = m_CIs[i].ei.dbe.timestamp;
nNext = i;
}
@@ -342,16 +303,14 @@ void MirandaContactNoMerge::fillQueue()
// insert the fetched at correct position or throw away if duplicate
ContactInfo& ci = m_CIs[nNext];
-
+
m_EIs.push_back(ci.ei);
- if (!m_SpareEIs.empty())
- {
+ if (!m_SpareEIs.empty()) {
ci.ei = m_SpareEIs.front();
m_SpareEIs.pop_front();
}
- else
- {
+ else {
ci.ei.dbe.pBlob = NULL;
ci.ei.nAllocated = 0;
}
@@ -366,18 +325,17 @@ void MirandaContactNoMerge::fillQueue()
MirandaContact* MirandaContactFactory::makeMirandaContact(int MergeMode, const ext::string& strNick, const ext::string& strProtocol, const ext::string& strGroup, const MirandaContact::SourceHandles& sources)
{
- switch (MergeMode)
- {
- case Settings::mmTolerantMerge:
- return new MirandaContactTolerantMerge(strNick, strProtocol, strGroup, sources);
+ switch (MergeMode) {
+ case Settings::mmTolerantMerge:
+ return new MirandaContactTolerantMerge(strNick, strProtocol, strGroup, sources);
- case Settings::mmStrictMerge:
- return new MirandaContactStrictMerge(strNick, strProtocol, strGroup, sources);
+ case Settings::mmStrictMerge:
+ return new MirandaContactStrictMerge(strNick, strProtocol, strGroup, sources);
- case Settings::mmNoMerge:
- return new MirandaContactNoMerge(strNick, strProtocol, strGroup, sources);
+ case Settings::mmNoMerge:
+ return new MirandaContactNoMerge(strNick, strProtocol, strGroup, sources);
- default:
- return 0;
+ default:
+ return 0;
}
}
diff --git a/plugins/HistoryStats/src/mirandahistory.cpp b/plugins/HistoryStats/src/mirandahistory.cpp
index 2e37729fe3..867b8756f2 100644
--- a/plugins/HistoryStats/src/mirandahistory.cpp
+++ b/plugins/HistoryStats/src/mirandahistory.cpp
@@ -14,8 +14,7 @@ void MirandaHistory::populateProtocols()
PROTOACCOUNT **protoList;
int protoCount;
- if (mu::proto::enumProtocols(&protoCount, &protoList) == 0)
- {
+ if (mu::proto::enumProtocols(&protoCount, &protoList) == 0) {
upto_each_(i, protoCount)
{
ext::a::string protoName = protoList[i]->szModuleName;
@@ -26,7 +25,7 @@ void MirandaHistory::populateProtocols()
}
}
- m_DefaultProtocol.displayName = i18n(muT("(Unknown)"));
+ m_DefaultProtocol.displayName = TranslateT("(Unknown)");
}
const Protocol& MirandaHistory::getProtocol(const ext::a::string& protocol) const
@@ -39,9 +38,7 @@ const Protocol& MirandaHistory::getProtocol(const ext::a::string& protocol) cons
void MirandaHistory::makeContactsAvailable()
{
if (m_bContactsAvailable)
- {
return;
- }
// make protocols available
populateProtocols();
@@ -63,37 +60,33 @@ void MirandaHistory::makeContactsAvailable()
void MirandaHistory::readContacts()
{
bool bHandleMeta = mu::metacontacts::_available() && m_Settings.m_MetaContactsMode != Settings::mcmIgnoreMeta;
- ext::a::string strMetaProto = bHandleMeta ? META_PROTO : muA("");
+ ext::a::string strMetaProto = bHandleMeta ? META_PROTO : "";
MirandaSettings db;
std::vector<MCONTACT> sources;
MCONTACT hContact = db_find_first();
- while (hContact)
- {
+ while (hContact) {
db.setContact(hContact);
- const mu_ansi* pProtoName = GetContactProto(hContact);
+ const char* pProtoName = GetContactProto(hContact);
// if something leads to ignorance of conact jump to end of
// processing this contact via 'break'
- do
- {
+ do {
// ignore because of bad or not loaded protocol?
if (!pProtoName)
- {
pProtoName = con::ProtoUnknown; // MEMO: alternative would be "break;"
- }
ext::string curNick = mu::clist::getContactDisplayName(hContact);
-
+
// retrieve protocol
const ext::a::string curProtoName = pProtoName;
const Protocol& curProto = getProtocol(curProtoName);
// retrieve group
db.setModule(con::ModCList);
- ext::string curGroup = db.readStrDirect(con::SettGroup, i18n(muT("(none)")));
+ ext::string curGroup = db.readStrDirect(con::SettGroup, TranslateT("(none)"));
// ignore because of filtered protocol?
if (m_Settings.m_ProtosIgnore.find(curProtoName) != m_Settings.m_ProtosIgnore.end())
@@ -104,38 +97,26 @@ void MirandaHistory::readContacts()
sources.push_back(hContact);
// handle meta-contacts
- if (bHandleMeta)
- {
- if (curProtoName == strMetaProto)
- {
+ if (bHandleMeta) {
+ if (curProtoName == strMetaProto) {
// don't include meta-contact history
if (m_Settings.m_MetaContactsMode == Settings::mcmSubOnly)
- {
sources.clear();
- }
// include meta-contact's subcontact
- if (m_Settings.m_MetaContactsMode != Settings::mcmMetaOnly)
- {
+ if (m_Settings.m_MetaContactsMode != Settings::mcmMetaOnly) {
// find subcontacts to read history from
int numSubs = mu::metacontacts::getNumContacts(hContact);
-
- if (numSubs > 0)
- {
- for (int i = 0; i < numSubs; ++i)
- {
+ if (numSubs > 0) {
+ for (int i = 0; i < numSubs; ++i) {
MCONTACT hSubContact = mu::metacontacts::getSubContact(hContact, i);
-
if (hSubContact)
- {
sources.push_back(hSubContact);
- }
}
}
}
}
- else
- {
+ else {
// ignore because of meta-contact?
if (db_mc_getMeta(hContact))
break;
@@ -146,15 +127,13 @@ void MirandaHistory::readContacts()
db.setModule(con::ModHistoryStats);
if (db.readBool(con::SettExclude, false))
- {
break;
- }
// finally add to list
MirandaContact* pContact = MirandaContactFactory::makeMirandaContact(m_Settings.m_MergeMode, curNick, curProto.displayName, curGroup, sources);
-
m_Contacts.push_back(pContact);
- } while (false);
+ }
+ while (false);
hContact = db_find_next(hContact);
}
@@ -163,20 +142,14 @@ void MirandaHistory::readContacts()
void MirandaHistory::mergeContacts()
{
if (!m_Settings.m_MergeContacts)
- {
return;
- }
- for (ContactList::size_type i = 0; i < m_Contacts.size(); ++i)
- {
+ for (ContactList::size_type i = 0; i < m_Contacts.size(); ++i) {
MirandaContact& cur = *m_Contacts[i];
- for (ContactList::size_type j = i + 1; j < m_Contacts.size(); ++j)
- {
- if (m_Contacts[j]->getNick() == cur.getNick())
- {
- if (!m_Settings.m_MergeContactsGroups || m_Contacts[j]->getGroup() == cur.getGroup())
- {
+ for (ContactList::size_type j = i + 1; j < m_Contacts.size(); ++j) {
+ if (m_Contacts[j]->getNick() == cur.getNick()) {
+ if (!m_Settings.m_MergeContactsGroups || m_Contacts[j]->getGroup() == cur.getGroup()) {
cur.merge(*m_Contacts[j]);
delete m_Contacts[j];
@@ -188,8 +161,8 @@ void MirandaHistory::mergeContacts()
}
}
-MirandaHistory::MirandaHistory(const Settings& settings)
- : m_Settings(settings), m_bContactsAvailable(false)
+MirandaHistory::MirandaHistory(const Settings& settings) :
+ m_Settings(settings), m_bContactsAvailable(false)
{
}
@@ -206,9 +179,7 @@ MirandaHistory::~MirandaHistory()
int MirandaHistory::getContactCount()
{
if (!m_bContactsAvailable)
- {
makeContactsAvailable();
- }
return m_Contacts.size();
}
@@ -216,9 +187,7 @@ int MirandaHistory::getContactCount()
MirandaContact& MirandaHistory::getContact(int index)
{
if (!m_bContactsAvailable)
- {
makeContactsAvailable();
- }
assert(index >= 0 && index < m_Contacts.size());
diff --git a/plugins/HistoryStats/src/mirandasettings.cpp b/plugins/HistoryStats/src/mirandasettings.cpp
index 34d8342d38..c0da3dd256 100644
--- a/plugins/HistoryStats/src/mirandasettings.cpp
+++ b/plugins/HistoryStats/src/mirandasettings.cpp
@@ -2,32 +2,32 @@
#include "mirandasettings.h"
-MirandaSettings::MirandaSettings()
- : m_hContact(0)
+MirandaSettings::MirandaSettings() :
+ m_hContact(0)
{
}
-bool MirandaSettings::readBool(const mu_ansi* szSetting, bool bDefault) const
+bool MirandaSettings::readBool(const char* szSetting, bool bDefault) const
{
return (readByte(szSetting, bDefault ? 1 : 0) != 0);
}
-int MirandaSettings::readByte(const mu_ansi* szSetting, int bDefault) const
+int MirandaSettings::readByte(const char* szSetting, int bDefault) const
{
return db_get_b(m_hContact, m_strModule.c_str(), szSetting, bDefault);
}
-int MirandaSettings::readWord(const mu_ansi* szSetting, int wDefault) const
+int MirandaSettings::readWord(const char* szSetting, int wDefault) const
{
return db_get_w(m_hContact, m_strModule.c_str(), szSetting, wDefault);
}
-int MirandaSettings::readDWord(const mu_ansi* szSetting, int dwDefault) const
+int MirandaSettings::readDWord(const char* szSetting, int dwDefault) const
{
return db_get_dw(m_hContact, m_strModule.c_str(), szSetting, dwDefault);
}
-ext::string MirandaSettings::readStr(const mu_ansi* szSetting, const mu_text* szDefault) const
+ext::string MirandaSettings::readStr(const char* szSetting, const TCHAR* szDefault) const
{
DBVARIANT dbv;
if (db_get_s(m_hContact, m_strModule.c_str(), szSetting, &dbv))
@@ -38,7 +38,7 @@ ext::string MirandaSettings::readStr(const mu_ansi* szSetting, const mu_text* sz
return str;
}
-ext::string MirandaSettings::readStrDirect(const mu_ansi* szSetting, const mu_text* szDefault) const
+ext::string MirandaSettings::readStrDirect(const char* szSetting, const TCHAR* szDefault) const
{
DBVARIANT dbv;
@@ -73,47 +73,47 @@ ext::string MirandaSettings::readStrDirect(const mu_ansi* szSetting, const mu_te
return str;
}
-void MirandaSettings::readTree(const mu_ansi* szSetting, const mu_text* szDefault, SettingsTree& value) const
+void MirandaSettings::readTree(const char* szSetting, const TCHAR* szDefault, SettingsTree& value) const
{
value.fromString(readStr(szSetting, szDefault));
}
-void MirandaSettings::writeBool(const mu_ansi* szSetting, bool bValue) const
+void MirandaSettings::writeBool(const char* szSetting, bool bValue) const
{
writeByte(szSetting, bValue ? 1 : 0);
}
-void MirandaSettings::writeByte(const mu_ansi* szSetting, int bValue) const
+void MirandaSettings::writeByte(const char* szSetting, int bValue) const
{
db_set_b(m_hContact, m_strModule.c_str(), szSetting, bValue);
}
-void MirandaSettings::writeWord(const mu_ansi* szSetting, int wValue) const
+void MirandaSettings::writeWord(const char* szSetting, int wValue) const
{
db_set_w(m_hContact, m_strModule.c_str(), szSetting, wValue);
}
-void MirandaSettings::writeDWord(const mu_ansi* szSetting, int dwValue) const
+void MirandaSettings::writeDWord(const char* szSetting, int dwValue) const
{
db_set_dw(m_hContact, m_strModule.c_str(), szSetting, dwValue);
}
-void MirandaSettings::writeStr(const mu_ansi* szSetting, const mu_text* szValue) const
+void MirandaSettings::writeStr(const char* szSetting, const TCHAR* szValue) const
{
db_set_ts(m_hContact, m_strModule.c_str(), szSetting, szValue);
}
-void MirandaSettings::writeStrDirect(const mu_ansi* szSetting, const mu_text* szValue) const
+void MirandaSettings::writeStrDirect(const char* szSetting, const TCHAR* szValue) const
{
db_set_ts(m_hContact, m_strModule.c_str(), szSetting, szValue);
}
-void MirandaSettings::writeTree(const mu_ansi* szSetting, const SettingsTree& value) const
+void MirandaSettings::writeTree(const char* szSetting, const SettingsTree& value) const
{
writeStr(szSetting, value.toString().c_str());
}
-bool MirandaSettings::settingExists(const mu_ansi* szSetting) const
+bool MirandaSettings::settingExists(const char* szSetting) const
{
DBVARIANT dbv;
if (db_get_s(m_hContact, m_strModule.c_str(), szSetting, &dbv, 0))
@@ -123,12 +123,12 @@ bool MirandaSettings::settingExists(const mu_ansi* szSetting) const
return true;
}
-bool MirandaSettings::delSetting(const mu_ansi* szSetting)
+bool MirandaSettings::delSetting(const char* szSetting)
{
return db_unset(m_hContact, m_strModule.c_str(), szSetting) == 0;
}
-int MirandaSettings::enumSettingsProc(const mu_ansi* szSetting, LPARAM lParam)
+int MirandaSettings::enumSettingsProc(const char* szSetting, LPARAM lParam)
{
SetInserter* pInserter = reinterpret_cast<SetInserter*>(lParam);
diff --git a/plugins/HistoryStats/src/mirandasettings.h b/plugins/HistoryStats/src/mirandasettings.h
index 827c9f4ac5..e58b379fad 100644
--- a/plugins/HistoryStats/src/mirandasettings.h
+++ b/plugins/HistoryStats/src/mirandasettings.h
@@ -22,7 +22,7 @@ private:
ext::a::string m_strModule;
private:
- static int enumSettingsProc(const mu_ansi* szSetting, LPARAM lParam);
+ static int enumSettingsProc(const char* szSetting, LPARAM lParam);
public:
// constructor
@@ -32,29 +32,29 @@ public:
MCONTACT getContact() const { return m_hContact; }
void setContact(MCONTACT hContact) { m_hContact = hContact; }
const ext::a::string& getModule() const { return m_strModule; }
- void setModule(const mu_ansi* module) { m_strModule = module; }
+ void setModule(const char* module) { m_strModule = module; }
// reading
- bool readBool(const mu_ansi* szSetting, bool bDefault) const;
- int readByte(const mu_ansi* szSetting, int bDefault) const;
- int readWord(const mu_ansi* szSetting, int wDefault) const;
- int readDWord(const mu_ansi* szSetting, int dwDeault) const;
- ext::string readStr(const mu_ansi* szSetting, const mu_text* szDefault) const;
- ext::string readStrDirect(const mu_ansi* szSetting, const mu_text* szDefault) const;
- void readTree(const mu_ansi* szSetting, const mu_text* szDefault, SettingsTree& value) const;
+ bool readBool(const char* szSetting, bool bDefault) const;
+ int readByte(const char* szSetting, int bDefault) const;
+ int readWord(const char* szSetting, int wDefault) const;
+ int readDWord(const char* szSetting, int dwDeault) const;
+ ext::string readStr(const char* szSetting, const TCHAR* szDefault) const;
+ ext::string readStrDirect(const char* szSetting, const TCHAR* szDefault) const;
+ void readTree(const char* szSetting, const TCHAR* szDefault, SettingsTree& value) const;
// writing
- void writeBool(const mu_ansi* szSetting, bool bValue) const;
- void writeByte(const mu_ansi* szSetting, int bValue) const;
- void writeWord(const mu_ansi* szSetting, int wValue) const;
- void writeDWord(const mu_ansi* szSetting, int dwValue) const;
- void writeStr(const mu_ansi* szSetting, const mu_text* szValue) const;
- void writeStrDirect(const mu_ansi* szSetting, const mu_text* szValue) const;
- void writeTree(const mu_ansi* szSetting, const SettingsTree& value) const;
+ void writeBool(const char* szSetting, bool bValue) const;
+ void writeByte(const char* szSetting, int bValue) const;
+ void writeWord(const char* szSetting, int wValue) const;
+ void writeDWord(const char* szSetting, int dwValue) const;
+ void writeStr(const char* szSetting, const TCHAR* szValue) const;
+ void writeStrDirect(const char* szSetting, const TCHAR* szValue) const;
+ void writeTree(const char* szSetting, const SettingsTree& value) const;
// misc functions
- bool settingExists(const mu_ansi* szSetting) const;
- bool delSetting(const mu_ansi* szSetting);
+ bool settingExists(const char* szSetting) const;
+ bool delSetting(const char* szSetting);
// enumeration
void enumSettings(SetInserter& insertIterator);
diff --git a/plugins/HistoryStats/src/mu_common.cpp b/plugins/HistoryStats/src/mu_common.cpp
index 4ab9da142a..1a3d5c199e 100644
--- a/plugins/HistoryStats/src/mu_common.cpp
+++ b/plugins/HistoryStats/src/mu_common.cpp
@@ -12,82 +12,54 @@ namespace mu
namespace clist
{
- HANDLE addMainMenuItem(const mu_text* pszName, DWORD flags, int position, HICON hIcon, const mu_ansi* pszService, const mu_text* pszPopupName /* = NULL */, int popupPosition /* = 0 */, DWORD hotKey /* = 0 */)
+ HANDLE addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName /* = NULL */, int popupPosition /* = 0 */, DWORD hotKey /* = 0 */)
{
// TODO: support for unicode-core with unicode-aware CList
- CLISTMENUITEM mi;
-
- ZeroMemory(&mi, sizeof(mi));
-
- mi.cbSize = sizeof(mi);
- mi.pszName = MU_DO_BOTH(const_cast<mu_ansi*>(pszName), wideToAnsiDup(pszName));
- mi.flags = flags;
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.ptszName = (TCHAR*)pszName;
+ mi.flags = flags | CMIF_TCHAR;
mi.position = position;
mi.hIcon = hIcon;
- mi.pszService = const_cast<mu_ansi*>(pszService);
- mi.pszPopupName = MU_DO_BOTH(const_cast<mu_ansi*>(pszPopupName), wideToAnsiDup(pszPopupName));
+ mi.pszService = const_cast<char*>(pszService);
+ mi.ptszPopupName = (TCHAR*)pszPopupName;
mi.popupPosition = popupPosition;
mi.hotKey = hotKey;
-
- HANDLE res = Menu_AddMainMenuItem(&mi);
-
- MU_DO_WIDE(freeAnsi(mi.pszName));
- MU_DO_WIDE(freeAnsi(mi.pszPopupName));
-
- return res;
+ return Menu_AddMainMenuItem(&mi);
}
- HANDLE addContactMenuItem(const mu_text* pszName, DWORD flags, int position, HICON hIcon, const mu_ansi* pszService, DWORD hotKey /* = 0 */, const mu_ansi* pszContactOwner /* = NULL */)
+ HANDLE addContactMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, DWORD hotKey /* = 0 */, const char* pszContactOwner /* = NULL */)
{
// TODO: support for unicode-core with unicode-aware CList
- CLISTMENUITEM mi;
-
- ZeroMemory(&mi, sizeof(mi));
-
- mi.cbSize = sizeof(mi);
- mi.pszName = MU_DO_BOTH(const_cast<mu_ansi*>(pszName), wideToAnsiDup(pszName));
- mi.flags = flags;
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.ptszName = (TCHAR*)pszName;
+ mi.flags = flags | CMIF_TCHAR;
mi.position = position;
mi.hIcon = hIcon;
- mi.pszService = const_cast<mu_ansi*>(pszService);
+ mi.pszService = const_cast<char*>(pszService);
mi.hotKey = hotKey;
- mi.pszContactOwner = const_cast<mu_ansi*>(pszContactOwner);
-
- HANDLE res = Menu_AddContactMenuItem(&mi);
-
- MU_DO_WIDE(freeAnsi(mi.pszName));
-
- return res;
+ mi.pszContactOwner = const_cast<char*>(pszContactOwner);
+ return Menu_AddContactMenuItem(&mi);
}
- int modifyMenuItem(HANDLE hMenuItem, DWORD toModify, const mu_text* pszName /* = NULL */, DWORD flags /* = 0 */, HICON hIcon /* = NULL */, DWORD hotKey /* = 0 */)
+ int modifyMenuItem(HANDLE hMenuItem, DWORD toModify, const TCHAR* pszName /* = NULL */, DWORD flags /* = 0 */, HICON hIcon /* = NULL */, DWORD hotKey /* = 0 */)
{
// TODO: support for unicode-core with unicode-aware CList
- CLISTMENUITEM mi;
-
- ZeroMemory(&mi, sizeof(mi));
-
- mi.cbSize = sizeof(mi);
- mi.pszName = MU_DO_BOTH(const_cast<mu_ansi*>(pszName), wideToAnsiDup(pszName));
- mi.flags = toModify | flags;
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.ptszName = (TCHAR*)pszName;
+ mi.flags = toModify | flags | CMIF_TCHAR;
mi.hIcon = hIcon;
mi.hotKey = hotKey;
-
- int res = CallService(MS_CLIST_MODIFYMENUITEM, reinterpret_cast<WPARAM>(hMenuItem), reinterpret_cast<LPARAM>(&mi));
-
- MU_DO_WIDE(freeAnsi(mi.pszName));
-
- return res;
+ return CallService(MS_CLIST_MODIFYMENUITEM, reinterpret_cast<WPARAM>(hMenuItem), reinterpret_cast<LPARAM>(&mi));
}
- const mu_text* getContactDisplayName(MCONTACT hContact)
+ const TCHAR* getContactDisplayName(MCONTACT hContact)
{
- return reinterpret_cast<const mu_text*>(CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_UNICODE));
+ return reinterpret_cast<const TCHAR*>(CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, GCDNF_UNICODE));
}
- const mu_text* getStatusModeDescription(int nStatusMode)
+ const TCHAR* getStatusModeDescription(int nStatusMode)
{
- return reinterpret_cast<const mu_text*>(CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, static_cast<WPARAM>(nStatusMode), GSMDF_UNICODE));
+ return reinterpret_cast<const TCHAR*>(CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, static_cast<WPARAM>(nStatusMode), GSMDF_UNICODE));
}
}
@@ -97,46 +69,14 @@ namespace mu
namespace db
{
- int getProfilePath(int cbName, mu_text* pszName)
+ int getProfilePath(int cbName, TCHAR* pszName)
{
- // TODO: support for unicode core (if supported)
-#if defined(MU_WIDE)
- mu_ansi* pszNameAnsi = new mu_ansi[cbName];
-
- int ret = CallService(MS_DB_GETPROFILEPATH, cbName, reinterpret_cast<LPARAM>(pszNameAnsi));
-
- if (ret == 0)
- {
- ansiToWide(pszNameAnsi, pszName, cbName);
- }
-
- delete pszNameAnsi;
-
- return ret;
-#else // MU_WIDE
- return CallService(MS_DB_GETPROFILEPATH, cbName, reinterpret_cast<LPARAM>(pszName));
-#endif // MU_WIDE
+ return CallService(MS_DB_GETPROFILEPATHT, cbName, reinterpret_cast<LPARAM>(pszName));
}
- int getProfileName(int cbName, mu_text* pszName)
+ int getProfileName(int cbName, TCHAR* pszName)
{
- // TODO: support for unicode core (if supported)
-#if defined(MU_WIDE)
- mu_ansi* pszNameAnsi = new mu_ansi[cbName];
-
- int ret = CallService(MS_DB_GETPROFILENAME, cbName, reinterpret_cast<LPARAM>(pszNameAnsi));
-
- if (ret == 0)
- {
- ansiToWide(pszNameAnsi, pszName, cbName);
- }
-
- delete pszNameAnsi;
-
- return ret;
-#else // MU_WIDE
- return CallService(MS_DB_GETPROFILENAME, cbName, reinterpret_cast<LPARAM>(pszName));
-#endif // MU_WIDE
+ return CallService(MS_DB_GETPROFILENAMET, cbName, reinterpret_cast<LPARAM>(pszName));
}
void setSafetyMode(bool safetyMode)
@@ -151,10 +91,10 @@ namespace mu
namespace db_contact
{
- int enumSettings(MCONTACT hContact, const mu_ansi* szModule, DBSETTINGENUMPROC pEnumProc, LPARAM lProcParam)
+ int enumSettings(MCONTACT hContact, const char* szModule, DBSETTINGENUMPROC pEnumProc, LPARAM lProcParam)
{
DBCONTACTENUMSETTINGS dbces;
-
+
dbces.pfnEnumProc = pEnumProc;
dbces.lParam = lProcParam;
dbces.szModule = szModule;
@@ -183,41 +123,41 @@ namespace mu
return true;
}
- void addIcon(const mu_text* szSection, const mu_text* szDescription, const mu_ansi* szIconName, const mu_ansi* szDefaultFile, int iDefaultIndex, int cx /* = 16 */, int cy /* = 16 */)
+ void addIcon(const TCHAR* szSection, const TCHAR* szDescription, const char* szIconName, const char* szDefaultFile, int iDefaultIndex, int cx /* = 16 */, int cy /* = 16 */)
{
SKINICONDESC sid;
sid.cbSize = sizeof(sid);
- sid.ptszSection = const_cast<mu_text*>(szSection);
- sid.ptszDescription = const_cast<mu_text*>(szDescription);
- sid.pszName = const_cast<mu_ansi*>(szIconName);
- sid.pszDefaultFile = const_cast<mu_ansi*>(szDefaultFile);
+ sid.ptszSection = const_cast<TCHAR*>(szSection);
+ sid.ptszDescription = const_cast<TCHAR*>(szDescription);
+ sid.pszName = const_cast<char*>(szIconName);
+ sid.pszDefaultFile = const_cast<char*>(szDefaultFile);
sid.iDefaultIndex = iDefaultIndex;
sid.hDefaultIcon = NULL;
sid.cx = cx;
sid.cy = cy;
- sid.flags = MU_DO_BOTH(0, SIDF_UNICODE);
+ sid.flags = SIDF_TCHAR;
Skin_AddIcon(&sid);
}
- void addIcon(const mu_text* szSection, const mu_text* szDescription, const mu_ansi* szIconName, HICON hDefaultIcon, int cx /* = 16 */, int cy /* = 16 */)
+ void addIcon(const TCHAR* szSection, const TCHAR* szDescription, const char* szIconName, HICON hDefaultIcon, int cx /* = 16 */, int cy /* = 16 */)
{
SKINICONDESC sid;
sid.cbSize = sizeof(sid);
- sid.ptszSection = const_cast<mu_text*>(szSection);
- sid.ptszDescription = const_cast<mu_text*>(szDescription);
- sid.pszName = const_cast<mu_ansi*>(szIconName);
+ sid.ptszSection = const_cast<TCHAR*>(szSection);
+ sid.ptszDescription = const_cast<TCHAR*>(szDescription);
+ sid.pszName = const_cast<char*>(szIconName);
sid.pszDefaultFile = NULL;
sid.iDefaultIndex = 0;
sid.hDefaultIcon = hDefaultIcon;
sid.cx = cx;
sid.cy = cy;
- sid.flags = MU_DO_BOTH(0, SIDF_UNICODE);
+ sid.flags = SIDF_TCHAR;
Skin_AddIcon(&sid);
}
- HICON getIcon(const mu_ansi* szIconName)
+ HICON getIcon(const char* szIconName)
{
return reinterpret_cast<HICON>(CallService(MS_SKIN2_GETICON, 0, reinterpret_cast<LPARAM>(szIconName)));
}
@@ -229,17 +169,16 @@ namespace mu
namespace langpack
{
- const mu_text* translateString(const mu_text* szEnglish)
+ const TCHAR* translateString(const TCHAR* szEnglish)
{
- return reinterpret_cast<const mu_text*>(CallService(MS_LANGPACK_TRANSLATESTRING, MU_DO_BOTH(0, LANG_UNICODE), reinterpret_cast<LPARAM>(szEnglish)));
+ return reinterpret_cast<const TCHAR*>(CallService(MS_LANGPACK_TRANSLATESTRING, LANG_UNICODE, reinterpret_cast<LPARAM>(szEnglish)));
}
UINT getCodePage()
{
static UINT CodePage = -1;
- if (CodePage == -1)
- {
+ if (CodePage == -1) {
CodePage = ServiceExists(MS_LANGPACK_GETCODEPAGE) ? CallService(MS_LANGPACK_GETCODEPAGE, 0, 0) : CP_ACP;
}
@@ -275,16 +214,16 @@ namespace mu
namespace opt
{
- void addPage(WPARAM addInfo, const mu_text* pszGroup, const mu_text* pszTitle, const mu_text* pszTab, DLGPROC pfnDlgProc, const mu_ansi* pszTemplate, HINSTANCE hInstance, DWORD flags /* = ODPF_BOLDGROUPS */)
+ void addPage(WPARAM addInfo, const TCHAR* pszGroup, const TCHAR* pszTitle, const TCHAR* pszTab, DLGPROC pfnDlgProc, const char* pszTemplate, HINSTANCE hInstance, DWORD flags /* = ODPF_BOLDGROUPS */)
{
OPTIONSDIALOGPAGE odp = { sizeof(odp) };
- odp.ptszTitle = const_cast<mu_text*>(pszTitle);
+ odp.ptszTitle = const_cast<TCHAR*>(pszTitle);
odp.pfnDlgProc = pfnDlgProc;
- odp.pszTemplate = const_cast<mu_ansi*>(pszTemplate);
+ odp.pszTemplate = const_cast<char*>(pszTemplate);
odp.hInstance = hInstance;
- odp.ptszGroup = const_cast<mu_text*>(pszGroup);
- odp.flags = flags | MU_DO_BOTH(0, ODPF_UNICODE);
- odp.ptszTab = const_cast<mu_text*>(pszTab);
+ odp.ptszGroup = const_cast<TCHAR*>(pszGroup);
+ odp.flags = flags | ODPF_TCHAR;
+ odp.ptszTab = const_cast<TCHAR*>(pszTab);
Options_AddPage(addInfo, &odp);
}
}
@@ -326,9 +265,9 @@ namespace mu
return ProtoEnumAccounts(numProtocols, ppProtoDescriptors);
}
- const mu_ansi* getContactBaseProto(MCONTACT hContact)
+ const char* getContactBaseProto(MCONTACT hContact)
{
- return reinterpret_cast<const mu_ansi*>(CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0));
+ return reinterpret_cast<const char*>(CallService(MS_PROTO_GETCONTACTBASEPROTO, hContact, 0));
}
}
@@ -338,17 +277,12 @@ namespace mu
namespace protosvc
{
- DWORD getCaps(const mu_ansi* szProto, int flagNum)
+ DWORD getCaps(const char* szProto, int flagNum)
{
return (DWORD)CallProtoService(szProto, PS_GETCAPS, static_cast<WPARAM>(flagNum), 0);
}
- int getName(const mu_ansi* szProto, int cchName, mu_text* szName)
- {
- return CallProtoService(szProto, PS_GETNAME, static_cast<WPARAM>(cchName), reinterpret_cast<LPARAM>(szName));
- }
-
- HICON loadIcon(const mu_ansi* szProto, int whichIcon)
+ HICON loadIcon(const char* szProto, int whichIcon)
{
return reinterpret_cast<HICON>(CallProtoService(szProto, PS_LOADICON, static_cast<WPARAM>(whichIcon), 0));
}
@@ -377,7 +311,7 @@ namespace mu
return static_cast<DWORD>(CallService(MS_SYSTEM_GETVERSION, 0, 0));
}
- int getVersionText(int cchVersion, mu_ansi* szVersion)
+ int getVersionText(int cchVersion, char* szVersion)
{
return CallService(MS_SYSTEM_GETVERSIONTEXT, cchVersion, reinterpret_cast<LPARAM>(szVersion));
}
@@ -394,14 +328,14 @@ namespace mu
namespace utils
{
- int pathToRelative(const mu_text* pszPath, mu_text* pszNewPath)
+ int pathToRelative(const TCHAR* pszPath, TCHAR* pszNewPath)
{
- return CallService(MU_DO_BOTH(MS_UTILS_PATHTORELATIVE, MS_UTILS_PATHTORELATIVEW), reinterpret_cast<WPARAM>(pszPath), reinterpret_cast<LPARAM>(pszNewPath));
+ return CallService(MS_UTILS_PATHTORELATIVET, reinterpret_cast<WPARAM>(pszPath), reinterpret_cast<LPARAM>(pszNewPath));
}
- int pathToAbsolute(const mu_text* pszPath, mu_text* pszNewPath)
+ int pathToAbsolute(const TCHAR* pszPath, TCHAR* pszNewPath)
{
- return CallService(MU_DO_BOTH(MS_UTILS_PATHTOABSOLUTE, MS_UTILS_PATHTOABSOLUTEW), reinterpret_cast<WPARAM>(pszPath), reinterpret_cast<LPARAM>(pszNewPath));
+ return CallService(MS_UTILS_PATHTOABSOLUTET, reinterpret_cast<WPARAM>(pszPath), reinterpret_cast<LPARAM>(pszNewPath));
}
}
@@ -419,8 +353,7 @@ namespace mu
}
void unload()
- {
- }
+ {}
DWORD getMinimalMirandaVersion()
{
@@ -436,21 +369,15 @@ namespace mu
bool isMirandaUnicode()
{
if (system::getVersion() < PLUGIN_MAKE_VERSION(0, 4, 3, 33))
- {
return false;
- }
- mu_ansi szVersion[256] = { 0 };
-
+ char szVersion[256] = { 0 };
+
if (system::getVersionText(256, szVersion) != 0)
- {
return false;
- }
- if (!strstr(szVersion, muA("Unicode")))
- {
+ if (!strstr(szVersion, "Unicode"))
return false;
- }
return true;
}
@@ -459,69 +386,51 @@ namespace mu
* string handling
*/
- mu_ansi* wideToAnsiDup(const mu_wide* pszWide, UINT uCP /* = CP_ACP */)
+ char* wideToAnsiDup(const WCHAR* pszWide, UINT uCP /* = CP_ACP */)
{
if (!pszWide)
- {
return NULL;
- }
int len = WideCharToMultiByte(uCP, 0, pszWide, -1, NULL, 0, NULL, NULL);
- mu_ansi* result = reinterpret_cast<mu_ansi*>(malloc(sizeof(mu_ansi) * len));
-
+ char* result = reinterpret_cast<char*>(malloc(sizeof(char)* len));
if (!result)
- {
return NULL;
- }
WideCharToMultiByte(uCP, 0, pszWide, -1, result, len, NULL, NULL);
result[len - 1] = 0;
-
return result;
}
- mu_wide* ansiToWideDup(const mu_ansi* pszAnsi, UINT uCP /* = CP_ACP */)
+ WCHAR* ansiToWideDup(const char* pszAnsi, UINT uCP /* = CP_ACP */)
{
if (!pszAnsi)
- {
return NULL;
- }
int len = MultiByteToWideChar(uCP, 0, pszAnsi, -1, NULL, 0);
- mu_wide* result = reinterpret_cast<mu_wide*>(malloc(sizeof(mu_wide) * len));
-
+ WCHAR* result = reinterpret_cast<WCHAR*>(malloc(sizeof(WCHAR)* len));
if (!result)
- {
return NULL;
- }
MultiByteToWideChar(uCP, 0, pszAnsi, -1, result, len);
result[len - 1] = 0;
-
return result;
}
- mu_ansi* wideToAnsi(const mu_wide* pszWide, mu_ansi* pszRes, int maxLen, UINT uCP /* = CP_ACP */)
+ char* wideToAnsi(const WCHAR* pszWide, char* pszRes, int maxLen, UINT uCP /* = CP_ACP */)
{
if (!pszWide)
- {
return NULL;
- }
WideCharToMultiByte(uCP, 0, pszWide, -1, pszRes, maxLen, NULL, NULL);
-
return pszRes;
}
- mu_wide* ansiToWide(const mu_ansi* pszAnsi, mu_wide* pszRes, int maxLen, UINT uCP /* = CP_ACP */)
+ WCHAR* ansiToWide(const char* pszAnsi, WCHAR* pszRes, int maxLen, UINT uCP /* = CP_ACP */)
{
if (!pszAnsi)
- {
return NULL;
- }
MultiByteToWideChar(uCP, 0, pszAnsi, -1, pszRes, maxLen);
-
return pszRes;
}
}
diff --git a/plugins/HistoryStats/src/mu_common.h b/plugins/HistoryStats/src/mu_common.h
index 5c103743fd..c599d15f61 100644
--- a/plugins/HistoryStats/src/mu_common.h
+++ b/plugins/HistoryStats/src/mu_common.h
@@ -2,108 +2,6 @@
#define HISTORYSTATS_GUARD_MU_COMMON_H
/*
- * mu = miranda unified services
- */
-
-#define _WIN32_WINDOWS 0x0500 // for WM_MOUSEWHEEL
-#define _WIN32_WINNT 0x0501 // for WM_THEMECHANGED
-
-#include <windows.h>
-#include <tchar.h>
-#include <stdio.h>
-
-/*
- * include miranda headers
- */
-
-#define MIRANDA_VER 0x0A00
-
-#include <newpluginapi.h>
-
-#include <m_awaymsg.h> // not used
-#include <m_button.h> // not used
-#include <m_chat.h> // not used
-#include <m_clc.h>
-#include <m_clist.h>
-#include <m_clistint.h> // not used
-#include <m_clui.h> // not used
-#include <m_contacts.h>
-#include <m_database.h>
-#include <m_email.h> // not used
-#include <m_file.h> // not used
-#include <m_findadd.h> // not used
-#include <m_fontservice.h> // not used
-#include <m_genmenu.h> // not used
-#include <m_history.h> // not used
-#include <m_icolib.h>
-#include <m_idle.h> // not used
-#include <m_ignore.h> // not used
-#include <m_langpack.h>
-#include <m_message.h> // not used
-#include <m_netlib.h> // not used
-#include <m_options.h>
-#include <m_png.h>
-#include <m_popup.h> // not used
-#include <m_protocols.h>
-#include <m_protomod.h> // not used
-#include <m_protosvc.h>
-#include <m_skin.h>
-#include <m_system.h>
-#include <m_system_cpp.h> // not used
-#include <m_url.h> // not used
-#include <m_userinfo.h> // not used
-#include <m_utils.h>
-
-#include <m_addcontact.h> // not used, depends on m_protosvc.h
-#include <m_icq.h> // depends on m_protosvc.h
-
-#include <m_metacontacts.h>
-#include <m_historystats.h> // our own header
-
-/*
- * basic defines
- */
-
-#if defined(_UNICODE)
- #undef MU_ANSI
- #define MU_WIDE
-#else
- #define MU_ANSI
- #undef MU_WIDE
-#endif
-
-/*
- * helper macros to avoid many "#if defined(MU_WIDE) ... #else ... #endif" constructs
- */
-
-#if defined(MU_WIDE)
- #define MU_DO_BOTH(ansi, wide) wide
- #define MU_DO_WIDE(wide) wide
- #define MU_DO_ANSI(ansi) (void) 0
-#else
- #define MU_DO_BOTH(ansi, wide) ansi
- #define MU_DO_WIDE(wide) (void) 0
- #define MU_DO_ANSI(ansi) ansi
-#endif
-
-/*
- * common types mu_wide/mu_ansi/mu_text
- */
-
-typedef wchar_t mu_wide;
-typedef char mu_ansi;
-typedef MU_DO_BOTH(char, wchar_t) mu_text;
-
-/*
- * common macros for wrapping text
- */
-
-#define muC(x) x
-#define muW(x) L##x
-#define muA(x) x
-#define muT(x) MU_DO_BOTH(muA(x), muW(x))
-
-/*
* helper functions
*/
@@ -115,11 +13,11 @@ namespace mu
namespace clist
{
- HANDLE addMainMenuItem(const mu_text* pszName, DWORD flags, int position, HICON hIcon, const mu_ansi* pszService, const mu_text* pszPopupName = NULL, int popupPosition = 0, DWORD hotKey = 0);
- HANDLE addContactMenuItem(const mu_text* pszName, DWORD flags, int position, HICON hIcon, const mu_ansi* pszService, DWORD hotKey = 0, const mu_ansi* pszContactOwner = NULL);
- int modifyMenuItem(HANDLE hMenuItem, DWORD toModify, const mu_text* pszName = NULL, DWORD flags = 0, HICON hIcon = NULL, DWORD hotKey = 0);
- const mu_text* getContactDisplayName(MCONTACT hContact);
- const mu_text* getStatusModeDescription(int nStatusMode);
+ HANDLE addMainMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, const TCHAR* pszPopupName = NULL, int popupPosition = 0, DWORD hotKey = 0);
+ HANDLE addContactMenuItem(const TCHAR* pszName, DWORD flags, int position, HICON hIcon, const char* pszService, DWORD hotKey = 0, const char* pszContactOwner = NULL);
+ int modifyMenuItem(HANDLE hMenuItem, DWORD toModify, const TCHAR* pszName = NULL, DWORD flags = 0, HICON hIcon = NULL, DWORD hotKey = 0);
+ const TCHAR* getContactDisplayName(MCONTACT hContact);
+ const TCHAR* getStatusModeDescription(int nStatusMode);
}
/*
@@ -128,8 +26,8 @@ namespace mu
namespace db
{
- int getProfilePath(int cbName, mu_text* pszName);
- int getProfileName(int cbName, mu_text* pszName);
+ int getProfilePath(int cbName, TCHAR* pszName);
+ int getProfileName(int cbName, TCHAR* pszName);
void setSafetyMode(bool safetyMode);
}
@@ -139,7 +37,7 @@ namespace mu
namespace db_contact
{
- int enumSettings(MCONTACT hContact, const mu_ansi* szModule, DBSETTINGENUMPROC pEnumProc, LPARAM lProcParam);
+ int enumSettings(MCONTACT hContact, const char* szModule, DBSETTINGENUMPROC pEnumProc, LPARAM lProcParam);
int getCount();
}
@@ -159,20 +57,9 @@ namespace mu
namespace icolib
{
bool _available();
- void addIcon(const mu_text* szSection, const mu_text* szDescription, const mu_ansi* szIconName, const mu_ansi* szDefaultFile, int iDefaultIndex, int cx = 16, int cy = 16);
- void addIcon(const mu_text* szSection, const mu_text* szDescription, const mu_ansi* szIconName, HICON hDefaultIcon, int cx = 16, int cy = 16);
- HICON getIcon(const mu_ansi* szIconName);
- }
-
- /*
- * langpack
- */
-
- namespace langpack
- {
- int translateDialog(HWND hwndDlg, DWORD flags = 0, const int* ignoreControls = NULL);
- const mu_text* translateString(const mu_text* szEnglish);
- UINT getCodePage();
+ void addIcon(const TCHAR* szSection, const TCHAR* szDescription, const char* szIconName, const char* szDefaultFile, int iDefaultIndex, int cx = 16, int cy = 16);
+ void addIcon(const TCHAR* szSection, const TCHAR* szDescription, const char* szIconName, HICON hDefaultIcon, int cx = 16, int cy = 16);
+ HICON getIcon(const char* szIconName);
}
/*
@@ -192,7 +79,7 @@ namespace mu
namespace opt
{
- void addPage(WPARAM addInfo, const mu_text* pszGroup, const mu_text* pszTitle, const mu_text* pszTab, DLGPROC pfnDlgProc, const mu_ansi* pszTemplate, HINSTANCE hInstance, DWORD flags = ODPF_BOLDGROUPS);
+ void addPage(WPARAM addInfo, const TCHAR* pszGroup, const TCHAR* pszTitle, const TCHAR* pszTab, DLGPROC pfnDlgProc, const char* pszTemplate, HINSTANCE hInstance, DWORD flags = ODPF_BOLDGROUPS);
}
/*
@@ -212,7 +99,7 @@ namespace mu
namespace proto
{
int enumProtocols(int* numProtocols, PROTOACCOUNT*** ppProtoDescriptors);
- const mu_ansi* getContactBaseProto(MCONTACT hContact);
+ const char* getContactBaseProto(MCONTACT hContact);
}
/*
@@ -221,9 +108,9 @@ namespace mu
namespace protosvc
{
- DWORD getCaps(const mu_ansi* szProto, int flagNum);
- int getName(const mu_ansi* szProto, int cchName, mu_text* szName);
- HICON loadIcon(const mu_ansi* szProto, int whichIcon);
+ DWORD getCaps(const char* szProto, int flagNum);
+ //int getName(const char* szProto, int cchName, char* szName);
+ HICON loadIcon(const char* szProto, int whichIcon);
}
/*
@@ -242,7 +129,7 @@ namespace mu
namespace system
{
DWORD getVersion();
- int getVersionText(int cchVersion, mu_ansi* szVersion);
+ int getVersionText(int cchVersion, char* szVersion);
int terminated();
}
@@ -262,8 +149,8 @@ namespace mu
namespace utils
{
- int pathToRelative(const mu_text* pszPath, mu_text* pszNewPath);
- int pathToAbsolute(const mu_text* pszPath, mu_text* pszNewPath);
+ int pathToRelative(const TCHAR* pszPath, TCHAR* pszNewPath);
+ int pathToAbsolute(const TCHAR* pszPath, TCHAR* pszNewPath);
}
/*
@@ -280,12 +167,12 @@ namespace mu
* string handling
*/
- mu_ansi* wideToAnsiDup(const mu_wide* pszWide, UINT uCP = CP_ACP);
- mu_wide* ansiToWideDup(const mu_ansi* pszAnsi, UINT uCP = CP_ACP);
- mu_ansi* wideToAnsi(const mu_wide* pszWide, mu_ansi* pszRes, int maxLen, UINT uCP = CP_ACP);
- mu_wide* ansiToWide(const mu_ansi* pszAnsi, mu_wide* pszRes, int maxLen, UINT uCP = CP_ACP);
- inline void freeWide(mu_wide* pszWide) { free(pszWide); }
- inline void freeAnsi(mu_ansi* pszAnsi) { free(pszAnsi); }
+ char* wideToAnsiDup(const WCHAR* pszWide, UINT uCP = CP_ACP);
+ WCHAR* ansiToWideDup(const char* pszAnsi, UINT uCP = CP_ACP);
+ char* wideToAnsi(const WCHAR* pszWide, char* pszRes, int maxLen, UINT uCP = CP_ACP);
+ WCHAR* ansiToWide(const char* pszAnsi, WCHAR* pszRes, int maxLen, UINT uCP = CP_ACP);
+ inline void freeWide(WCHAR* pszWide) { free(pszWide); }
+ inline void freeAnsi(char* pszAnsi) { free(pszAnsi); }
}
#endif // HISTORYSTATS_GUARD_MU_COMMON_H
diff --git a/plugins/HistoryStats/src/optionsctrl.cpp b/plugins/HistoryStats/src/optionsctrl.cpp
index dd0d077f26..5fa9ab6d6a 100644
--- a/plugins/HistoryStats/src/optionsctrl.cpp
+++ b/plugins/HistoryStats/src/optionsctrl.cpp
@@ -7,106 +7,98 @@
* OptionsCtrl
*/
-HANDLE OptionsCtrl::insertGroup(HANDLE hParent, const mu_text* szLabel, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
+HANDLE OptionsCtrl::insertGroup(HANDLE hParent, const TCHAR* szLabel, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
{
OCGROUP ocg;
-
ocg.dwFlags = dwFlags;
- ocg.szLabel = const_cast<mu_text*>(szLabel);
+ ocg.szLabel = const_cast<TCHAR*>(szLabel);
ocg.dwData = dwData;
return reinterpret_cast<HANDLE>(SendMessage(m_hOptWnd, OCM_INSERTGROUP, reinterpret_cast<WPARAM>(hParent), reinterpret_cast<LPARAM>(&ocg)));
}
-HANDLE OptionsCtrl::insertCheck(HANDLE hParent, const mu_text* szLabel, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
+HANDLE OptionsCtrl::insertCheck(HANDLE hParent, const TCHAR* szLabel, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
{
OCCHECK occ;
-
occ.dwFlags = dwFlags;
- occ.szLabel = const_cast<mu_text*>(szLabel);
+ occ.szLabel = const_cast<TCHAR*>(szLabel);
occ.dwData = dwData;
return reinterpret_cast<HANDLE>(SendMessage(m_hOptWnd, OCM_INSERTCHECK, reinterpret_cast<WPARAM>(hParent), reinterpret_cast<LPARAM>(&occ)));
}
-HANDLE OptionsCtrl::insertRadio(HANDLE hParent, HANDLE hSibling, const mu_text* szLabel, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
+HANDLE OptionsCtrl::insertRadio(HANDLE hParent, HANDLE hSibling, const TCHAR* szLabel, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
{
OCRADIO ocr;
-
ocr.dwFlags = dwFlags;
- ocr.szLabel = const_cast<mu_text*>(szLabel);
+ ocr.szLabel = const_cast<TCHAR*>(szLabel);
ocr.dwData = dwData;
ocr.hSibling = hSibling;
return reinterpret_cast<HANDLE>(SendMessage(m_hOptWnd, OCM_INSERTRADIO, reinterpret_cast<WPARAM>(hParent), reinterpret_cast<LPARAM>(&ocr)));
}
-HANDLE OptionsCtrl::insertEdit(HANDLE hParent, const mu_text* szLabel, const mu_text* szEdit /* = muT("") */, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
+HANDLE OptionsCtrl::insertEdit(HANDLE hParent, const TCHAR* szLabel, const TCHAR* szEdit /* = _T("") */, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
{
OCEDIT oce;
-
oce.dwFlags = dwFlags;
- oce.szLabel = const_cast<mu_text*>(szLabel);
+ oce.szLabel = const_cast<TCHAR*>(szLabel);
oce.dwData = dwData;
- oce.szEdit = const_cast<mu_text*>(szEdit);
+ oce.szEdit = const_cast<TCHAR*>(szEdit);
return reinterpret_cast<HANDLE>(SendMessage(m_hOptWnd, OCM_INSERTEDIT, reinterpret_cast<WPARAM>(hParent), reinterpret_cast<LPARAM>(&oce)));
}
-HANDLE OptionsCtrl::insertCombo(HANDLE hParent, const mu_text* szLabel, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
+HANDLE OptionsCtrl::insertCombo(HANDLE hParent, const TCHAR* szLabel, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
{
OCCOMBO occ;
-
occ.dwFlags = dwFlags;
- occ.szLabel = const_cast<mu_text*>(szLabel);
+ occ.szLabel = const_cast<TCHAR*>(szLabel);
occ.dwData = dwData;
return reinterpret_cast<HANDLE>(SendMessage(m_hOptWnd, OCM_INSERTCOMBO, reinterpret_cast<WPARAM>(hParent), reinterpret_cast<LPARAM>(&occ)));
}
-HANDLE OptionsCtrl::insertButton(HANDLE hParent, const mu_text* szLabel, const mu_text* szButton, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
+HANDLE OptionsCtrl::insertButton(HANDLE hParent, const TCHAR* szLabel, const TCHAR* szButton, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
{
OCBUTTON ocb;
-
ocb.dwFlags = dwFlags;
- ocb.szLabel = const_cast<mu_text*>(szLabel);
+ ocb.szLabel = const_cast<TCHAR*>(szLabel);
ocb.dwData = dwData;
- ocb.szButton = const_cast<mu_text*>(szButton);
+ ocb.szButton = const_cast<TCHAR*>(szButton);
return reinterpret_cast<HANDLE>(SendMessage(m_hOptWnd, OCM_INSERTBUTTON, reinterpret_cast<WPARAM>(hParent), reinterpret_cast<LPARAM>(&ocb)));
}
-HANDLE OptionsCtrl::insertDateTime(HANDLE hParent, const mu_text* szLabel, DWORD dwDateTime, const mu_text* szFormat /* = muT("%Y-%m-%d") */, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
+HANDLE OptionsCtrl::insertDateTime(HANDLE hParent, const TCHAR* szLabel, DWORD dwDateTime, const TCHAR* szFormat /* = _T("%Y-%m-%d") */, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
{
OCDATETIME ocdt;
-
ocdt.dwFlags = dwFlags;
- ocdt.szLabel = const_cast<mu_text*>(szLabel);
+ ocdt.szLabel = const_cast<TCHAR*>(szLabel);
ocdt.dwData = dwData;
- ocdt.szFormat = const_cast<mu_text*>(szFormat);
+ ocdt.szFormat = const_cast<TCHAR*>(szFormat);
ocdt.dwDateTime = dwDateTime;
return reinterpret_cast<HANDLE>(SendMessage(m_hOptWnd, OCM_INSERTDATETIME, reinterpret_cast<WPARAM>(hParent), reinterpret_cast<LPARAM>(&ocdt)));
}
-HANDLE OptionsCtrl::insertColor(HANDLE hParent, const mu_text* szLabel, COLORREF crColor /* = 0 */, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
+HANDLE OptionsCtrl::insertColor(HANDLE hParent, const TCHAR* szLabel, COLORREF crColor /* = 0 */, DWORD dwFlags /* = 0 */, DWORD dwData /* = 0 */)
{
OCCOLOR occ;
-
occ.dwFlags = dwFlags;
- occ.szLabel = const_cast<mu_text*>(szLabel);
+ occ.szLabel = const_cast<TCHAR*>(szLabel);
occ.dwData = dwData;
occ.crColor = crColor;
return reinterpret_cast<HANDLE>(SendMessage(m_hOptWnd, OCM_INSERTCOLOR, reinterpret_cast<WPARAM>(hParent), reinterpret_cast<LPARAM>(&occ)));
}
-const mu_text* OptionsCtrl::getItemLabel(HANDLE hItem)
+const TCHAR* OptionsCtrl::getItemLabel(HANDLE hItem)
{
- return reinterpret_cast<const mu_text*>(SendMessage(m_hOptWnd, OCM_GETITEMLABEL, reinterpret_cast<WPARAM>(hItem), 0));
+ return reinterpret_cast<const TCHAR*>(SendMessage(m_hOptWnd, OCM_GETITEMLABEL, reinterpret_cast<WPARAM>(hItem), 0));
}
-void OptionsCtrl::setItemLabel(HANDLE hItem, const mu_text* szLabel)
+void OptionsCtrl::setItemLabel(HANDLE hItem, const TCHAR* szLabel)
{
SendMessage(m_hOptWnd, OCM_SETITEMLABEL, reinterpret_cast<WPARAM>(hItem), reinterpret_cast<LPARAM>(szLabel));
}
@@ -161,17 +153,17 @@ void OptionsCtrl::setEditNumber(HANDLE hEdit, int nNumber)
SendMessage(m_hOptWnd, OCM_SETEDITNUMBER, reinterpret_cast<WPARAM>(hEdit), nNumber);
}
-const mu_text* OptionsCtrl::getEditString(HANDLE hEdit)
+const TCHAR* OptionsCtrl::getEditString(HANDLE hEdit)
{
- return reinterpret_cast<const mu_text*>(SendMessage(m_hOptWnd, OCM_GETEDITSTRING, reinterpret_cast<WPARAM>(hEdit), 0));
+ return reinterpret_cast<const TCHAR*>(SendMessage(m_hOptWnd, OCM_GETEDITSTRING, reinterpret_cast<WPARAM>(hEdit), 0));
}
-void OptionsCtrl::setEditString(HANDLE hEdit, const mu_text* szString)
+void OptionsCtrl::setEditString(HANDLE hEdit, const TCHAR* szString)
{
SendMessage(m_hOptWnd, OCM_SETEDITSTRING, reinterpret_cast<WPARAM>(hEdit), reinterpret_cast<LPARAM>(szString));
}
-void OptionsCtrl::addComboItem(HANDLE hCombo, const mu_text* szItem)
+void OptionsCtrl::addComboItem(HANDLE hCombo, const TCHAR* szItem)
{
SendMessage(m_hOptWnd, OCM_ADDCOMBOITEM, reinterpret_cast<WPARAM>(hCombo), reinterpret_cast<LPARAM>(szItem));
}
@@ -218,7 +210,7 @@ HANDLE OptionsCtrl::getNextItem(HANDLE hItem)
HANDLE OptionsCtrl::getPrevItem(HANDLE hItem)
{
- return reinterpret_cast<HANDLE>(SendMessage(m_hOptWnd, OCM_GETITEM,reinterpret_cast<WPARAM>(hItem), OCGI_PREV));
+ return reinterpret_cast<HANDLE>(SendMessage(m_hOptWnd, OCM_GETITEM, reinterpret_cast<WPARAM>(hItem), OCGI_PREV));
}
void OptionsCtrl::setRedraw(bool bRedraw)
@@ -262,9 +254,7 @@ DWORD OptionsCtrl::getDateTime(HANDLE hDateTime, bool* pbNone /* = NULL */)
DWORD dwResult = SendMessage(m_hOptWnd, OCM_GETDATETIME, reinterpret_cast<WPARAM>(hDateTime), reinterpret_cast<LPARAM>(&bMyNone));
if (pbNone)
- {
*pbNone = bool_(bMyNone);
- }
return dwResult;
}
@@ -280,19 +270,15 @@ ext::string OptionsCtrl::getDateTimeStr(HANDLE hDateTime)
bool bNone = false;
DWORD dwTimestamp = getDateTime(hDateTime, &bNone);
- return bNone ? muT("") : utils::formatDate(dwTimestamp);
+ return bNone ? _T("") : utils::formatDate(dwTimestamp);
}
void OptionsCtrl::setDateTimeStr(HANDLE hDateTime, const ext::string& strDateTime)
{
if (strDateTime.empty())
- {
setDateTimeNone(hDateTime);
- }
else
- {
setDateTime(hDateTime, utils::parseDate(strDateTime));
- }
}
COLORREF OptionsCtrl::getColor(HANDLE hColor)
diff --git a/plugins/HistoryStats/src/optionsctrl.h b/plugins/HistoryStats/src/optionsctrl.h
index 40ec04df0e..9f45c7b048 100644
--- a/plugins/HistoryStats/src/optionsctrl.h
+++ b/plugins/HistoryStats/src/optionsctrl.h
@@ -39,16 +39,16 @@ public:
operator HWND() { return m_hOptWnd; }
public:
- HANDLE insertGroup(HANDLE hParent, const mu_text* szLabel, DWORD dwFlags = 0, DWORD dwData = 0);
- HANDLE insertCheck(HANDLE hParent, const mu_text* szLabel, DWORD dwFlags = 0, DWORD dwData = 0);
- HANDLE insertRadio(HANDLE hParent, HANDLE hSibling, const mu_text* szLabel, DWORD dwFlags = 0, DWORD dwData = 0);
- HANDLE insertEdit(HANDLE hParent, const mu_text* szLabel, const mu_text* szEdit = muT(""), DWORD dwFlags = 0, DWORD dwData = 0);
- HANDLE insertCombo(HANDLE hParent, const mu_text* szLabel, DWORD dwFlags = 0, DWORD dwData = 0);
- HANDLE insertButton(HANDLE hParent, const mu_text* szLabel, const mu_text* szButton, DWORD dwFlags = 0, DWORD dwData = 0);
- HANDLE insertDateTime(HANDLE hParent, const mu_text* szLabel, DWORD dwDateTime, const mu_text* szFormat = muT("%Y-%m-%d"), DWORD dwFlags = 0, DWORD dwData = 0);
- HANDLE insertColor(HANDLE hParent, const mu_text* szLabel, COLORREF crColor = 0, DWORD dwFlags = 0, DWORD dwData = 0);
- const mu_text* getItemLabel(HANDLE hItem);
- void setItemLabel(HANDLE hItem, const mu_text* szLabel);
+ HANDLE insertGroup(HANDLE hParent, const TCHAR* szLabel, DWORD dwFlags = 0, DWORD dwData = 0);
+ HANDLE insertCheck(HANDLE hParent, const TCHAR* szLabel, DWORD dwFlags = 0, DWORD dwData = 0);
+ HANDLE insertRadio(HANDLE hParent, HANDLE hSibling, const TCHAR* szLabel, DWORD dwFlags = 0, DWORD dwData = 0);
+ HANDLE insertEdit(HANDLE hParent, const TCHAR* szLabel, const TCHAR* szEdit = _T(""), DWORD dwFlags = 0, DWORD dwData = 0);
+ HANDLE insertCombo(HANDLE hParent, const TCHAR* szLabel, DWORD dwFlags = 0, DWORD dwData = 0);
+ HANDLE insertButton(HANDLE hParent, const TCHAR* szLabel, const TCHAR* szButton, DWORD dwFlags = 0, DWORD dwData = 0);
+ HANDLE insertDateTime(HANDLE hParent, const TCHAR* szLabel, DWORD dwDateTime, const TCHAR* szFormat = _T("%Y-%m-%d"), DWORD dwFlags = 0, DWORD dwData = 0);
+ HANDLE insertColor(HANDLE hParent, const TCHAR* szLabel, COLORREF crColor = 0, DWORD dwFlags = 0, DWORD dwData = 0);
+ const TCHAR* getItemLabel(HANDLE hItem);
+ void setItemLabel(HANDLE hItem, const TCHAR* szLabel);
bool isItemEnabled(HANDLE hItem);
void enableItem(HANDLE hItem, bool bEnable);
DWORD getItemData(HANDLE hItem);
@@ -59,9 +59,9 @@ public:
void setRadioChecked(HANDLE hRadio, int nCheck);
int getEditNumber(HANDLE hEdit);
void setEditNumber(HANDLE hEdit, int nNumber);
- const mu_text* getEditString(HANDLE hEdit);
- void setEditString(HANDLE hEdit, const mu_text* szString);
- void addComboItem(HANDLE hCombo, const mu_text* szItem);
+ const TCHAR* getEditString(HANDLE hEdit);
+ void setEditString(HANDLE hEdit, const TCHAR* szString);
+ void addComboItem(HANDLE hCombo, const TCHAR* szItem);
int getComboSelected(HANDLE hCombo);
void setComboSelected(HANDLE hCombo, int nSelect);
void ensureVisible(HANDLE hItem);
diff --git a/plugins/HistoryStats/src/optionsctrldefs.h b/plugins/HistoryStats/src/optionsctrldefs.h
index 0bc50b1b18..2b6bbe3f33 100644
--- a/plugins/HistoryStats/src/optionsctrldefs.h
+++ b/plugins/HistoryStats/src/optionsctrldefs.h
@@ -17,8 +17,8 @@ public:
OCM_INSERTEDIT = WM_USER + 3, // (HANDLE hParent, OCEDIT* pEdit) -> HANDLE hEdit [Edit]
OCM_INSERTCOMBO = WM_USER + 4, // (HANDLE hParent, OCCOMBO* pCombo) -> HANDLE hCombo [Combo]
OCM_INSERTBUTTON = WM_USER + 5, // (HANDLE hParent, OCBUTTON* pButton) -> HANDLE hButton [Button]
- OCM_GETITEMLABEL = WM_USER + 6, // (HANDLE hItem, #) -> const mu_text* szLabel
- OCM_SETITEMLABEL = WM_USER + 7, // (HANDLE hItem, const mu_text* szLabel) -> #
+ OCM_GETITEMLABEL = WM_USER + 6, // (HANDLE hItem, #) -> const TCHAR* szLabel
+ OCM_SETITEMLABEL = WM_USER + 7, // (HANDLE hItem, const TCHAR* szLabel) -> #
OCM_ISITEMENABLED = WM_USER + 8, // (HANDLE hItem, #) -> BOOL bEnabled
OCM_ENABLEITEM = WM_USER + 9, // (HANDLE hItem, BOOL bEnable) -> #
OCM_GETITEMDATA = WM_USER + 10, // (HANDLE hItem, #) -> DWORD dwData
@@ -29,9 +29,9 @@ public:
OCM_SETRADIOCHECKED = WM_USER + 15, // (HANDLE hRadio, int nCheck) -> # [Radio]
OCM_GETEDITNUMBER = WM_USER + 16, // (HANDLE hEdit, #) -> int nNumber [Edit]
OCM_SETEDITNUMBER = WM_USER + 17, // (HANDLE hEdit, int nNumber) -> # [Edit]
- OCM_GETEDITSTRING = WM_USER + 18, // (HANDLE hEdit, #) -> const mu_text* szString [Edit]
- OCM_SETEDITSTRING = WM_USER + 19, // (HANDLE hEdit, const mu_text* szString) -> # [Edit]
- OCM_ADDCOMBOITEM = WM_USER + 20, // (HANDLE hCombo, const mu_text* szItem) -> # [Combo]
+ OCM_GETEDITSTRING = WM_USER + 18, // (HANDLE hEdit, #) -> const TCHAR* szString [Edit]
+ OCM_SETEDITSTRING = WM_USER + 19, // (HANDLE hEdit, const TCHAR* szString) -> # [Edit]
+ OCM_ADDCOMBOITEM = WM_USER + 20, // (HANDLE hCombo, const TCHAR* szItem) -> # [Combo]
OCM_GETCOMBOSELECTED = WM_USER + 21, // (HANDLE hCombo, #) -> int nSelected [Combo]
OCM_SETCOMBOSELECTED = WM_USER + 22, // (HANDLE hCombo, int nSelect) -> # [Combo]
OCM_ENSUREVISIBLE = WM_USER + 23, // (HANDLE hItem, #) -> #
@@ -89,54 +89,54 @@ public:
struct OCGROUP {
DWORD dwFlags;
- mu_text* szLabel;
+ TCHAR* szLabel;
DWORD dwData;
};
struct OCCHECK {
DWORD dwFlags;
- mu_text* szLabel;
+ TCHAR* szLabel;
DWORD dwData;
};
struct OCRADIO {
DWORD dwFlags;
- mu_text* szLabel;
+ TCHAR* szLabel;
DWORD dwData;
HANDLE hSibling;
};
struct OCEDIT {
DWORD dwFlags;
- mu_text* szLabel;
+ TCHAR* szLabel;
DWORD dwData;
- mu_text* szEdit;
+ TCHAR* szEdit;
};
struct OCCOMBO {
DWORD dwFlags;
- mu_text* szLabel;
+ TCHAR* szLabel;
DWORD dwData;
};
struct OCBUTTON {
DWORD dwFlags;
- mu_text* szLabel;
+ TCHAR* szLabel;
DWORD dwData;
- mu_text* szButton;
+ TCHAR* szButton;
};
struct OCDATETIME {
DWORD dwFlags;
- mu_text* szLabel;
+ TCHAR* szLabel;
DWORD dwData;
- mu_text* szFormat;
+ TCHAR* szFormat;
DWORD dwDateTime;
};
struct OCCOLOR {
DWORD dwFlags;
- mu_text* szLabel;
+ TCHAR* szLabel;
DWORD dwData;
COLORREF crColor;
};
diff --git a/plugins/HistoryStats/src/optionsctrlimpl.cpp b/plugins/HistoryStats/src/optionsctrlimpl.cpp
index 46d63e8c58..445fc10340 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl.cpp
@@ -8,7 +8,7 @@
* OptionsCtrlImpl
*/
-const mu_text* OptionsCtrlImpl::m_ClassName = muT("HistoryStatsOptions");
+const TCHAR* OptionsCtrlImpl::m_ClassName = _T("HistoryStatsOptions");
HIMAGELIST OptionsCtrlImpl::m_hStateIcons = NULL;
int OptionsCtrlImpl::m_nStateIconsRef = 0;
@@ -16,256 +16,245 @@ LRESULT CALLBACK OptionsCtrlImpl::staticWndProc(HWND hWnd, UINT msg, WPARAM wPar
{
OptionsCtrlImpl* pCtrl = reinterpret_cast<OptionsCtrlImpl*>(GetWindowLong(hWnd, 0));
- switch (msg)
- {
- case WM_NCCREATE:
- {
- CREATESTRUCT* pCS = reinterpret_cast<CREATESTRUCT*>(lParam);
-
- pCS->style &= ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
- pCS->style |= WS_CHILD;
- pCS->dwExStyle &= ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE | WS_EX_WINDOWEDGE);
-
- pCtrl = new OptionsCtrlImpl(hWnd, reinterpret_cast<int>(pCS->hMenu));
- SetWindowLong(hWnd, 0, reinterpret_cast<LONG>(pCtrl));
-
- return pCtrl ? TRUE : FALSE;
- }
+ switch (msg) {
+ case WM_NCCREATE:
+ {
+ CREATESTRUCT* pCS = reinterpret_cast<CREATESTRUCT*>(lParam);
- case WM_CREATE:
- return pCtrl->onWMCreate(reinterpret_cast<CREATESTRUCT*>(lParam));
+ pCS->style &= ~(WS_BORDER | WS_HSCROLL | WS_VSCROLL);
+ pCS->style |= WS_CHILD;
+ pCS->dwExStyle &= ~(WS_EX_CLIENTEDGE | WS_EX_STATICEDGE | WS_EX_WINDOWEDGE);
- case WM_DESTROY:
- pCtrl->onWMDestroy();
- delete pCtrl;
- SetWindowLong(hWnd, 0, 0);
- return 0;
-
- case WM_SETFOCUS:
- SetFocus(pCtrl->m_hTree);
- return 0;
+ pCtrl = new OptionsCtrlImpl(hWnd, reinterpret_cast<int>(pCS->hMenu));
+ SetWindowLong(hWnd, 0, reinterpret_cast<LONG>(pCtrl));
+ }
+ return pCtrl ? TRUE : FALSE;
- case WM_ENABLE:
- EnableWindow(pCtrl->m_hTree, wParam);
- return 0;
+ case WM_CREATE:
+ return pCtrl->onWMCreate(reinterpret_cast<CREATESTRUCT*>(lParam));
- case WM_GETFONT:
- return SendMessage(pCtrl->m_hTree, WM_GETFONT, wParam, lParam);
+ case WM_DESTROY:
+ pCtrl->onWMDestroy();
+ delete pCtrl;
+ SetWindowLong(hWnd, 0, 0);
+ return 0;
- case WM_SETFONT:
- return SendMessage(pCtrl->m_hTree, WM_SETFONT, wParam, lParam);
+ case WM_SETFOCUS:
+ SetFocus(pCtrl->m_hTree);
+ return 0;
- case WM_WINDOWPOSCHANGED:
- {
- WINDOWPOS* pWP = reinterpret_cast<WINDOWPOS*>(lParam);
+ case WM_ENABLE:
+ EnableWindow(pCtrl->m_hTree, wParam);
+ return 0;
- SetWindowPos(pCtrl->m_hTree, NULL, 0, 0, pWP->cx, pWP->cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
+ case WM_GETFONT:
+ return SendMessage(pCtrl->m_hTree, WM_GETFONT, wParam, lParam);
- return 0;
- }
+ case WM_SETFONT:
+ return SendMessage(pCtrl->m_hTree, WM_SETFONT, wParam, lParam);
- case WM_SETREDRAW:
- return SendMessage(pCtrl->m_hTree, WM_SETREDRAW, wParam, lParam);
+ case WM_WINDOWPOSCHANGED:
+ {
+ WINDOWPOS* pWP = reinterpret_cast<WINDOWPOS*>(lParam);
+ SetWindowPos(pCtrl->m_hTree, NULL, 0, 0, pWP->cx, pWP->cy, SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);
+ }
+ return 0;
- case WM_NOTIFY:
- {
- NMHDR* pNM = reinterpret_cast<NMHDR*>(lParam);
+ case WM_SETREDRAW:
+ return SendMessage(pCtrl->m_hTree, WM_SETREDRAW, wParam, lParam);
- if (pNM->hwndFrom == pCtrl->m_hTree)
- {
- switch (pNM->code)
- {
- case NM_CLICK:
- pCtrl->onNMClick();
- return 0;
+ case WM_NOTIFY:
+ {
+ NMHDR* pNM = reinterpret_cast<NMHDR*>(lParam);
+ if (pNM->hwndFrom == pCtrl->m_hTree) {
+ switch (pNM->code) {
+ case NM_CLICK:
+ pCtrl->onNMClick();
+ return 0;
- case NM_CUSTOMDRAW:
- return pCtrl->onNMCustomDraw(reinterpret_cast<NMTVCUSTOMDRAW*>(pNM));
+ case NM_CUSTOMDRAW:
+ return pCtrl->onNMCustomDraw(reinterpret_cast<NMTVCUSTOMDRAW*>(pNM));
- case NM_KILLFOCUS:
- pCtrl->onNMKillFocus();
- return 0;
+ case NM_KILLFOCUS:
+ pCtrl->onNMKillFocus();
+ return 0;
- case TVN_ITEMEXPANDING:
- return pCtrl->onTVNItemExpanding(reinterpret_cast<NMTREEVIEW*>(pNM));
+ case TVN_ITEMEXPANDING:
+ return pCtrl->onTVNItemExpanding(reinterpret_cast<NMTREEVIEW*>(pNM));
- case TVN_DELETEITEM:
- pCtrl->onTVNDeleteItem(reinterpret_cast<NMTREEVIEW*>(pNM));
- return 0;
+ case TVN_DELETEITEM:
+ pCtrl->onTVNDeleteItem(reinterpret_cast<NMTREEVIEW*>(pNM));
+ return 0;
- case TVN_SELCHANGING:
- pCtrl->onTVNSelChanging(reinterpret_cast<NMTREEVIEW*>(pNM));
- return 0;
+ case TVN_SELCHANGING:
+ pCtrl->onTVNSelChanging(reinterpret_cast<NMTREEVIEW*>(pNM));
+ return 0;
- case TVN_SELCHANGED:
- pCtrl->onTVNSelChanged(reinterpret_cast<NMTREEVIEW*>(pNM));
- return 0;
+ case TVN_SELCHANGED:
+ pCtrl->onTVNSelChanged(reinterpret_cast<NMTREEVIEW*>(pNM));
+ return 0;
- case TVN_BEGINDRAG:
- pCtrl->onTVNBeginDrag(reinterpret_cast<NMTREEVIEW*>(pNM));
- return 0;
- }
+ case TVN_BEGINDRAG:
+ pCtrl->onTVNBeginDrag(reinterpret_cast<NMTREEVIEW*>(pNM));
+ return 0;
}
}
- break;
-
- case WM_MOUSEMOVE:
- {
- POINTS pts = MAKEPOINTS(lParam);
- POINT pt = { pts.x, pts.y };
-
- pCtrl->onWMMouseMove(pt);
-
- return 0;
- }
+ }
+ break;
- case WM_LBUTTONUP:
- {
- POINTS pts = MAKEPOINTS(lParam);
- POINT pt = { pts.x, pts.y };
+ case WM_MOUSEMOVE:
+ {
+ POINTS pts = MAKEPOINTS(lParam);
+ POINT pt = { pts.x, pts.y };
+ pCtrl->onWMMouseMove(pt);
+ }
+ return 0;
- pCtrl->onWMLButtonUp(pt);
+ case WM_LBUTTONUP:
+ {
+ POINTS pts = MAKEPOINTS(lParam);
+ POINT pt = { pts.x, pts.y };
+ pCtrl->onWMLButtonUp(pt);
+ }
+ return 0;
- return 0;
- }
+ case OCM_INSERTGROUP:
+ return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertGroup(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCGROUP*>(lParam)));
- case OCM_INSERTGROUP:
- return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertGroup(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCGROUP*>(lParam)));
+ case OCM_INSERTCHECK:
+ return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertCheck(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCCHECK*>(lParam)));
- case OCM_INSERTCHECK:
- return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertCheck(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCCHECK*>(lParam)));
+ case OCM_INSERTRADIO:
+ return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertRadio(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCRADIO*>(lParam)));
- case OCM_INSERTRADIO:
- return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertRadio(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCRADIO*>(lParam)));
+ case OCM_INSERTEDIT:
+ return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertEdit(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCEDIT*>(lParam)));
- case OCM_INSERTEDIT:
- return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertEdit(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCEDIT*>(lParam)));
+ case OCM_INSERTCOMBO:
+ return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertCombo(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCCOMBO*>(lParam)));
- case OCM_INSERTCOMBO:
- return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertCombo(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCCOMBO*>(lParam)));
+ case OCM_INSERTBUTTON:
+ return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertButton(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCBUTTON*>(lParam)));
- case OCM_INSERTBUTTON:
- return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertButton(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCBUTTON*>(lParam)));
+ case OCM_GETITEMLABEL:
+ return reinterpret_cast<LRESULT>(pCtrl->onOCMGetItemLabel(reinterpret_cast<HTREEITEM>(wParam)));
- case OCM_GETITEMLABEL:
- return reinterpret_cast<LRESULT>(pCtrl->onOCMGetItemLabel(reinterpret_cast<HTREEITEM>(wParam)));
+ case OCM_SETITEMLABEL:
+ pCtrl->onOCMSetItemLabel(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<const TCHAR*>(lParam));
+ return 0;
- case OCM_SETITEMLABEL:
- pCtrl->onOCMSetItemLabel(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<const mu_text*>(lParam));
- return 0;
+ case OCM_ISITEMENABLED:
+ return BOOL_(pCtrl->onOCMIsItemEnabled(reinterpret_cast<HTREEITEM>(wParam)));
- case OCM_ISITEMENABLED:
- return BOOL_(pCtrl->onOCMIsItemEnabled(reinterpret_cast<HTREEITEM>(wParam)));
+ case OCM_ENABLEITEM:
+ pCtrl->onOCMEnableItem(reinterpret_cast<HTREEITEM>(wParam), bool_(lParam));
+ return 0;
- case OCM_ENABLEITEM:
- pCtrl->onOCMEnableItem(reinterpret_cast<HTREEITEM>(wParam), bool_(lParam));
- return 0;
+ case OCM_GETITEMDATA:
+ return pCtrl->onOCMGetItemData(reinterpret_cast<HTREEITEM>(wParam));
- case OCM_GETITEMDATA:
- return pCtrl->onOCMGetItemData(reinterpret_cast<HTREEITEM>(wParam));
+ case OCM_SETITEMDATA:
+ pCtrl->onOCMSetItemData(reinterpret_cast<HTREEITEM>(wParam), lParam);
+ return 0;
- case OCM_SETITEMDATA:
- pCtrl->onOCMSetItemData(reinterpret_cast<HTREEITEM>(wParam), lParam);
- return 0;
+ case OCM_ISITEMCHECKED:
+ return BOOL_(pCtrl->onOCMIsItemChecked(reinterpret_cast<HTREEITEM>(wParam)));
- case OCM_ISITEMCHECKED:
- return BOOL_(pCtrl->onOCMIsItemChecked(reinterpret_cast<HTREEITEM>(wParam)));
+ case OCM_CHECKITEM:
+ pCtrl->onOCMCheckItem(reinterpret_cast<HTREEITEM>(wParam), bool_(lParam));
+ return 0;
- case OCM_CHECKITEM:
- pCtrl->onOCMCheckItem(reinterpret_cast<HTREEITEM>(wParam), bool_(lParam));
- return 0;
+ case OCM_GETRADIOCHECKED:
+ return pCtrl->onOCMGetRadioChecked(reinterpret_cast<HTREEITEM>(wParam));
- case OCM_GETRADIOCHECKED:
- return pCtrl->onOCMGetRadioChecked(reinterpret_cast<HTREEITEM>(wParam));
+ case OCM_SETRADIOCHECKED:
+ pCtrl->onOCMSetRadioChecked(reinterpret_cast<HTREEITEM>(wParam), lParam);
+ return 0;
- case OCM_SETRADIOCHECKED:
- pCtrl->onOCMSetRadioChecked(reinterpret_cast<HTREEITEM>(wParam), lParam);
- return 0;
+ case OCM_GETEDITNUMBER:
+ return pCtrl->onOCMGetEditNumber(reinterpret_cast<HTREEITEM>(wParam));
- case OCM_GETEDITNUMBER:
- return pCtrl->onOCMGetEditNumber(reinterpret_cast<HTREEITEM>(wParam));
+ case OCM_SETEDITNUMBER:
+ pCtrl->onOCMSetEditNumber(reinterpret_cast<HTREEITEM>(wParam), lParam);
+ return 0;
- case OCM_SETEDITNUMBER:
- pCtrl->onOCMSetEditNumber(reinterpret_cast<HTREEITEM>(wParam), lParam);
- return 0;
+ case OCM_GETEDITSTRING:
+ return reinterpret_cast<LPARAM>(pCtrl->onOCMGetEditString(reinterpret_cast<HTREEITEM>(wParam)));
- case OCM_GETEDITSTRING:
- return reinterpret_cast<LPARAM>(pCtrl->onOCMGetEditString(reinterpret_cast<HTREEITEM>(wParam)));
+ case OCM_SETEDITSTRING:
+ pCtrl->onOCMSetEditString(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<const TCHAR*>(lParam));
+ return 0;
- case OCM_SETEDITSTRING:
- pCtrl->onOCMSetEditString(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<const mu_text*>(lParam));
- return 0;
+ case OCM_ADDCOMBOITEM:
+ pCtrl->onOCMAddComboItem(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<const TCHAR*>(lParam));
+ return 0;
- case OCM_ADDCOMBOITEM:
- pCtrl->onOCMAddComboItem(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<const mu_text*>(lParam));
- return 0;
-
- case OCM_GETCOMBOSELECTED:
- return pCtrl->onOCMGetComboSelected(reinterpret_cast<HTREEITEM>(wParam));
+ case OCM_GETCOMBOSELECTED:
+ return pCtrl->onOCMGetComboSelected(reinterpret_cast<HTREEITEM>(wParam));
- case OCM_SETCOMBOSELECTED:
- pCtrl->onOCMSetComboSelected(reinterpret_cast<HTREEITEM>(wParam), lParam);
- return 0;
+ case OCM_SETCOMBOSELECTED:
+ pCtrl->onOCMSetComboSelected(reinterpret_cast<HTREEITEM>(wParam), lParam);
+ return 0;
- case OCM_ENSUREVISIBLE:
- pCtrl->onOCMEnsureVisible(reinterpret_cast<HTREEITEM>(wParam));
- return 0;
+ case OCM_ENSUREVISIBLE:
+ pCtrl->onOCMEnsureVisible(reinterpret_cast<HTREEITEM>(wParam));
+ return 0;
- case OCM_DELETEALLITEMS:
- pCtrl->onOCMDeleteAllItems();
- return 0;
+ case OCM_DELETEALLITEMS:
+ pCtrl->onOCMDeleteAllItems();
+ return 0;
- case OCM_GETSELECTION:
- return reinterpret_cast<LRESULT>(pCtrl->onOCMGetSelection());
+ case OCM_GETSELECTION:
+ return reinterpret_cast<LRESULT>(pCtrl->onOCMGetSelection());
- case OCM_SELECTITEM:
- pCtrl->onOCMSelectItem(reinterpret_cast<HTREEITEM>(wParam));
- return 0;
+ case OCM_SELECTITEM:
+ pCtrl->onOCMSelectItem(reinterpret_cast<HTREEITEM>(wParam));
+ return 0;
- case OCM_GETITEM:
- return reinterpret_cast<LRESULT>(pCtrl->onOCMGetItem(reinterpret_cast<HTREEITEM>(wParam), lParam));
+ case OCM_GETITEM:
+ return reinterpret_cast<LRESULT>(pCtrl->onOCMGetItem(reinterpret_cast<HTREEITEM>(wParam), lParam));
- case OCM_DELETEITEM:
- pCtrl->onOCMDeleteItem(reinterpret_cast<HTREEITEM>(wParam));
- return 0;
+ case OCM_DELETEITEM:
+ pCtrl->onOCMDeleteItem(reinterpret_cast<HTREEITEM>(wParam));
+ return 0;
- case OCM_MOVEITEM:
- pCtrl->onOCMMoveItem(*reinterpret_cast<HTREEITEM*>(wParam), reinterpret_cast<HTREEITEM>(lParam));
- return 0;
+ case OCM_MOVEITEM:
+ pCtrl->onOCMMoveItem(*reinterpret_cast<HTREEITEM*>(wParam), reinterpret_cast<HTREEITEM>(lParam));
+ return 0;
- case OCM_GETSCROLLPOS:
- return GetScrollPos(pCtrl->m_hTree, wParam);
+ case OCM_GETSCROLLPOS:
+ return GetScrollPos(pCtrl->m_hTree, wParam);
- case OCM_SETSCROLLPOS:
- SetScrollPos(pCtrl->m_hTree, wParam, lParam, TRUE);
- return 0;
+ case OCM_SETSCROLLPOS:
+ SetScrollPos(pCtrl->m_hTree, wParam, lParam, TRUE);
+ return 0;
- case OCM_INSERTDATETIME:
- return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertDateTime(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCDATETIME*>(lParam)));
+ case OCM_INSERTDATETIME:
+ return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertDateTime(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCDATETIME*>(lParam)));
- case OCM_ISDATETIMENONE:
- return BOOL_(pCtrl->onOCMIsDateTimeNone(reinterpret_cast<HTREEITEM>(wParam)));
+ case OCM_ISDATETIMENONE:
+ return BOOL_(pCtrl->onOCMIsDateTimeNone(reinterpret_cast<HTREEITEM>(wParam)));
- case OCM_SETDATETIMENONE:
- pCtrl->onOCMSetDateTimeNone(reinterpret_cast<HTREEITEM>(wParam));
- return 0;
+ case OCM_SETDATETIMENONE:
+ pCtrl->onOCMSetDateTimeNone(reinterpret_cast<HTREEITEM>(wParam));
+ return 0;
- case OCM_GETDATETIME:
- return pCtrl->onOCMGetDateTime(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<BOOL*>(lParam));
+ case OCM_GETDATETIME:
+ return pCtrl->onOCMGetDateTime(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<BOOL*>(lParam));
- case OCM_SETDATETIME:
- pCtrl->onOCMSetDateTime(reinterpret_cast<HTREEITEM>(wParam), lParam);
- return 0;
+ case OCM_SETDATETIME:
+ pCtrl->onOCMSetDateTime(reinterpret_cast<HTREEITEM>(wParam), lParam);
+ return 0;
- case OCM_INSERTCOLOR:
- return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertColor(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCCOLOR*>(lParam)));
+ case OCM_INSERTCOLOR:
+ return reinterpret_cast<LRESULT>(pCtrl->onOCMInsertColor(reinterpret_cast<HTREEITEM>(wParam), reinterpret_cast<OCCOLOR*>(lParam)));
- case OCM_GETITEMCOLOR:
- return pCtrl->onOCMGetItemColor(reinterpret_cast<HTREEITEM>(wParam));
+ case OCM_GETITEMCOLOR:
+ return pCtrl->onOCMGetItemColor(reinterpret_cast<HTREEITEM>(wParam));
- case OCM_SETITEMCOLOR:
- pCtrl->onOCMSetItemColor(reinterpret_cast<HTREEITEM>(wParam), lParam);
- return 0;
+ case OCM_SETITEMCOLOR:
+ pCtrl->onOCMSetItemColor(reinterpret_cast<HTREEITEM>(wParam), lParam);
+ return 0;
}
return DefWindowProc(hWnd, msg, wParam, lParam);
@@ -275,91 +264,66 @@ LRESULT CALLBACK OptionsCtrlImpl::staticTreeProc(HWND hTree, UINT msg, WPARAM wP
{
OptionsCtrlImpl* pCtrl = reinterpret_cast<OptionsCtrlImpl*>(GetWindowLong(GetParent(hTree), 0));
- switch (msg)
- {
- case WM_LBUTTONDOWN:
- pCtrl->onTreeWMLButtonDown(wParam, MAKEPOINTS(lParam));
-
- case WM_CHAR:
- pCtrl->onTreeWMChar(wParam, LOWORD(lParam), HIWORD(lParam));
- break;
-
- case WM_KEYDOWN:
- pCtrl->onTreeWMKeyDown(wParam, LOWORD(lParam), HIWORD(lParam));
- break;
-
- case WM_VSCROLL:
- case WM_HSCROLL:
- case WM_MOUSEWHEEL:
- case WM_WINDOWPOSCHANGED:
- pCtrl->onTreeXScroll(); // stops editing
- break;
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case ccEdit:
- if (HIWORD(wParam) == EN_CHANGE)
- {
- pCtrl->onENChange();
- }
- else if (HIWORD(wParam) == EN_KILLFOCUS)
- {
- pCtrl->onNMKillFocus();
- }
- return 0;
-
- case ccCombo:
- if (HIWORD(wParam) == CBN_SELCHANGE)
- {
- pCtrl->onCBNSelChange();
- }
- else if (HIWORD(wParam) == CBN_KILLFOCUS)
- {
- pCtrl->onNMKillFocus();
- }
- return 0;
-
- case ccButton:
- if (HIWORD(wParam) == BN_CLICKED)
- {
- pCtrl->onBNClicked();
- }
- else if (HIWORD(wParam) == BN_KILLFOCUS)
- {
- pCtrl->onNMKillFocus();
- }
- return 0;
-
- case ccColor:
- if (HIWORD(wParam) == CPN_COLOURCHANGED)
- {
- pCtrl->onCPNColorChanged();
- }
- return 0;
- }
- }
- break;
-
- case WM_NOTIFY:
- {
- NMHDR* pNM = reinterpret_cast<NMHDR*>(lParam);
-
- if (pNM->idFrom == ccDateTime)
- {
- if (pNM->code == DTN_DATETIMECHANGE)
- {
- pCtrl->onDTNDateTimeChange();
- }
- else if (pNM->code == NM_KILLFOCUS)
- {
- pCtrl->onNMKillFocus();
- }
- return 0;
- }
- }
- break;
+ switch (msg) {
+ case WM_LBUTTONDOWN:
+ pCtrl->onTreeWMLButtonDown(wParam, MAKEPOINTS(lParam));
+
+ case WM_CHAR:
+ pCtrl->onTreeWMChar(wParam, LOWORD(lParam), HIWORD(lParam));
+ break;
+
+ case WM_KEYDOWN:
+ pCtrl->onTreeWMKeyDown(wParam, LOWORD(lParam), HIWORD(lParam));
+ break;
+
+ case WM_VSCROLL:
+ case WM_HSCROLL:
+ case WM_MOUSEWHEEL:
+ case WM_WINDOWPOSCHANGED:
+ pCtrl->onTreeXScroll(); // stops editing
+ break;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case ccEdit:
+ if (HIWORD(wParam) == EN_CHANGE)
+ pCtrl->onENChange();
+ else if (HIWORD(wParam) == EN_KILLFOCUS)
+ pCtrl->onNMKillFocus();
+ return 0;
+
+ case ccCombo:
+ if (HIWORD(wParam) == CBN_SELCHANGE)
+ pCtrl->onCBNSelChange();
+ else if (HIWORD(wParam) == CBN_KILLFOCUS)
+ pCtrl->onNMKillFocus();
+ return 0;
+
+ case ccButton:
+ if (HIWORD(wParam) == BN_CLICKED)
+ pCtrl->onBNClicked();
+ else if (HIWORD(wParam) == BN_KILLFOCUS)
+ pCtrl->onNMKillFocus();
+ return 0;
+
+ case ccColor:
+ if (HIWORD(wParam) == CPN_COLOURCHANGED)
+ pCtrl->onCPNColorChanged();
+ return 0;
+ }
+ break;
+
+ case WM_NOTIFY:
+ NMHDR* pNM = reinterpret_cast<NMHDR*>(lParam);
+
+ if (pNM->idFrom == ccDateTime) {
+ if (pNM->code == DTN_DATETIMECHANGE)
+ pCtrl->onDTNDateTimeChange();
+ else if (pNM->code == NM_KILLFOCUS)
+ pCtrl->onNMKillFocus();
+ return 0;
+ }
+ break;
}
return CallWindowProc(pCtrl->m_pfnOldTreeProc, hTree, msg, wParam, lParam);
@@ -367,8 +331,7 @@ LRESULT CALLBACK OptionsCtrlImpl::staticTreeProc(HWND hTree, UINT msg, WPARAM wP
void OptionsCtrlImpl::staticInitStateImages()
{
- if (m_nStateIconsRef++ == 0 && !m_hStateIcons)
- {
+ if (m_nStateIconsRef++ == 0 && !m_hStateIcons) {
m_hStateIcons = ImageList_Create(OS::smIconCX(), OS::smIconCY(), OS::imageListColor() | ILC_MASK, 16, 0);
staticUpdateStateImages(0);
@@ -378,8 +341,7 @@ void OptionsCtrlImpl::staticInitStateImages()
void OptionsCtrlImpl::staticFreeStateImages()
{
- if (m_hStateIcons && --m_nStateIconsRef == 0)
- {
+ if (m_hStateIcons && --m_nStateIconsRef == 0) {
IconLib::unregisterCallback(staticUpdateStateImages, 0);
ImageList_Destroy(m_hStateIcons);
@@ -436,19 +398,13 @@ bool OptionsCtrlImpl::registerClass()
};
if (!RegisterClassEx(&wcx))
- {
return false;
- }
INITCOMMONCONTROLSEX icc;
-
icc.dwSize = sizeof(icc);
icc.dwICC = ICC_DATE_CLASSES;
-
if (!InitCommonControlsEx(&icc))
- {
return false;
- }
return true;
}
@@ -458,8 +414,8 @@ void OptionsCtrlImpl::unregisterClass()
UnregisterClass(m_ClassName, g_hInst);
}
-OptionsCtrlImpl::OptionsCtrlImpl(HWND hWnd, int nOwnId)
- : m_hWnd(hWnd), m_nOwnId(nOwnId), m_hTree(NULL), m_pfnOldTreeProc(NULL), m_bModified(true), m_hDragItem(NULL)
+OptionsCtrlImpl::OptionsCtrlImpl(HWND hWnd, int nOwnId) :
+ m_hWnd(hWnd), m_nOwnId(nOwnId), m_hTree(NULL), m_pfnOldTreeProc(NULL), m_bModified(true), m_hDragItem(NULL)
{
}
@@ -472,14 +428,12 @@ LRESULT OptionsCtrlImpl::onWMCreate(CREATESTRUCT* pCS)
DWORD dwStyle = 0;
if (!(pCS->style & OCS_ALLOWDRAGDROP))
- {
dwStyle |= TVS_DISABLEDRAGDROP;
- }
m_hTree = CreateWindowEx(
WS_EX_CLIENTEDGE,
WC_TREEVIEW,
- muT(""),
+ _T(""),
WS_CHILD | WS_VISIBLE | WS_TABSTOP | TVS_HASLINES | TVS_NOHSCROLL | TVS_SHOWSELALWAYS | dwStyle,
0,
0,
@@ -491,9 +445,7 @@ LRESULT OptionsCtrlImpl::onWMCreate(CREATESTRUCT* pCS)
NULL);
if (!m_hTree)
- {
return -1;
- }
// subclass tree view
m_pfnOldTreeProc = reinterpret_cast<WNDPROC>(SetWindowLong(m_hTree, GWLP_WNDPROC, reinterpret_cast<LONG>(staticTreeProc)));
@@ -501,7 +453,6 @@ LRESULT OptionsCtrlImpl::onWMCreate(CREATESTRUCT* pCS)
// create/set state icons
staticInitStateImages();
TreeView_SetImageList(m_hTree, m_hStateIcons, TVSIL_NORMAL);
-
return 0;
}
@@ -512,9 +463,7 @@ void OptionsCtrlImpl::onWMDestroy()
// unset/free state icons
if (TreeView_GetImageList(m_hTree, TVSIL_NORMAL))
- {
staticFreeStateImages();
- }
// undo subclassing of tree view
SetWindowLong(m_hTree, GWLP_WNDPROC, reinterpret_cast<LONG>(m_pfnOldTreeProc));
@@ -537,89 +486,22 @@ void OptionsCtrlImpl::onNMClick()
HTREEITEM hItem = TreeView_HitTest(m_hTree, &hti);
if (hItem == hSelItem && hti.flags & TVHT_ONITEM)
- {
getItem(hItem)->onSelect();
- }
}
LRESULT OptionsCtrlImpl::onNMCustomDraw(NMTVCUSTOMDRAW* pNMCustomDraw)
{
- switch (pNMCustomDraw->nmcd.dwDrawStage)
- {
- case CDDS_PREPAINT:
- return CDRF_NOTIFYITEMDRAW;
-
- case CDDS_ITEMPREPAINT:
- {
- Item* pItem = reinterpret_cast<Item*>(pNMCustomDraw->nmcd.lItemlParam);
-
- if (pItem)
- {
- /*
- if (pItem->m_ItemType == itGroup && reinterpret_cast<Group*>(pItem)->m_bDrawLine)
- {
- COLORREF crNewBk = GetSysColor(COLOR_HIGHLIGHT);
- COLORREF crOldBk = SetBkColor(pNMCustomDraw->nmcd.hdc, crNewBk);
-
- RECT rLine = pNMCustomDraw->nmcd.rc;
- RECT rText;
-
- TreeView_GetItemRect(m_hTree, reinterpret_cast<HTREEITEM>(pNMCustomDraw->nmcd.dwItemSpec), &rText, TRUE);
-
- rLine.top = (rLine.bottom = (rLine.bottom + rLine.top) / 2) - 1;
- rLine.left = rText.right;
- rLine.right -= 2;
-
- ExtTextOut(pNMCustomDraw->nmcd.hdc, 0, 0, ETO_OPAQUE, &rLine, NULL, 0, NULL);
-
- OffsetRect(&rLine, 0, 2);
- ExtTextOut(pNMCustomDraw->nmcd.hdc, 0, 0, ETO_OPAQUE, &rLine, NULL, 0, NULL);
-
- SetBkColor(pNMCustomDraw->nmcd.hdc, crOldBk);
- }
- */
-
- /*
- if (pItem->m_ItemType == itColor)
- {
- COLORREF crColor = reinterpret_cast<Color*>(pItem)->m_crColor;
-
- COLORREF crNewBk = GetSysColor(COLOR_HIGHLIGHT);
- COLORREF crOldBk = SetBkColor(pNMCustomDraw->nmcd.hdc, crNewBk);
-
- RECT rColor = pNMCustomDraw->nmcd.rc;
- RECT rText;
-
- TreeView_GetItemRect(m_hTree, reinterpret_cast<HTREEITEM>(pNMCustomDraw->nmcd.dwItemSpec), &rText, TRUE);
-
- ++rColor.top;
- --rColor.bottom;
- rColor.left = rText.right;
- rColor.right -= 2;
-
- if (rColor.right - 40 > rColor.left)
- {
- rColor.right = rColor.left + 40;
- }
-
- ExtTextOut(pNMCustomDraw->nmcd.hdc, 0, 0, ETO_OPAQUE, &rColor, NULL, 0, NULL);
+ switch (pNMCustomDraw->nmcd.dwDrawStage) {
+ case CDDS_PREPAINT:
+ return CDRF_NOTIFYITEMDRAW;
- SetBkColor(pNMCustomDraw->nmcd.hdc, crColor);
+ case CDDS_ITEMPREPAINT:
+ Item* pItem = reinterpret_cast<Item*>(pNMCustomDraw->nmcd.lItemlParam);
+ if (pItem)
+ if (!pItem->m_bEnabled)
+ pNMCustomDraw->clrText = GetSysColor(COLOR_GRAYTEXT);
- InflateRect(&rColor, -1, -1);
- ExtTextOut(pNMCustomDraw->nmcd.hdc, 0, 0, ETO_OPAQUE, &rColor, NULL, 0, NULL);
-
- SetBkColor(pNMCustomDraw->nmcd.hdc, crOldBk);
- }
- */
-
- if (!pItem->m_bEnabled)
- {
- pNMCustomDraw->clrText = GetSysColor(COLOR_GRAYTEXT);
- }
- }
- }
- return CDRF_NEWFONT;
+ return CDRF_NEWFONT;
}
return 0;
@@ -628,33 +510,22 @@ LRESULT OptionsCtrlImpl::onNMCustomDraw(NMTVCUSTOMDRAW* pNMCustomDraw)
void OptionsCtrlImpl::onNMKillFocus()
{
HWND hWndFocused = GetFocus();
-
- if (hWndFocused != m_hTree && !IsChild(m_hTree, hWndFocused))
- {
+ if (hWndFocused != m_hTree && !IsChild(m_hTree, hWndFocused)) {
HTREEITEM hSelected = TreeView_GetSelection(m_hTree);
- if (hSelected)
- {
+ if (hSelected) {
Item* pItem = getItem(hSelected);
-
- if (pItem->m_ItemType == itDateTime)
- {
+ if (pItem->m_ItemType == itDateTime) {
// MEMO: handle date/time picker (with possibly open month calendar) separately
DateTime* pDateTime = reinterpret_cast<DateTime*>(pItem);
if (!pDateTime->isMonthCalVisible())
- {
pDateTime->onDeselect();
- }
}
else if (pItem->m_ItemType == itColor)
- {
- // MEMO: handle color picker separately
- }
+ ; // MEMO: handle color picker separately
else
- {
pItem->onDeselect();
- }
}
}
}
@@ -668,8 +539,7 @@ LRESULT OptionsCtrlImpl::onTVNItemExpanding(NMTREEVIEW* pNMTreeView)
void OptionsCtrlImpl::onTVNDeleteItem(NMTREEVIEW* pNMTreeView)
{
- if (pNMTreeView->itemOld.hItem)
- {
+ if (pNMTreeView->itemOld.hItem) {
// fake OCN_SELCHANGING message
NMOPTIONSCTRL nmoc;
@@ -693,45 +563,35 @@ void OptionsCtrlImpl::onTVNDeleteItem(NMTREEVIEW* pNMTreeView)
pItem->onDeselect();
if (--pItem->m_nRef == 0)
- {
delete pItem;
- }
}
}
void OptionsCtrlImpl::onTVNSelChanging(NMTREEVIEW* pNMTreeView)
{
NMOPTIONSCTRL nmoc;
-
nmoc.hdr.code = OCN_SELCHANGING;
nmoc.hdr.hwndFrom = m_hWnd;
nmoc.hdr.idFrom = m_nOwnId;
nmoc.hItem = reinterpret_cast<HANDLE>(pNMTreeView->itemOld.hItem);
nmoc.dwData = pNMTreeView->itemOld.hItem ? reinterpret_cast<Item*>(pNMTreeView->itemOld.lParam)->m_dwData : 0;
-
SendMessage(GetParent(m_hWnd), WM_NOTIFY, nmoc.hdr.idFrom, reinterpret_cast<LPARAM>(&nmoc));
if (pNMTreeView->itemOld.hItem)
- {
reinterpret_cast<Item*>(pNMTreeView->itemOld.lParam)->onDeselect();
- }
}
void OptionsCtrlImpl::onTVNSelChanged(NMTREEVIEW* pNMTreeView)
{
if (pNMTreeView->itemNew.hItem)
- {
reinterpret_cast<Item*>(pNMTreeView->itemNew.lParam)->onSelect();
- }
NMOPTIONSCTRL nmoc;
-
nmoc.hdr.code = OCN_SELCHANGED;
nmoc.hdr.hwndFrom = m_hWnd;
nmoc.hdr.idFrom = m_nOwnId;
nmoc.hItem = reinterpret_cast<HANDLE>(pNMTreeView->itemNew.hItem);
nmoc.dwData = pNMTreeView->itemNew.hItem ? reinterpret_cast<Item*>(pNMTreeView->itemNew.lParam)->m_dwData : 0;
-
SendMessage(GetParent(m_hWnd), WM_NOTIFY, nmoc.hdr.idFrom, reinterpret_cast<LPARAM>(&nmoc));
}
@@ -745,34 +605,24 @@ void OptionsCtrlImpl::onTVNBeginDrag(NMTREEVIEW* pNMTreeView)
void OptionsCtrlImpl::onWMMouseMove(const POINT& pt)
{
if (!m_hDragItem)
- {
return;
- }
TVHITTESTINFO hti;
-
hti.pt = pt;
ClientToScreen(m_hWnd, &hti.pt);
ScreenToClient(m_hTree, &hti.pt);
TreeView_HitTest(m_hTree, &hti);
- if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT))
- {
+ if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) {
RECT rItem;
-
TreeView_GetItemRect(m_hTree, hti.hItem, &rItem, FALSE);
TreeView_SetInsertMark(m_hTree, hti.hItem, (hti.pt.y >= (rItem.top + rItem.bottom) / 2) ? TRUE : FALSE);
}
- else
- {
+ else {
if (hti.flags & TVHT_ABOVE)
- {
SendMessage(m_hTree, WM_VSCROLL, MAKEWPARAM(SB_LINEUP, 0), 0);
- }
else if (hti.flags & TVHT_BELOW)
- {
SendMessage(m_hTree, WM_VSCROLL, MAKELPARAM(SB_LINEDOWN, 0), 0);
- }
TreeView_SetInsertMark(m_hTree, NULL, FALSE);
}
@@ -781,9 +631,7 @@ void OptionsCtrlImpl::onWMMouseMove(const POINT& pt)
void OptionsCtrlImpl::onWMLButtonUp(const POINT& pt)
{
if (!m_hDragItem)
- {
return;
- }
// revert to noraml state
HTREEITEM hDragItem = m_hDragItem;
@@ -794,22 +642,18 @@ void OptionsCtrlImpl::onWMLButtonUp(const POINT& pt)
// check for drop target and handle
TVHITTESTINFO hti;
-
hti.pt = pt;
ClientToScreen(m_hWnd, &hti.pt);
ScreenToClient(m_hTree, &hti.pt);
TreeView_HitTest(m_hTree, &hti);
- if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT))
- {
+ if (hti.flags & (TVHT_ONITEM | TVHT_ONITEMRIGHT)) {
RECT rItem;
-
TreeView_GetItemRect(m_hTree, hti.hItem, &rItem, FALSE);
bool bAbove = (hti.pt.y >= (rItem.top + rItem.bottom) / 2);
NMOPTIONSCTRLDROP nmocd;
-
nmocd.hdr.code = OCN_ITEMDROPPED;
nmocd.hdr.hwndFrom = m_hWnd;
nmocd.hdr.idFrom = m_nOwnId;
@@ -818,7 +662,6 @@ void OptionsCtrlImpl::onWMLButtonUp(const POINT& pt)
nmocd.hDropTarget = reinterpret_cast<HANDLE>(hti.hItem);
nmocd.dwDropTargetData = hti.hItem ? getItem(hti.hItem)->m_dwData : 0;
nmocd.bAbove = BOOL_(bAbove);
-
SendMessage(GetParent(m_hWnd), WM_NOTIFY, nmocd.hdr.idFrom, reinterpret_cast<LPARAM>(&nmocd));
}
}
@@ -826,19 +669,15 @@ void OptionsCtrlImpl::onWMLButtonUp(const POINT& pt)
void OptionsCtrlImpl::onENChange()
{
HTREEITEM hSelected = TreeView_GetSelection(m_hTree);
-
if (hSelected)
- {
setModified(getItem(hSelected));
- }
}
void OptionsCtrlImpl::onCBNSelChange()
{
HTREEITEM hSelected = TreeView_GetSelection(m_hTree);
- if (hSelected)
- {
+ if (hSelected) {
Item* pItem = getItem(hSelected);
assert(pItem->m_ItemType == itCombo);
@@ -852,20 +691,17 @@ void OptionsCtrlImpl::onBNClicked()
{
HTREEITEM hSelected = TreeView_GetSelection(m_hTree);
- if (hSelected)
- {
+ if (hSelected) {
Item* pItem = getItem(hSelected);
assert(pItem->m_ItemType == itButton);
NMOPTIONSCTRL nmoc;
-
nmoc.hdr.code = OCN_CLICKED;
nmoc.hdr.hwndFrom = m_hWnd;
nmoc.hdr.idFrom = m_nOwnId;
nmoc.hItem = reinterpret_cast<HANDLE>(pItem->m_hItem);
nmoc.dwData = pItem->m_dwData;
-
SendMessage(GetParent(m_hWnd), WM_NOTIFY, nmoc.hdr.idFrom, reinterpret_cast<LPARAM>(&nmoc));
}
}
@@ -874,8 +710,7 @@ void OptionsCtrlImpl::onDTNDateTimeChange()
{
HTREEITEM hSelected = TreeView_GetSelection(m_hTree);
- if (hSelected)
- {
+ if (hSelected) {
Item* pItem = getItem(hSelected);
assert(pItem->m_ItemType == itDateTime);
@@ -889,8 +724,7 @@ void OptionsCtrlImpl::onCPNColorChanged()
{
HTREEITEM hSelected = TreeView_GetSelection(m_hTree);
- if (hSelected)
- {
+ if (hSelected) {
Item* pItem = getItem(hSelected);
assert(pItem->m_ItemType == itColor);
@@ -905,45 +739,32 @@ void OptionsCtrlImpl::onTreeWMLButtonDown(UINT nFlags, POINTS point)
TVHITTESTINFO hti = { { point.x, point.y } };
if (TreeView_HitTest(m_hTree, &hti) && hti.flags & TVHT_ONITEMICON)
- {
getItem(hti.hItem)->onToggle();
- }
}
void OptionsCtrlImpl::onTreeWMChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
- if (nChar == VK_SPACE)
- {
+ if (nChar == VK_SPACE) {
HTREEITEM hItem = TreeView_GetSelection(m_hTree);
-
if (hItem)
- {
getItem(hItem)->onToggle();
- }
}
}
void OptionsCtrlImpl::onTreeWMKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
- if (nChar == VK_RIGHT)
- {
+ if (nChar == VK_RIGHT) {
HTREEITEM hItem = TreeView_GetSelection(m_hTree);
-
if (hItem)
- {
getItem(hItem)->onActivate();
- }
}
}
void OptionsCtrlImpl::onTreeXScroll()
{
HTREEITEM hSelected = TreeView_GetSelection(m_hTree);
-
if (hSelected && isItemValid(hSelected))
- {
getItem(hSelected)->onDeselect();
- }
}
HTREEITEM OptionsCtrlImpl::onOCMInsertGroup(HTREEITEM hParent, OCGROUP* pGroup)
@@ -1017,12 +838,12 @@ HTREEITEM OptionsCtrlImpl::onOCMInsertColor(HTREEITEM hParent, OCCOLOR* pColor)
return (new Color(this, hParent ? getItem(hParent) : NULL, pColor->szLabel, pColor->crColor, pColor->dwFlags, pColor->dwData))->m_hItem;
}
-const mu_text* OptionsCtrlImpl::onOCMGetItemLabel(HTREEITEM hItem)
+const TCHAR* OptionsCtrlImpl::onOCMGetItemLabel(HTREEITEM hItem)
{
return getItem(hItem)->getLabel();
}
-void OptionsCtrlImpl::onOCMSetItemLabel(HTREEITEM hItem, const mu_text* szLabel)
+void OptionsCtrlImpl::onOCMSetItemLabel(HTREEITEM hItem, const TCHAR* szLabel)
{
assert(szLabel);
@@ -1065,13 +886,9 @@ void OptionsCtrlImpl::onOCMCheckItem(HTREEITEM hItem, bool bCheck)
assert(pItem->m_ItemType == itCheck || pItem->m_ItemType == itRadio);
if (pItem->m_ItemType == itCheck)
- {
reinterpret_cast<Check*>(pItem)->setChecked(bCheck);
- }
else
- {
reinterpret_cast<Radio*>(pItem)->setChecked();
- }
}
int OptionsCtrlImpl::onOCMGetRadioChecked(HTREEITEM hRadio)
@@ -1110,7 +927,7 @@ void OptionsCtrlImpl::onOCMSetEditNumber(HTREEITEM hEdit, int nNumber)
reinterpret_cast<Edit*>(pEdit)->setNumber(nNumber);
}
-const mu_text* OptionsCtrlImpl::onOCMGetEditString(HTREEITEM hEdit)
+const TCHAR* OptionsCtrlImpl::onOCMGetEditString(HTREEITEM hEdit)
{
Item* pEdit = getItem(hEdit);
@@ -1119,7 +936,7 @@ const mu_text* OptionsCtrlImpl::onOCMGetEditString(HTREEITEM hEdit)
return reinterpret_cast<Edit*>(pEdit)->getString();
}
-void OptionsCtrlImpl::onOCMSetEditString(HTREEITEM hEdit, const mu_text *szString)
+void OptionsCtrlImpl::onOCMSetEditString(HTREEITEM hEdit, const TCHAR *szString)
{
assert(szString);
@@ -1130,7 +947,7 @@ void OptionsCtrlImpl::onOCMSetEditString(HTREEITEM hEdit, const mu_text *szStrin
reinterpret_cast<Edit*>(pEdit)->setString(szString);
}
-void OptionsCtrlImpl::onOCMAddComboItem(HTREEITEM hCombo, const mu_text* szItem)
+void OptionsCtrlImpl::onOCMAddComboItem(HTREEITEM hCombo, const TCHAR* szItem)
{
assert(szItem);
@@ -1162,14 +979,10 @@ void OptionsCtrlImpl::onOCMSetComboSelected(HTREEITEM hCombo, int nSelect)
void OptionsCtrlImpl::onOCMEnsureVisible(HTREEITEM hItem)
{
if (!hItem)
- {
hItem = TreeView_GetChild(m_hTree, TVI_ROOT);
- }
if (hItem)
- {
TreeView_EnsureVisible(m_hTree, hItem);
- }
}
void OptionsCtrlImpl::onOCMDeleteAllItems()
@@ -1190,19 +1003,18 @@ void OptionsCtrlImpl::onOCMSelectItem(HTREEITEM hItem)
HTREEITEM OptionsCtrlImpl::onOCMGetItem(HTREEITEM hItem, DWORD dwFlag)
{
- switch (dwFlag)
- {
- case OCGI_FIRST:
- return TreeView_GetRoot(m_hTree);
+ switch (dwFlag) {
+ case OCGI_FIRST:
+ return TreeView_GetRoot(m_hTree);
- case OCGI_NEXT:
- return TreeView_GetNextSibling(m_hTree, hItem);
+ case OCGI_NEXT:
+ return TreeView_GetNextSibling(m_hTree, hItem);
- case OCGI_PREV:
- return TreeView_GetPrevSibling(m_hTree, hItem);
+ case OCGI_PREV:
+ return TreeView_GetPrevSibling(m_hTree, hItem);
- default:
- return NULL;
+ default:
+ return NULL;
}
}
@@ -1216,15 +1028,13 @@ void OptionsCtrlImpl::onOCMMoveItem(HTREEITEM& hItem, HTREEITEM hInsertAfter)
assert(hItem);
TVINSERTSTRUCT tvis;
-
tvis.hParent = TreeView_GetParent(m_hTree, hItem);
tvis.hInsertAfter = hInsertAfter ? hInsertAfter : TVI_FIRST;
tvis.item.hItem = hItem;
tvis.item.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE | TVIF_PARAM;
tvis.item.stateMask = TVIS_BOLD | TVIS_EXPANDED;
- if (TreeView_GetItem(m_hTree, &tvis.item))
- {
+ if (TreeView_GetItem(m_hTree, &tvis.item)) {
Item* pItem = reinterpret_cast<Item*>(tvis.item.lParam);
++pItem->m_nRef;
@@ -1232,7 +1042,7 @@ void OptionsCtrlImpl::onOCMMoveItem(HTREEITEM& hItem, HTREEITEM hInsertAfter)
TreeView_DeleteItem(m_hTree, hItem);
tvis.item.mask |= TVIF_TEXT;
- tvis.item.pszText = muT("");
+ tvis.item.pszText = _T("");
hItem = TreeView_InsertItem(m_hTree, &tvis);
@@ -1300,24 +1110,22 @@ void OptionsCtrlImpl::onOCMSetItemColor(HTREEITEM hColor, COLORREF crColor)
reinterpret_cast<Color*>(pColor)->setColor(crColor);
}
-void OptionsCtrlImpl::insertItem(Item* pParent, Item* pItem, const mu_text* szNodeText, DWORD dwFlags, int iImage)
+void OptionsCtrlImpl::insertItem(Item* pParent, Item* pItem, const TCHAR* szNodeText, DWORD dwFlags, int iImage)
{
assert(!pParent || pParent->m_hItem);
assert(pItem);
assert(szNodeText);
TVINSERTSTRUCT tvis;
-
- tvis.hParent = pParent ? pParent->m_hItem : TVI_ROOT;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE | TVIF_PARAM;
- tvis.item.pszText = const_cast<mu_text*>(szNodeText);
- tvis.item.iImage = iImage;
+ tvis.hParent = pParent ? pParent->m_hItem : TVI_ROOT;
+ tvis.hInsertAfter = TVI_LAST;
+ tvis.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_SELECTEDIMAGE | TVIF_STATE | TVIF_PARAM;
+ tvis.item.pszText = const_cast<TCHAR*>(szNodeText);
+ tvis.item.iImage = iImage;
tvis.item.iSelectedImage = iImage;
- tvis.item.stateMask = TVIS_EXPANDED | ((dwFlags & OCF_BOLD) ? TVIS_BOLD : 0);
- tvis.item.state = tvis.item.stateMask;
- tvis.item.lParam = reinterpret_cast<LPARAM>(pItem);
-
+ tvis.item.stateMask = TVIS_EXPANDED | ((dwFlags & OCF_BOLD) ? TVIS_BOLD : 0);
+ tvis.item.state = tvis.item.stateMask;
+ tvis.item.lParam = reinterpret_cast<LPARAM>(pItem);
pItem->m_hItem = TreeView_InsertItem(m_hTree, &tvis);
}
@@ -1325,16 +1133,13 @@ void OptionsCtrlImpl::setModified(Item* pItem, bool bModified /* = true */)
{
m_bModified = bModified;
- if (bModified)
- {
+ if (bModified) {
NMOPTIONSCTRL nmoc;
-
nmoc.hdr.code = OCN_MODIFIED;
nmoc.hdr.hwndFrom = m_hWnd;
nmoc.hdr.idFrom = m_nOwnId;
nmoc.hItem = reinterpret_cast<HANDLE>(pItem->m_hItem);
nmoc.dwData = pItem->m_dwData;
-
SendMessage(GetParent(m_hWnd), WM_NOTIFY, nmoc.hdr.idFrom, reinterpret_cast<LPARAM>(&nmoc));
}
}
@@ -1344,10 +1149,8 @@ bool OptionsCtrlImpl::isItemValid(HTREEITEM hItem)
assert(hItem);
TVITEM tvi;
-
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
-
Item* pItem = TreeView_GetItem(m_hTree, &tvi) ? reinterpret_cast<Item*>(tvi.lParam) : NULL;
return bool_(pItem);
@@ -1358,25 +1161,21 @@ OptionsCtrlImpl::Item* OptionsCtrlImpl::getItem(HTREEITEM hItem)
assert(hItem);
TVITEM tvi;
-
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
-
Item* pItem = TreeView_GetItem(m_hTree, &tvi) ? reinterpret_cast<Item*>(tvi.lParam) : NULL;
assert(pItem);
-
+
return pItem;
}
void OptionsCtrlImpl::setItem(HTREEITEM hItem, Item* pItem)
{
TVITEM tvi;
-
tvi.mask = TVIF_HANDLE | TVIF_PARAM;
tvi.hItem = hItem;
tvi.lParam = reinterpret_cast<LPARAM>(pItem);
-
TreeView_SetItem(m_hTree, &tvi);
}
@@ -1385,26 +1184,22 @@ void OptionsCtrlImpl::setStateImage(HTREEITEM hItem, int iImage)
assert(hItem);
TVITEM tvi;
-
tvi.mask = TVIF_HANDLE | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
tvi.hItem = hItem;
tvi.iImage = iImage;
tvi.iSelectedImage = iImage;
-
TreeView_SetItem(m_hTree, &tvi);
}
-void OptionsCtrlImpl::setNodeText(HTREEITEM hItem, const mu_text* szNodeText)
+void OptionsCtrlImpl::setNodeText(HTREEITEM hItem, const TCHAR* szNodeText)
{
assert(hItem);
assert(szNodeText);
TVITEM tvi;
-
tvi.mask = TVIF_HANDLE | TVIF_TEXT;
tvi.hItem = hItem;
- tvi.pszText = const_cast<mu_text*>(szNodeText);
-
+ tvi.pszText = const_cast<TCHAR*>(szNodeText);
TreeView_SetItem(m_hTree, &tvi);
}
@@ -1412,17 +1207,12 @@ bool OptionsCtrlImpl::getItemFreeRect(HTREEITEM hItem, RECT& outRect)
{
RECT rLine, rText;
- if (TreeView_GetItemRect(m_hTree, hItem, &rLine, FALSE) && TreeView_GetItemRect(m_hTree, hItem, &rText, TRUE))
- {
+ if (TreeView_GetItemRect(m_hTree, hItem, &rLine, FALSE) && TreeView_GetItemRect(m_hTree, hItem, &rText, TRUE)) {
outRect.left = rText.right + 2;
outRect.top = rText.top;
outRect.right = rLine.right - 2;
outRect.bottom = rText.bottom;
-
return true;
}
- else
- {
- return false;
- }
+ else return false;
}
diff --git a/plugins/HistoryStats/src/optionsctrlimpl.h b/plugins/HistoryStats/src/optionsctrlimpl.h
index 43313ac195..7ad304ce85 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl.h
+++ b/plugins/HistoryStats/src/optionsctrlimpl.h
@@ -76,7 +76,7 @@ private:
DWORD m_dwData;
protected:
- explicit Item(OptionsCtrlImpl* pCtrl, ItemType ItemType, const mu_text* szLabel, DWORD dwFlags, DWORD dwData);
+ explicit Item(OptionsCtrlImpl* pCtrl, ItemType ItemType, const TCHAR* szLabel, DWORD dwFlags, DWORD dwData);
void enableChilds(bool bEnable);
@@ -91,8 +91,8 @@ private:
virtual void setEnabled(bool bEnable) = 0;
virtual void childAdded(Item* pChild) = 0;
- virtual void setLabel(const mu_text* szLabel);
- virtual const mu_text* getLabel() { return m_strLabel.c_str(); }
+ virtual void setLabel(const TCHAR* szLabel);
+ virtual const TCHAR* getLabel() { return m_strLabel.c_str(); }
};
class Group
@@ -102,7 +102,7 @@ private:
bool m_bDrawLine;
public:
- explicit Group(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, DWORD dwFlags, DWORD dwData);
+ explicit Group(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, DWORD dwFlags, DWORD dwData);
virtual void setEnabled(bool bEnable);
virtual void childAdded(Item* pChild);
@@ -122,7 +122,7 @@ private:
void updateItem();
public:
- explicit Check(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, DWORD dwFlags, DWORD dwData);
+ explicit Check(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, DWORD dwFlags, DWORD dwData);
virtual void onToggle();
@@ -171,7 +171,7 @@ private:
void updateItem();
public:
- explicit Radio(OptionsCtrlImpl* pCtrl, Item* pParent, Radio* pSibling, const mu_text* szLabel, DWORD dwFlags, DWORD dwData);
+ explicit Radio(OptionsCtrlImpl* pCtrl, Item* pParent, Radio* pSibling, const TCHAR* szLabel, DWORD dwFlags, DWORD dwData);
virtual ~Radio();
virtual void onToggle();
@@ -196,7 +196,7 @@ private:
ext::string getCombinedText();
public:
- explicit Edit(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, const mu_text* szEdit, DWORD dwFlags, DWORD dwData);
+ explicit Edit(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, const TCHAR* szEdit, DWORD dwFlags, DWORD dwData);
virtual void onToggle() { onActivate(); }
virtual void onSelect();
@@ -206,10 +206,10 @@ private:
virtual void setEnabled(bool bEnable);
virtual void childAdded(Item* pChild);
- virtual void setLabel(const mu_text* szLabel);
+ virtual void setLabel(const TCHAR* szLabel);
- const mu_text* getString();
- void setString(const mu_text* szString);
+ const TCHAR* getString();
+ void setString(const TCHAR* szString);
int getNumber() { return _ttoi(getString()); }
void setNumber(int nNumber) { setString(utils::intToString(nNumber).c_str()); }
};
@@ -230,7 +230,7 @@ private:
ext::string getCombinedText();
public:
- explicit Combo(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, DWORD dwFlags, DWORD dwData);
+ explicit Combo(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, DWORD dwFlags, DWORD dwData);
virtual void onToggle() { onActivate(); }
virtual void onSelect();
@@ -240,9 +240,9 @@ private:
virtual void setEnabled(bool bEnable);
virtual void childAdded(Item* pChild);
- virtual void setLabel(const mu_text* szLabel);
+ virtual void setLabel(const TCHAR* szLabel);
- void addItem(const mu_text* szItem);
+ void addItem(const TCHAR* szItem);
int getSelected();
void setSelected(int nSelect);
void onSelChanged();
@@ -256,7 +256,7 @@ private:
HWND m_hButtonWnd;
public:
- explicit Button(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, const mu_text* szButton, DWORD dwFlags, DWORD dwData);
+ explicit Button(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, const TCHAR* szButton, DWORD dwFlags, DWORD dwData);
virtual void onToggle() { onActivate(); }
virtual void onSelect();
@@ -266,7 +266,7 @@ private:
virtual void setEnabled(bool bEnable);
virtual void childAdded(Item* pChild);
- virtual void setLabel(const mu_text* szLabel);
+ virtual void setLabel(const TCHAR* szLabel);
};
class DateTime
@@ -294,7 +294,7 @@ private:
ext::string getCombinedText();
public:
- explicit DateTime(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, const mu_text* szFormat, DWORD dwTimestamp, DWORD dwFlags, DWORD dwData);
+ explicit DateTime(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, const TCHAR* szFormat, DWORD dwTimestamp, DWORD dwFlags, DWORD dwData);
virtual void onToggle() { onActivate(); }
virtual void onSelect();
@@ -304,7 +304,7 @@ private:
virtual void setEnabled(bool bEnable);
virtual void childAdded(Item* pChild);
- virtual void setLabel(const mu_text* szLabel);
+ virtual void setLabel(const TCHAR* szLabel);
bool isNone();
void setNone();
@@ -325,7 +325,7 @@ private:
COLORREF getColorValue();
public:
- explicit Color(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, COLORREF crColor, DWORD dwFlags, DWORD dwData);
+ explicit Color(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, COLORREF crColor, DWORD dwFlags, DWORD dwData);
virtual void onToggle() { onActivate(); }
virtual void onSelect();
@@ -335,7 +335,7 @@ private:
virtual void setEnabled(bool bEnable);
virtual void childAdded(Item* pChild);
- virtual void setLabel(const mu_text* szLabel);
+ virtual void setLabel(const TCHAR* szLabel);
COLORREF getColor();
void setColor(COLORREF crColor);
@@ -343,7 +343,7 @@ private:
};
private:
- static const mu_text* m_ClassName;
+ static const TCHAR* m_ClassName;
static HIMAGELIST m_hStateIcons;
static int m_nStateIconsRef;
@@ -402,8 +402,8 @@ private:
HTREEITEM onOCMInsertButton(HTREEITEM hParent, OCBUTTON* pButton);
HTREEITEM onOCMInsertDateTime(HTREEITEM hParent, OCDATETIME* pDateTime);
HTREEITEM onOCMInsertColor(HTREEITEM hParent, OCCOLOR* pColor);
- const mu_text* onOCMGetItemLabel(HTREEITEM hItem);
- void onOCMSetItemLabel(HTREEITEM hItem, const mu_text* szLabel);
+ const TCHAR* onOCMGetItemLabel(HTREEITEM hItem);
+ void onOCMSetItemLabel(HTREEITEM hItem, const TCHAR* szLabel);
bool onOCMIsItemEnabled(HTREEITEM hItem);
void onOCMEnableItem(HTREEITEM hItem, bool bEnable);
DWORD onOCMGetItemData(HTREEITEM hItem);
@@ -414,9 +414,9 @@ private:
void onOCMSetRadioChecked(HTREEITEM hRadio, int nCheck);
int onOCMGetEditNumber(HTREEITEM hEdit);
void onOCMSetEditNumber(HTREEITEM hEdit, int nNumber);
- const mu_text* onOCMGetEditString(HTREEITEM hEdit);
- void onOCMSetEditString(HTREEITEM hEdit, const mu_text *szString);
- void onOCMAddComboItem(HTREEITEM hCombo, const mu_text* szItem);
+ const TCHAR* onOCMGetEditString(HTREEITEM hEdit);
+ void onOCMSetEditString(HTREEITEM hEdit, const TCHAR *szString);
+ void onOCMAddComboItem(HTREEITEM hCombo, const TCHAR* szItem);
int onOCMGetComboSelected(HTREEITEM hCombo);
void onOCMSetComboSelected(HTREEITEM hCombo, int nSelect);
void onOCMEnsureVisible(HTREEITEM hItem);
@@ -434,13 +434,13 @@ private:
void onOCMSetItemColor(HTREEITEM hColor, COLORREF crColor);
private:
- void insertItem(Item* pParent, Item* pItem, const mu_text* szNodeText, DWORD dwFlags, int iImage);
+ void insertItem(Item* pParent, Item* pItem, const TCHAR* szNodeText, DWORD dwFlags, int iImage);
void setModified(Item* pItem, bool bModified = true);
bool isItemValid(HTREEITEM hItem);
Item* getItem(HTREEITEM hItem);
void setItem(HTREEITEM hItem, Item* pItem);
void setStateImage(HTREEITEM hItem, int iImage);
- void setNodeText(HTREEITEM hItem, const mu_text* szNodeText);
+ void setNodeText(HTREEITEM hItem, const TCHAR* szNodeText);
bool getItemFreeRect(HTREEITEM hItem, RECT& outRect);
};
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_button.cpp b/plugins/HistoryStats/src/optionsctrlimpl_button.cpp
index ae1b8395ca..b6951f3295 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl_button.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl_button.cpp
@@ -7,7 +7,7 @@
* OptionsCtrlImpl::Button
*/
-OptionsCtrlImpl::Button::Button(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, const mu_text* szButton, DWORD dwFlags, DWORD dwData)
+OptionsCtrlImpl::Button::Button(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, const TCHAR* szButton, DWORD dwFlags, DWORD dwData)
: Item(pCtrl, itButton, szLabel, dwFlags, dwData)
, m_hButtonWnd(NULL)
, m_strButton(szButton)
@@ -113,7 +113,7 @@ void OptionsCtrlImpl::Button::childAdded(Item* pChild)
}
}
-void OptionsCtrlImpl::Button::setLabel(const mu_text* szLabel)
+void OptionsCtrlImpl::Button::setLabel(const TCHAR* szLabel)
{
m_strLabel = szLabel;
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_check.cpp b/plugins/HistoryStats/src/optionsctrlimpl_check.cpp
index d6c2b99c56..21d9677636 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl_check.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl_check.cpp
@@ -27,7 +27,7 @@ void OptionsCtrlImpl::Check::updateItem()
}
}
-OptionsCtrlImpl::Check::Check(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, DWORD dwFlags, DWORD dwData)
+OptionsCtrlImpl::Check::Check(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, DWORD dwFlags, DWORD dwData)
: Item(pCtrl, itCheck, szLabel, dwFlags, dwData)
{
m_bChecked = bool_(dwFlags & OCF_CHECKED);
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_color.cpp b/plugins/HistoryStats/src/optionsctrlimpl_color.cpp
index fa9eebce2d..0ed7e5abe4 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl_color.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl_color.cpp
@@ -12,7 +12,7 @@ COLORREF OptionsCtrlImpl::Color::getColorValue()
return SendMessage(m_hColorWnd, CPM_GETCOLOUR, 0, 0);
}
-OptionsCtrlImpl::Color::Color(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, COLORREF crColor, DWORD dwFlags, DWORD dwData)
+OptionsCtrlImpl::Color::Color(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, COLORREF crColor, DWORD dwFlags, DWORD dwData)
: Item(pCtrl, itColor, szLabel, dwFlags, dwData)
, m_hColorWnd(NULL)
, m_crColor(crColor)
@@ -131,7 +131,7 @@ void OptionsCtrlImpl::Color::childAdded(Item* pChild)
}
}
-void OptionsCtrlImpl::Color::setLabel(const mu_text* szLabel)
+void OptionsCtrlImpl::Color::setLabel(const TCHAR* szLabel)
{
m_strLabel = szLabel;
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp b/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp
index a019bda875..e75a635e14 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl_combo.cpp
@@ -39,14 +39,14 @@ ext::string OptionsCtrlImpl::Combo::getCombinedText()
{
ext::string strTemp = m_strLabel;
- strTemp += muT(": ");
+ strTemp += _T(": ");
strTemp += m_Items[m_nSelected];
return strTemp;
}
}
-OptionsCtrlImpl::Combo::Combo(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, DWORD dwFlags, DWORD dwData)
+OptionsCtrlImpl::Combo::Combo(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, DWORD dwFlags, DWORD dwData)
: Item(pCtrl, itCombo, szLabel, dwFlags, dwData), m_hComboWnd(NULL), m_nSelected(-1)
{
m_bDisableChildsOnIndex0 = bool_(dwFlags & OCF_DISABLECHILDSONINDEX0);
@@ -86,7 +86,7 @@ void OptionsCtrlImpl::Combo::onSelect()
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL | CBS_DROPDOWNLIST;
if (hTempWnd = CreateWindowEx(
- WS_EX_CLIENTEDGE, WC_COMBOBOX, muT(""), dwStyle,
+ WS_EX_CLIENTEDGE, WC_COMBOBOX, _T(""), dwStyle,
r.left, r.top, r.right - r.left, (r.bottom - r.top) * 20,
m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccCombo), g_hInst, NULL))
{
@@ -177,7 +177,7 @@ void OptionsCtrlImpl::Combo::childAdded(Item* pChild)
}
}
-void OptionsCtrlImpl::Combo::setLabel(const mu_text* szLabel)
+void OptionsCtrlImpl::Combo::setLabel(const TCHAR* szLabel)
{
m_strLabel = szLabel;
@@ -188,7 +188,7 @@ void OptionsCtrlImpl::Combo::setLabel(const mu_text* szLabel)
}
}
-void OptionsCtrlImpl::Combo::addItem(const mu_text* szItem)
+void OptionsCtrlImpl::Combo::addItem(const TCHAR* szItem)
{
m_Items.push_back(szItem);
}
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp b/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp
index 9c703630ee..161e21f64c 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl_datetime.cpp
@@ -11,104 +11,93 @@ ext::string OptionsCtrlImpl::DateTime::getDTFormatString(const ext::string& strF
{
ext::string strOut, strPart;
- for (int i = 0; i < strFormat.length(); ++i)
- {
- if (strFormat[i] == muC('%') && i < strFormat.length() - 1)
- {
+ for (int i = 0; i < strFormat.length(); ++i) {
+ if (strFormat[i] == '%' && i < strFormat.length() - 1) {
++i;
- bool bSharp = (strFormat[i] == muC('#'));
+ bool bSharp = (strFormat[i] == '#');
ext::string strCode;
if (bSharp && i < strFormat.length() - 1)
- {
++i;
- }
- switch (strFormat[i])
- {
- case muC('a'):
- strCode = muT("ddd");
- break;
+ switch (strFormat[i]) {
+ case 'a':
+ strCode = _T("ddd");
+ break;
- case muC('A'):
- strCode = muT("dddd");
- break;
+ case 'A':
+ strCode = _T("dddd");
+ break;
- case muC('b'):
- strCode = muT("MMM");
- break;
+ case 'b':
+ strCode = _T("MMM");
+ break;
- case muC('B'):
- strCode = muT("MMMM");
- break;
+ case 'B':
+ strCode = _T("MMMM");
+ break;
- case muC('d'):
- strCode = bSharp ? muT("d") : muT("dd");
- break;
+ case 'd':
+ strCode = bSharp ? _T("d") : _T("dd");
+ break;
- case muC('H'):
- strCode = bSharp ? muT("H") : muT("HH");
- break;
+ case 'H':
+ strCode = bSharp ? _T("H") : _T("HH");
+ break;
- case muC('I'):
- strCode = bSharp ? muT("h") : muT("hh");
- break;
+ case 'I':
+ strCode = bSharp ? _T("h") : _T("hh");
+ break;
- case muC('m'):
- strCode = bSharp ? muT("M") : muT("MM");
- break;
+ case 'm':
+ strCode = bSharp ? _T("M") : _T("MM");
+ break;
- case muC('M'):
- strCode = bSharp ? muT("m") : muT("mm");
- break;
+ case 'M':
+ strCode = bSharp ? _T("m") : _T("mm");
+ break;
- case muC('p'):
- strCode = muT("tt"); // MEMO: seems not to work if current locale is 24-hour
- break;
+ case 'p':
+ strCode = _T("tt"); // MEMO: seems not to work if current locale is 24-hour
+ break;
- case muC('y'):
- strCode = muT("yy");
- break;
+ case 'y':
+ strCode = _T("yy");
+ break;
- case muC('Y'):
- strCode = muT("yyyy");
- break;
+ case 'Y':
+ strCode = _T("yyyy");
+ break;
- case muC('%'):
- strPart += muT("%");
- break;
+ case '%':
+ strPart += _T("%");
+ break;
}
- if (!strCode.empty())
- {
- if (!strPart.empty())
- {
- strOut += muT("'");
+ if (!strCode.empty()) {
+ if (!strPart.empty()) {
+ strOut += _T("'");
strOut += strPart;
- strOut += muT("'");
- strPart = muT("");
+ strOut += _T("'");
+ strPart = _T("");
}
strOut += strCode;
}
}
- else
- {
+ else {
strPart += strFormat[i];
- if (strFormat[i] == muC('\''))
- {
- strPart += muT("'");
- }
+ if (strFormat[i] == '\'')
+ strPart += _T("'");
}
}
- if (!strPart.empty())
- {
- strOut += muT("'");
+ if (!strPart.empty()) {
+ strOut += _T("'");
strOut += strPart;
- strOut += muT("'");
+ strOut += _T("'");
}
return strOut;
@@ -145,8 +134,7 @@ DWORD OptionsCtrlImpl::DateTime::fromSystemTime(const SYSTEMTIME& st)
void OptionsCtrlImpl::DateTime::enableChildsDateTime()
{
- if (m_bDisableChilds || m_bDisableChildsOnNone)
- {
+ if (m_bDisableChilds || m_bDisableChildsOnNone) {
enableChilds(getChildEnable());
}
}
@@ -162,20 +150,17 @@ DWORD OptionsCtrlImpl::DateTime::getTimestampValue()
{
SYSTEMTIME st;
- if (SendMessage(m_hDateTimeWnd, DTM_GETSYSTEMTIME, 0, reinterpret_cast<LPARAM>(&st)) == GDT_VALID)
- {
+ if (SendMessage(m_hDateTimeWnd, DTM_GETSYSTEMTIME, 0, reinterpret_cast<LPARAM>(&st)) == GDT_VALID) {
return fromSystemTime(st);
}
- else
- {
+ else {
return 24 * 60 * 60;
}
}
bool OptionsCtrlImpl::DateTime::getTimestampNone()
{
- if (!m_bAllowNone)
- {
+ if (!m_bAllowNone) {
return false;
}
@@ -188,22 +173,18 @@ ext::string OptionsCtrlImpl::DateTime::getCombinedText()
{
ext::string strTemp = m_strLabel;
- strTemp += muT(": ");
+ strTemp += _T(": ");
if (m_bNone)
- {
- strTemp += i18n(muT("none"));
- }
+ strTemp += TranslateT("none");
else
- {
strTemp += utils::timestampToString(m_dwTimestamp, m_strFormat.c_str());
- }
return strTemp;
}
-OptionsCtrlImpl::DateTime::DateTime(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, const mu_text* szFormat, DWORD dwTimestamp, DWORD dwFlags, DWORD dwData)
- : Item(pCtrl, itDateTime, szLabel, dwFlags, dwData), m_hDateTimeWnd(NULL), m_strFormat(szFormat), m_dwTimestamp(dwTimestamp)
+OptionsCtrlImpl::DateTime::DateTime(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, const TCHAR* szFormat, DWORD dwTimestamp, DWORD dwFlags, DWORD dwData)
+: Item(pCtrl, itDateTime, szLabel, dwFlags, dwData), m_hDateTimeWnd(NULL), m_strFormat(szFormat), m_dwTimestamp(dwTimestamp)
{
m_bDisableChildsOnNone = bool_(dwFlags & OCF_DISABLECHILDSONNONE);
m_bAllowNone = bool_(dwFlags & OCF_ALLOWNONE);
@@ -212,16 +193,14 @@ OptionsCtrlImpl::DateTime::DateTime(OptionsCtrlImpl* pCtrl, Item* pParent, const
m_pCtrl->insertItem(pParent, this, getCombinedText().c_str(), dwFlags, m_bEnabled ? siDateTime : siDateTimeG);
- if (pParent)
- {
+ if (pParent) {
pParent->childAdded(this);
}
}
void OptionsCtrlImpl::DateTime::onSelect()
{
- if (!m_bEnabled || m_hDateTimeWnd)
- {
+ if (!m_bEnabled || m_hDateTimeWnd) {
return;
}
@@ -230,13 +209,11 @@ void OptionsCtrlImpl::DateTime::onSelect()
HFONT hTreeFront = reinterpret_cast<HFONT>(SendMessage(m_pCtrl->m_hTree, WM_GETFONT, 0, 0));
RECT r;
- if (m_pCtrl->getItemFreeRect(m_hItem, r))
- {
+ if (m_pCtrl->getItemFreeRect(m_hItem, r)) {
r.top -= 2;
r.bottom += 2;
- if (r.left + 50 > r.right)
- {
+ if (r.left + 50 > r.right) {
r.left = r.right - 50;
}
@@ -245,10 +222,9 @@ void OptionsCtrlImpl::DateTime::onSelect()
DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | (m_bAllowNone ? DTS_SHOWNONE : 0);
if (hTempWnd = CreateWindowEx(
- WS_EX_CLIENTEDGE, DATETIMEPICK_CLASS, muT(""), dwStyle,
+ WS_EX_CLIENTEDGE, DATETIMEPICK_CLASS, _T(""), dwStyle,
r.left, r.top, r.right - r.left, r.bottom - r.top,
- m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccDateTime), g_hInst, NULL))
- {
+ m_pCtrl->m_hTree, reinterpret_cast<HMENU>(ccDateTime), g_hInst, NULL)) {
// restrict to dates a timestamp can hold (with 1 day less to avoid timezone issues)
SYSTEMTIME stMinMax[2] = { toSystemTime(0x00000000 + 24 * 60 * 60), toSystemTime(0x7FFFFFFF - 24 * 60 * 60) };
@@ -258,12 +234,10 @@ void OptionsCtrlImpl::DateTime::onSelect()
SendMessage(hTempWnd, DTM_SETFORMAT, 0, reinterpret_cast<LPARAM>(m_strFormatDT.c_str()));
// set timestamp
- if (m_bAllowNone && m_bNone)
- {
+ if (m_bAllowNone && m_bNone) {
SendMessage(hTempWnd, DTM_SETSYSTEMTIME, GDT_NONE, 0);
}
- else
- {
+ else {
SYSTEMTIME st = toSystemTime(m_dwTimestamp);
SendMessage(hTempWnd, DTM_SETSYSTEMTIME, GDT_VALID, reinterpret_cast<LPARAM>(&st));
@@ -278,13 +252,11 @@ void OptionsCtrlImpl::DateTime::onSelect()
void OptionsCtrlImpl::DateTime::onDeselect()
{
- if (m_hDateTimeWnd)
- {
+ if (m_hDateTimeWnd) {
RECT rToInvalidate;
bool bValidRect = false;
- if (GetWindowRect(m_hDateTimeWnd, &rToInvalidate))
- {
+ if (GetWindowRect(m_hDateTimeWnd, &rToInvalidate)) {
ScreenToClient(m_pCtrl->m_hTree, reinterpret_cast<POINT*>(&rToInvalidate) + 0);
ScreenToClient(m_pCtrl->m_hTree, reinterpret_cast<POINT*>(&rToInvalidate) + 1);
@@ -308,21 +280,18 @@ void OptionsCtrlImpl::DateTime::onDeselect()
void OptionsCtrlImpl::DateTime::onActivate()
{
- if (!m_hDateTimeWnd)
- {
+ if (!m_hDateTimeWnd) {
onSelect();
}
- if (m_hDateTimeWnd)
- {
+ if (m_hDateTimeWnd) {
SetFocus(m_hDateTimeWnd);
}
}
void OptionsCtrlImpl::DateTime::onDateTimeChange()
{
- if (m_hDateTimeWnd)
- {
+ if (m_hDateTimeWnd) {
m_dwTimestamp = getTimestampValue();
m_bNone = getTimestampNone();
@@ -342,27 +311,24 @@ void OptionsCtrlImpl::DateTime::setEnabled(bool bEnable)
void OptionsCtrlImpl::DateTime::childAdded(Item* pChild)
{
- if (m_bDisableChilds || m_bDisableChildsOnNone)
- {
+ if (m_bDisableChilds || m_bDisableChildsOnNone) {
pChild->setEnabled(getChildEnable());
}
}
-void OptionsCtrlImpl::DateTime::setLabel(const mu_text* szLabel)
+void OptionsCtrlImpl::DateTime::setLabel(const TCHAR* szLabel)
{
m_strLabel = szLabel;
// only if not editing (otherwise update when user finishes editing)
- if (!m_hDateTimeWnd)
- {
+ if (!m_hDateTimeWnd) {
m_pCtrl->setNodeText(m_hItem, getCombinedText().c_str());
}
}
bool OptionsCtrlImpl::DateTime::isNone()
{
- if (m_hDateTimeWnd)
- {
+ if (m_hDateTimeWnd) {
m_dwTimestamp = getTimestampValue();
m_bNone = getTimestampNone();
}
@@ -372,19 +338,16 @@ bool OptionsCtrlImpl::DateTime::isNone()
void OptionsCtrlImpl::DateTime::setNone()
{
- if (!m_bAllowNone)
- {
+ if (!m_bAllowNone) {
return;
}
m_bNone = true;
- if (m_hDateTimeWnd)
- {
+ if (m_hDateTimeWnd) {
SendMessage(m_hDateTimeWnd, DTM_SETSYSTEMTIME, GDT_NONE, 0);
}
- else
- {
+ else {
m_pCtrl->setNodeText(m_hItem, getCombinedText().c_str());
}
@@ -394,8 +357,7 @@ void OptionsCtrlImpl::DateTime::setNone()
DWORD OptionsCtrlImpl::DateTime::getTimestamp()
{
- if (m_hDateTimeWnd)
- {
+ if (m_hDateTimeWnd) {
m_dwTimestamp = getTimestampValue();
m_bNone = getTimestampNone();
}
@@ -408,14 +370,12 @@ void OptionsCtrlImpl::DateTime::setTimestamp(DWORD dwTimestamp)
m_bNone = false;
m_dwTimestamp = dwTimestamp;
- if (m_hDateTimeWnd)
- {
+ if (m_hDateTimeWnd) {
SYSTEMTIME st = toSystemTime(dwTimestamp);
SendMessage(m_hDateTimeWnd, DTM_SETSYSTEMTIME, GDT_VALID, reinterpret_cast<LPARAM>(&st));
}
- else
- {
+ else {
m_pCtrl->setNodeText(m_hItem, getCombinedText().c_str());
}
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp b/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp
index 8af65d71dd..17b0a93b44 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl_edit.cpp
@@ -10,7 +10,7 @@
ext::string OptionsCtrlImpl::Edit::getEditText()
{
int nLen = GetWindowTextLength(m_hEditWnd);
- mu_text* szBuf = new mu_text[nLen + 1];
+ TCHAR* szBuf = new TCHAR[nLen + 1];
GetWindowText(m_hEditWnd, szBuf, nLen + 1);
@@ -31,14 +31,14 @@ ext::string OptionsCtrlImpl::Edit::getCombinedText()
{
ext::string strTemp = m_strLabel;
- strTemp += muT(": ");
+ strTemp += _T(": ");
strTemp += m_strEdit;
return strTemp;
}
}
-OptionsCtrlImpl::Edit::Edit(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, const mu_text* szEdit, DWORD dwFlags, DWORD dwData)
+OptionsCtrlImpl::Edit::Edit(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, const TCHAR* szEdit, DWORD dwFlags, DWORD dwData)
: Item(pCtrl, itEdit, szLabel, dwFlags, dwData), m_hEditWnd(NULL)
{
m_strEdit = szEdit;
@@ -154,7 +154,7 @@ void OptionsCtrlImpl::Edit::childAdded(Item* pChild)
}
}
-const mu_text* OptionsCtrlImpl::Edit::getString()
+const TCHAR* OptionsCtrlImpl::Edit::getString()
{
if (m_hEditWnd)
{
@@ -164,7 +164,7 @@ const mu_text* OptionsCtrlImpl::Edit::getString()
return m_strEdit.c_str();
}
-void OptionsCtrlImpl::Edit::setString(const mu_text* szString)
+void OptionsCtrlImpl::Edit::setString(const TCHAR* szString)
{
m_strEdit = szString;
@@ -178,7 +178,7 @@ void OptionsCtrlImpl::Edit::setString(const mu_text* szString)
}
}
-void OptionsCtrlImpl::Edit::setLabel(const mu_text* szLabel)
+void OptionsCtrlImpl::Edit::setLabel(const TCHAR* szLabel)
{
m_strLabel = szLabel;
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_group.cpp b/plugins/HistoryStats/src/optionsctrlimpl_group.cpp
index 0c389e517f..9f99930a3a 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl_group.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl_group.cpp
@@ -5,7 +5,7 @@
* OptionsCtrlImpl::Group
*/
-OptionsCtrlImpl::Group::Group(OptionsCtrlImpl* pCtrl, Item* pParent, const mu_text* szLabel, DWORD dwFlags, DWORD dwData)
+OptionsCtrlImpl::Group::Group(OptionsCtrlImpl* pCtrl, Item* pParent, const TCHAR* szLabel, DWORD dwFlags, DWORD dwData)
: Item(pCtrl, itGroup, szLabel, dwFlags, dwData)
{
m_bDrawLine = bool_(dwFlags & OCF_DRAWLINE);
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_item.cpp b/plugins/HistoryStats/src/optionsctrlimpl_item.cpp
index e46a154629..998496bbc9 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl_item.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl_item.cpp
@@ -5,7 +5,7 @@
* OptionsCtrlImpl::Item
*/
-OptionsCtrlImpl::Item::Item(OptionsCtrlImpl* pCtrl, ItemType ItemType, const mu_text* szLabel, DWORD dwFlags, DWORD dwData)
+OptionsCtrlImpl::Item::Item(OptionsCtrlImpl* pCtrl, ItemType ItemType, const TCHAR* szLabel, DWORD dwFlags, DWORD dwData)
: m_pCtrl(pCtrl), m_hItem(NULL), m_nRef(1), m_ItemType(ItemType), m_strLabel(szLabel), m_dwData(dwData)
{
m_bEnabled = !(dwFlags & OCF_DISABLED);
@@ -29,7 +29,7 @@ void OptionsCtrlImpl::Item::enableChilds(bool bEnable)
}
}
-void OptionsCtrlImpl::Item::setLabel(const mu_text* szLabel)
+void OptionsCtrlImpl::Item::setLabel(const TCHAR* szLabel)
{
m_strLabel = szLabel;
diff --git a/plugins/HistoryStats/src/optionsctrlimpl_radio.cpp b/plugins/HistoryStats/src/optionsctrlimpl_radio.cpp
index 75491192af..0a9c085960 100644
--- a/plugins/HistoryStats/src/optionsctrlimpl_radio.cpp
+++ b/plugins/HistoryStats/src/optionsctrlimpl_radio.cpp
@@ -74,7 +74,7 @@ void OptionsCtrlImpl::Radio::updateItem()
}
}
-OptionsCtrlImpl::Radio::Radio(OptionsCtrlImpl* pCtrl, Item* pParent, Radio* pSibling, const mu_text* szLabel, DWORD dwFlags, DWORD dwData)
+OptionsCtrlImpl::Radio::Radio(OptionsCtrlImpl* pCtrl, Item* pParent, Radio* pSibling, const TCHAR* szLabel, DWORD dwFlags, DWORD dwData)
: Item(pCtrl, itRadio, szLabel, dwFlags, dwData)
{
m_bDisableChildsOnUncheck = bool_(dwFlags & OCF_DISABLECHILDSONUNCHECK);
diff --git a/plugins/HistoryStats/src/protocol.cpp b/plugins/HistoryStats/src/protocol.cpp
index e71340d800..d657b698ec 100644
--- a/plugins/HistoryStats/src/protocol.cpp
+++ b/plugins/HistoryStats/src/protocol.cpp
@@ -5,14 +5,6 @@
ext::string Protocol::getDisplayName(const ext::a::string& protocol)
{
- mu_text protoName[128];
-
- if (mu::protosvc::getName(protocol.c_str(), 128, protoName) == 0)
- {
- return protoName;
- }
- else
- {
- return utils::fromA(protocol);
- }
+ PROTOACCOUNT *pa = ProtoGetAccount(protocol.c_str());
+ return (pa == NULL) ? utils::fromA(protocol) : pa->tszAccountName;
}
diff --git a/plugins/HistoryStats/src/settings.cpp b/plugins/HistoryStats/src/settings.cpp
index 67d395c332..207af935ae 100644
--- a/plugins/HistoryStats/src/settings.cpp
+++ b/plugins/HistoryStats/src/settings.cpp
@@ -13,11 +13,11 @@
Settings::CharMapper::CharMapper(const Settings& settings)
{
- static const mu_text* defaultWordDelimiters = muT("\n\r\t");
+ static const TCHAR* defaultWordDelimiters = _T("\n\r\t");
array_each_(i, m_CharMap)
{
- m_CharMap[i] = static_cast<mu_text>(i);
+ m_CharMap[i] = static_cast<TCHAR>(i);
}
LCID lcid = GetUserDefaultLCID();
@@ -30,12 +30,12 @@ Settings::CharMapper::CharMapper(const Settings& settings)
upto_each_(i, 3)
{
- m_CharMap[static_cast<t_uchar>(defaultWordDelimiters[i])] = muC(' ');
+ m_CharMap[static_cast<t_uchar>(defaultWordDelimiters[i])] = ' ';
}
upto_each_(i, settings.m_WordDelimiters.length())
{
- m_CharMap[static_cast<t_uchar>(settings.m_WordDelimiters[i])] = muC(' ');
+ m_CharMap[static_cast<t_uchar>(settings.m_WordDelimiters[i])] = ' ';
}
}
@@ -50,17 +50,17 @@ Settings::Filter::Filter(const ext::string& strID)
struct tm curTM = *localtime(&curTime);
m_strName += utils::intToPadded(1900 + curTM.tm_year, 4);
- m_strName += muT("-");
+ m_strName += _T("-");
m_strName += utils::intToPadded(1 + curTM.tm_mon, 2);
- m_strName += muT("-");
+ m_strName += _T("-");
m_strName += utils::intToPadded(curTM.tm_mday, 2);
- m_strName += muT(" ");
+ m_strName += _T(" ");
m_strName += utils::intToPadded(curTM.tm_hour, 2);
- m_strName += muT(":");
+ m_strName += _T(":");
m_strName += utils::intToPadded(curTM.tm_min, 2);
- m_strName += muT(":");
+ m_strName += _T(":");
m_strName += utils::intToPadded(curTM.tm_sec, 2);
- m_strName += muT(".");
+ m_strName += _T(".");
m_strName += utils::intToPadded(GetTickCount() % 1000, 3);
}
@@ -68,12 +68,12 @@ Settings::Filter::Filter(const ext::string& strID)
* Settings
*/
-const mu_text* Settings::getDefaultWordDelimiters()
+const TCHAR* Settings::getDefaultWordDelimiters()
{
- return muT(".?!,:;()[]{}<>+-*/=\\_^&\"'~%#@|$");
+ return _T(".?!,:;()[]{}<>+-*/=\\_^&\"'~%#@|$");
}
-const mu_text* Settings::getDefaultStyleSheet()
+const TCHAR* Settings::getDefaultStyleSheet()
{
static ext::string StyleSheet;
@@ -81,157 +81,153 @@ const mu_text* Settings::getDefaultStyleSheet()
{
// general formats
StyleSheet +=
- muT("h1 { font-family: Verdana, Arial, sans-serif; font-size: 16pt; }\n")
- muT("div, span, td { font-family: Verdana, Arial, sans-serif; font-size: 10pt; }\n")
- muT("span[title], td[title], div[title] { cursor: help; }\n")
- muT("span[title] { border-bottom: 1px dotted; }\n")
- muT("span[title]:hover, td[title]:hover { background-color: #FFFFCF; }\n")
- muT("table { border-collapse: collapse; }\n")
- muT("td { border: 1px solid ") + utils::colorToHTML(con::ColorBorder) + muT("; text-align: left; padding: 2px 4px 2px 4px; }\n")
- muT("div.footer { padding: 12px 0px 8px 0px; }\n");
+ _T("h1 { font-family: Verdana, Arial, sans-serif; font-size: 16pt; }\n")
+ _T("div, span, td { font-family: Verdana, Arial, sans-serif; font-size: 10pt; }\n")
+ _T("span[title], td[title], div[title] { cursor: help; }\n")
+ _T("span[title] { border-bottom: 1px dotted; }\n")
+ _T("span[title]:hover, td[title]:hover { background-color: #FFFFCF; }\n")
+ _T("table { border-collapse: collapse; }\n")
+ _T("td { border: 1px solid ") + utils::colorToHTML(con::ColorBorder) + _T("; text-align: left; padding: 2px 4px 2px 4px; }\n")
+ _T("div.footer { padding: 12px 0px 8px 0px; }\n");
// special row formats
StyleSheet +=
- muT("tr.header td { background-color: ") + utils::colorToHTML(con::ColorHeader) + muT("; text-align: center; }\n")
- muT("tr.header td div { height: 1px; overflow: hidden; }\n")
- muT("tr.omitted td { background-color: ") + utils::colorToHTML(con::ColorOmitted) + muT("; }\n")
- muT("tr.totals td { background-color: ") + utils::colorToHTML(con::ColorTotals) + muT("; }\n");
+ _T("tr.header td { background-color: ") + utils::colorToHTML(con::ColorHeader) + _T("; text-align: center; }\n")
+ _T("tr.header td div { height: 1px; overflow: hidden; }\n")
+ _T("tr.omitted td { background-color: ") + utils::colorToHTML(con::ColorOmitted) + _T("; }\n")
+ _T("tr.totals td { background-color: ") + utils::colorToHTML(con::ColorTotals) + _T("; }\n");
// special cell formats
StyleSheet +=
- muT("td.num { text-align: right; }\n")
- muT("td.bars_bottom { vertical-align: bottom; padding: 4px 0px 0px 0px; }\n")
- muT("td.bars_middle { vertical-align: middle; padding: 2px 0px 2px 0px; }\n")
- muT("td.img_bottom { vertical-align: bottom; text-align: center; padding: 4px 0px 0px 0px; }\n")
- muT("td.img_middle { vertical-align: middle; text-align: center; padding: 2px 0px 2px 0px; }\n");
+ _T("td.num { text-align: right; }\n")
+ _T("td.bars_bottom { vertical-align: bottom; padding: 4px 0px 0px 0px; }\n")
+ _T("td.bars_middle { vertical-align: middle; padding: 2px 0px 2px 0px; }\n")
+ _T("td.img_bottom { vertical-align: bottom; text-align: center; padding: 4px 0px 0px 0px; }\n")
+ _T("td.img_middle { vertical-align: middle; text-align: center; padding: 2px 0px 2px 0px; }\n");
}
return StyleSheet.c_str();
}
-const mu_text* Settings::getDefaultHideContactMenuProtos()
+const TCHAR* Settings::getDefaultHideContactMenuProtos()
{
- return muT("{num:0;}");
+ return _T("{num:0;}");
}
-const mu_text* Settings::getDefaultProtosIgnore()
+const TCHAR* Settings::getDefaultProtosIgnore()
{
- return muT("{num:0;}");
+ return _T("{num:0;}");
}
-const mu_text* Settings::getDefaultColumns()
+const TCHAR* Settings::getDefaultColumns()
{
return
- muT("{num:11;}")
- muT("0{enabled:y;guid:rank;}")
- muT("1{enabled:y;guid:nick;}1/data{detail:y;}")
- muT("2{enabled:y;guid:protocol;}")
- muT("3{enabled:y;guid:group;}")
- muT("4{enabled:y;guid:inout;}4/data{abs_time:1;absolute:n;detail:y;detail_percent:n;graph_percent:y;show_sum:y;source:0;}")
- muT("5{enabled:y;guid:inout;}5/data{abs_time:1;absolute:n;detail:y;detail_percent:n;graph_percent:y;show_sum:y;source:1;}")
- muT("6{enabled:y;guid:inout;}6/data{abs_time:1;absolute:n;detail:y;detail_percent:n;graph_percent:y;show_sum:y;source:2;}")
- muT("7{enabled:y;guid:chatduration;}7/data{detail:y;graph:y;vis_mode:3;}")
- muT("8{enabled:y;guid:commonwords;}8/data{detail:y;filter_links:y;filter_words:0;in_out_color:n;max_length:0;min_length:1;num:10;offset:0;source:2;vis_mode:0;}")
- muT("9{enabled:y;guid:wordcount;}9/data{detail:y;filter_links:y;filter_words:0;max_length:0;min_length:1;source:2;vis_mode:0;}")
- muT("10{enabled:y;guid:split;}10/data{block_unit:0;blocks:28;detail:y;graph_align:1;source:0;source_type:2;units_per_block:6;vis_mode:0;}");
+ _T("{num:11;}")
+ _T("0{enabled:y;guid:rank;}")
+ _T("1{enabled:y;guid:nick;}1/data{detail:y;}")
+ _T("2{enabled:y;guid:protocol;}")
+ _T("3{enabled:y;guid:group;}")
+ _T("4{enabled:y;guid:inout;}4/data{abs_time:1;absolute:n;detail:y;detail_percent:n;graph_percent:y;show_sum:y;source:0;}")
+ _T("5{enabled:y;guid:inout;}5/data{abs_time:1;absolute:n;detail:y;detail_percent:n;graph_percent:y;show_sum:y;source:1;}")
+ _T("6{enabled:y;guid:inout;}6/data{abs_time:1;absolute:n;detail:y;detail_percent:n;graph_percent:y;show_sum:y;source:2;}")
+ _T("7{enabled:y;guid:chatduration;}7/data{detail:y;graph:y;vis_mode:3;}")
+ _T("8{enabled:y;guid:commonwords;}8/data{detail:y;filter_links:y;filter_words:0;in_out_color:n;max_length:0;min_length:1;num:10;offset:0;source:2;vis_mode:0;}")
+ _T("9{enabled:y;guid:wordcount;}9/data{detail:y;filter_links:y;filter_words:0;max_length:0;min_length:1;source:2;vis_mode:0;}")
+ _T("10{enabled:y;guid:split;}10/data{block_unit:0;blocks:28;detail:y;graph_align:1;source:0;source_type:2;units_per_block:6;vis_mode:0;}");
}
-const mu_text* Settings::getDefaultSort()
+const TCHAR* Settings::getDefaultSort()
{
return
- muT("0{by:17;asc:n}")
- muT("1{by:-1;asc:y}")
- muT("2{by:-1;asc:y}");
+ _T("0{by:17;asc:n}")
+ _T("1{by:-1;asc:y}")
+ _T("2{by:-1;asc:y}");
}
-const mu_text* Settings::getDefaultOutputFile()
+const TCHAR* Settings::getDefaultOutputFile()
{
- return muT("HistoryStats\\stats.html");
+ return _T("HistoryStats\\stats.html");
}
-const mu_text* Settings::getDefaultOutputExtraFolder()
+const TCHAR* Settings::getDefaultOutputExtraFolder()
{
- return muT("extra");
+ return _T("extra");
}
-const mu_text* Settings::getDefaultFilterWords()
+const TCHAR* Settings::getDefaultFilterWords()
{
- return muT("{num:0;}");
+ return _T("{num:0;}");
}
void Settings::clearColumns()
{
while (countCol() > 0)
- {
delCol(0);
- }
}
-Settings::Settings()
- : m_VersionCurrent(g_pluginInfoEx.version)
+Settings::Settings() :
+ m_VersionCurrent(g_pluginInfoEx.version),
+
// global settings
- , m_OnStartup(false)
- , m_ShowMainMenu(true)
- , m_ShowMainMenuSub(true)
- , m_ShowContactMenu(true)
- , m_ShowContactMenuPseudo(false)
-// , m_HideContactMenuProtos
- , m_GraphicsMode(gmHTML)
- , m_PNGMode(pmHTMLFallBack)
- , m_ThreadLowPriority(true)
- , m_PathToBrowser(muT(""))
+ m_OnStartup(false),
+ m_ShowMainMenu(true),
+ m_ShowMainMenuSub(true),
+ m_ShowContactMenu(true),
+ m_ShowContactMenuPseudo(false),
+ m_GraphicsMode(gmHTML),
+ m_PNGMode(pmHTMLFallBack),
+ m_ThreadLowPriority(true),
+ m_PathToBrowser(_T("")),
+
// input settings
- , m_ChatSessionMinDur(0)
- , m_ChatSessionTimeout(900)
- , m_AverageMinTime(0)
- , m_WordDelimiters(muT("")) // see below
-// , m_ProtosIgnore
- , m_IgnoreOld(0)
- , m_IgnoreBefore(muT(""))
- , m_IgnoreAfter(muT(""))
- , m_FilterRawRTF(false)
- , m_FilterBBCodes(false)
- , m_MetaContactsMode(mcmBoth)
- , m_MergeContacts(false)
- , m_MergeContactsGroups(false)
- , m_MergeMode(mmStrictMerge)
+ m_ChatSessionMinDur(0),
+ m_ChatSessionTimeout(900),
+ m_AverageMinTime(0),
+ m_WordDelimiters(_T("")),
+ m_IgnoreOld(0),
+ m_IgnoreBefore(_T("")),
+ m_IgnoreAfter(_T("")),
+ m_FilterRawRTF(false),
+ m_FilterBBCodes(false),
+ m_MetaContactsMode(mcmBoth),
+ m_MergeContacts(false),
+ m_MergeContactsGroups(false),
+ m_MergeMode(mmStrictMerge),
+
// output settings
- , m_RemoveEmptyContacts(false)
- , m_RemoveOutChatsZero(false)
- , m_RemoveOutBytesZero(false)
- , m_RemoveInChatsZero(false)
- , m_RemoveInBytesZero(false)
- , m_OmitContacts(false)
- , m_OmitByValue(false)
- , m_OmitByValueData(obvChatsTotal)
- , m_OmitByValueLimit(5)
- , m_OmitByTime(false)
- , m_OmitByTimeDays(180)
- , m_OmitByRank(true)
- , m_OmitNumOnTop(10)
- , m_OmittedInTotals(true)
- , m_OmittedInExtraRow(true)
- , m_CalcTotals(true)
- , m_TableHeader(true)
- , m_TableHeaderRepeat(0)
- , m_TableHeaderVerbose(false)
- , m_HeaderTooltips(true)
- , m_HeaderTooltipsIfCustom(true)
-// , m_Sort
- , m_OwnNick(muT("")) // see below
- , m_OutputVariables(false)
- , m_OutputFile(muT("")) // see below
- , m_OutputExtraToFolder(true)
- , m_OutputExtraFolder(muT("")) // see below
- , m_OverwriteAlways(false)
- , m_AutoOpenOptions(false)
- , m_AutoOpenStartup(false)
- , m_AutoOpenMenu(false)
- // shared column data
-// , m_FilterWords
+ m_RemoveEmptyContacts(false),
+ m_RemoveOutChatsZero(false),
+ m_RemoveOutBytesZero(false),
+ m_RemoveInChatsZero(false),
+ m_RemoveInBytesZero(false),
+ m_OmitContacts(false),
+ m_OmitByValue(false),
+ m_OmitByValueData(obvChatsTotal),
+ m_OmitByValueLimit(5),
+ m_OmitByTime(false),
+ m_OmitByTimeDays(180),
+ m_OmitByRank(true),
+ m_OmitNumOnTop(10),
+ m_OmittedInTotals(true),
+ m_OmittedInExtraRow(true),
+ m_CalcTotals(true),
+ m_TableHeader(true),
+ m_TableHeaderRepeat(0),
+ m_TableHeaderVerbose(false),
+ m_HeaderTooltips(true),
+ m_HeaderTooltipsIfCustom(true),
+ m_OwnNick(_T("")),
+ m_OutputVariables(false),
+ m_OutputFile(_T("")),
+ m_OutputExtraToFolder(true),
+ m_OutputExtraFolder(_T("")),
+ m_OverwriteAlways(false),
+ m_AutoOpenOptions(false),
+ m_AutoOpenStartup(false),
+ m_AutoOpenMenu(false)
{
m_WordDelimiters = getDefaultWordDelimiters();
- m_OwnNick = i18n(muT("(default nick)"));
+ m_OwnNick = TranslateT("(default nick)");
m_OutputFile = getDefaultOutputFile();
m_OutputExtraFolder = getDefaultOutputExtraFolder();
@@ -240,8 +236,8 @@ Settings::Settings()
m_Sort[2].by = skNothing; m_Sort[2].asc = true;
}
-Settings::Settings(const Settings& other)
- : m_VersionCurrent(g_pluginInfoEx.version)
+Settings::Settings(const Settings& other) :
+ m_VersionCurrent(g_pluginInfoEx.version)
{
*this = other;
}
@@ -268,12 +264,9 @@ bool Settings::delCol(int index)
bool Settings::delCol(Column* pCol)
{
- vector_each_(i, m_Columns)
- {
+ vector_each_(i, m_Columns) {
if (m_Columns[i] == pCol)
- {
return delCol(i);
- }
}
return false;
@@ -284,54 +277,40 @@ bool Settings::moveCol(Column* pCol, Column* pInsertAfter)
assert(pCol);
if (pCol == pInsertAfter)
- {
return true;
- }
int nColIndex = -1;
vector_each_(i, m_Columns)
{
- if (m_Columns[i] == pCol)
- {
+ if (m_Columns[i] == pCol) {
nColIndex = i;
break;
}
}
if (nColIndex == -1)
- {
return false;
- }
int nInsertIndex = -1;
- if (pInsertAfter)
- {
- vector_each_(i, m_Columns)
- {
- if (m_Columns[i] == pInsertAfter)
- {
+ if (pInsertAfter) {
+ vector_each_(i, m_Columns) {
+ if (m_Columns[i] == pInsertAfter) {
nInsertIndex = i;
break;
}
}
if (nInsertIndex == -1)
- {
return false;
- }
}
if (nInsertIndex == nColIndex - 1)
- {
return true;
- }
if (nInsertIndex < nColIndex)
- {
++nInsertIndex;
- }
m_Columns.erase(m_Columns.begin() + nColIndex);
m_Columns.insert(m_Columns.begin() + nInsertIndex, pCol);
@@ -350,9 +329,7 @@ bool Settings::manageFilterWords(HWND hParent, Column* pCol)
upto_each_(i, countCol())
{
Column* pCurCol = getCol(i);
-
- if (pCurCol != pCol && pCurCol->getFeatures() & Column::cfIsColBaseWords)
- {
+ if (pCurCol != pCol && pCurCol->getFeatures() & Column::cfIsColBaseWords) {
ColBaseWords* pCurWordsCol = reinterpret_cast<ColBaseWords*>(pCurCol);
citer_each_(ColFilterSet, j, pCurWordsCol->getFilterWords())
@@ -375,8 +352,7 @@ bool Settings::manageFilterWords(HWND hParent, Column* pCol)
dlg.setFilters(m_FilterWords);
dlg.setColFilters(pWordsCol->getFilterWords());
- if (dlg.showModal(hParent))
- {
+ if (dlg.showModal(hParent)) {
// read data from dialog
dlg.updateFilters(m_FilterWords);
pWordsCol->setFilterWords(dlg.getColFilters());
@@ -392,18 +368,14 @@ bool Settings::manageFilterWords(HWND hParent, Column* pCol)
upto_each_(i, countCol())
{
Column* pCurCol = getCol(i);
-
- if (pCurCol != pCol && pCurCol->getFeatures() & Column::cfIsColBaseWords)
- {
+ if (pCurCol != pCol && pCurCol->getFeatures() & Column::cfIsColBaseWords) {
ColBaseWords* pCurWordsCol = reinterpret_cast<ColBaseWords*>(pCurCol);
ReferencedFilters.clear();
citer_each_(ColFilterSet, j, pCurWordsCol->getFilterWords())
{
if (ValidSets.find(*j) != ValidSets.end())
- {
ReferencedFilters.insert(*j);
- }
}
pCurWordsCol->setFilterWords(ReferencedFilters);
@@ -423,9 +395,7 @@ const Settings::Filter* Settings::getFilter(const ext::string& strID) const
citer_each_(FilterSet, i, m_FilterWords)
{
if (i->getID() == strID)
- {
return &(*i);
- }
}
return NULL;
@@ -519,52 +489,37 @@ ext::string Settings::getOutputFile(DWORD timeStarted) const
// perform variables substitution (if activated)
if (m_OutputVariables)
- {
strFile = utils::replaceVariables(strFile, timeStarted, m_OwnNick.c_str());
- }
if (utils::isRelative(strFile))
- {
return utils::getMirandaPath() + strFile;
- }
- else
- {
- return strFile;
- }
+
+ return strFile;
}
ext::string Settings::getOutputPrefix(DWORD timeStarted) const
{
- if (m_OutputExtraToFolder && !m_OutputExtraFolder.empty())
- {
+ if (m_OutputExtraToFolder && !m_OutputExtraFolder.empty()) {
ext::string extraFolder = m_OutputExtraFolder;
// perform variables substitution (if activated)
if (m_OutputVariables)
- {
extraFolder = utils::replaceVariables(extraFolder, timeStarted, m_OwnNick.c_str());
- }
// strip leading backslashes
- while (!extraFolder.empty() && extraFolder[0] == muC('\\'))
- {
+ while (!extraFolder.empty() && extraFolder[0] == '\\')
extraFolder.erase(0, 1);
- }
// strip trailing backslashes
- while (!extraFolder.empty() && extraFolder[extraFolder.length() - 1] == muC('\\'))
- {
+ while (!extraFolder.empty() && extraFolder[extraFolder.length() - 1] == '\\')
extraFolder.erase(extraFolder.length() - 1, 1);
- }
// append, if still not empty
if (!extraFolder.empty())
- {
- return extraFolder + muT("\\");
- }
+ return extraFolder + _T("\\");
}
- return muT("");
+ return _T("");
}
bool Settings::isPNGOutputActiveAndAvailable() const
@@ -582,50 +537,33 @@ DWORD Settings::getIgnoreAfter() const
return utils::parseDate(m_IgnoreAfter);
}
-
void Settings::ensureConstraints()
{
if (m_GraphicsMode < gmHTML || m_GraphicsMode > gmPNG)
- {
m_GraphicsMode = gmHTML;
- }
if (m_PNGMode < pmHTMLFallBack || m_PNGMode > pmPreferHTML)
- {
m_PNGMode = pmHTMLFallBack;
- }
if (m_IgnoreOld < 0)
- {
m_IgnoreOld = 0;
- }
if (m_ChatSessionMinDur < 0)
- {
m_ChatSessionMinDur = 0;
- }
if (m_ChatSessionTimeout < 1)
- {
m_ChatSessionTimeout = 1;
- }
utils::ensureRange(m_AverageMinTime, 0, 1000, 0);
if (m_MetaContactsMode < mcmMetaOnly || m_MetaContactsMode > mcmIgnoreMeta)
- {
m_MetaContactsMode = mcmBoth;
- }
if (m_MergeMode < mmTolerantMerge || m_MergeMode > mmNoMerge)
- {
m_MergeMode = mmStrictMerge;
- }
if (m_OmitByValueData < obvFIRST || m_OmitByValueData > obvLAST)
- {
m_OmitByValueData = obvChatsTotal;
- }
utils::ensureRange(m_OmitByValueLimit, 1, 10000000, 5);
utils::ensureRange(m_OmitByTimeDays, 1, 10000, 180);
@@ -633,14 +571,10 @@ void Settings::ensureConstraints()
utils::ensureRange(m_TableHeaderRepeat, 0, 1000, 0);
}
-void Settings::openURL(const mu_text* szURL)
+void Settings::openURL(const TCHAR* szURL)
{
if (m_PathToBrowser.empty())
- {
- ShellExecute(NULL, muT("open"), szURL, NULL, NULL, SW_SHOWNORMAL);
- }
+ ShellExecute(NULL, _T("open"), szURL, NULL, NULL, SW_SHOWNORMAL);
else
- {
- ShellExecute(NULL, muT("open"), m_PathToBrowser.c_str(), szURL, NULL, SW_SHOWNORMAL);
- }
+ ShellExecute(NULL, _T("open"), m_PathToBrowser.c_str(), szURL, NULL, SW_SHOWNORMAL);
}
diff --git a/plugins/HistoryStats/src/settings.h b/plugins/HistoryStats/src/settings.h
index 9af8f1f30a..450ab1b8ff 100644
--- a/plugins/HistoryStats/src/settings.h
+++ b/plugins/HistoryStats/src/settings.h
@@ -133,21 +133,21 @@ public:
: private pattern::NotCopyable<Settings>
{
private:
-#if defined(MU_WIDE)
+#if defined(_UNICODE)
typedef unsigned short t_uchar;
-#else // MU_WIDE
+#else // _UNICODE
typedef unsigned char t_uchar;
-#endif // MU_WIDE
-#define T_NUMCHARS (1 << (sizeof(mu_text) * 8))
+#endif // _UNICODE
+#define T_NUMCHARS (1 << (sizeof(TCHAR) * 8))
private:
- mu_text m_CharMap[T_NUMCHARS];
+ TCHAR m_CharMap[T_NUMCHARS];
#undef T_NUMCHARS
public:
explicit CharMapper(const Settings& settings);
- mu_text mapChar(mu_text c) const { return m_CharMap[static_cast<t_uchar>(c)]; }
+ TCHAR mapChar(TCHAR c) const { return m_CharMap[static_cast<t_uchar>(c)]; }
};
typedef std::set<ext::string> WordSet;
@@ -193,15 +193,15 @@ public:
typedef std::vector<Column*> ColumnList;
public:
- static const mu_text* getDefaultWordDelimiters();
- static const mu_text* getDefaultStyleSheet();
- static const mu_text* getDefaultHideContactMenuProtos();
- static const mu_text* getDefaultProtosIgnore();
- static const mu_text* getDefaultColumns();
- static const mu_text* getDefaultSort();
- static const mu_text* getDefaultOutputFile();
- static const mu_text* getDefaultOutputExtraFolder();
- static const mu_text* getDefaultFilterWords();
+ static const TCHAR* getDefaultWordDelimiters();
+ static const TCHAR* getDefaultStyleSheet();
+ static const TCHAR* getDefaultHideContactMenuProtos();
+ static const TCHAR* getDefaultProtosIgnore();
+ static const TCHAR* getDefaultColumns();
+ static const TCHAR* getDefaultSort();
+ static const TCHAR* getDefaultOutputFile();
+ static const TCHAR* getDefaultOutputExtraFolder();
+ static const TCHAR* getDefaultFilterWords();
public:
const DWORD m_VersionCurrent;
@@ -305,7 +305,7 @@ public:
void ensureConstraints();
- void openURL(const mu_text* szURL);
+ void openURL(const TCHAR* szURL);
};
#endif // HISTORYSTATS_GUARD_SETTINGS_H
diff --git a/plugins/HistoryStats/src/settingsserializer.cpp b/plugins/HistoryStats/src/settingsserializer.cpp
index 669ddeb346..5416f492a8 100644
--- a/plugins/HistoryStats/src/settingsserializer.cpp
+++ b/plugins/HistoryStats/src/settingsserializer.cpp
@@ -8,13 +8,14 @@
* SettingsSerializer
*/
-static const mu_ansi* g_UsedSettings[] = {
+static const char* g_UsedSettings[] = {
// special
con::SettVersion,
con::SettLastPage,
con::SettShowColumnInfo,
con::SettShowSupportInfo,
con::SettLastStatisticsFile,
+
// normal
con::SettAutoOpenOptions,
con::SettAutoOpenStartup,
@@ -74,7 +75,7 @@ static const mu_ansi* g_UsedSettings[] = {
con::SettWordDelimiters,
};
-SettingsSerializer::SettingsSerializer(const mu_ansi* module)
+SettingsSerializer::SettingsSerializer(const char* module)
{
m_DB.setContact(0);
m_DB.setModule(module);
@@ -92,15 +93,15 @@ void SettingsSerializer::readFromDB()
// -- global settings --
- m_OnStartup = m_DB.readBool(con::SettOnStartup , false);
- m_GraphicsMode = m_DB.readByte(con::SettGraphicsMode , gmHTML);
- m_PNGMode = m_DB.readByte(con::SettPNGMode , pmHTMLFallBack);
- m_ShowMainMenu = m_DB.readBool(con::SettMenuItem , true);
- m_ShowMainMenuSub = m_DB.readBool(con::SettShowMenuSub , true);
- m_ShowContactMenu = m_DB.readBool(con::SettShowContactMenu , true);
+ m_OnStartup = m_DB.readBool(con::SettOnStartup, false);
+ m_GraphicsMode = m_DB.readByte(con::SettGraphicsMode, gmHTML);
+ m_PNGMode = m_DB.readByte(con::SettPNGMode, pmHTMLFallBack);
+ m_ShowMainMenu = m_DB.readBool(con::SettMenuItem, true);
+ m_ShowMainMenuSub = m_DB.readBool(con::SettShowMenuSub, true);
+ m_ShowContactMenu = m_DB.readBool(con::SettShowContactMenu, true);
m_ShowContactMenuPseudo = m_DB.readBool(con::SettShowContactMenuPseudo, false);
- m_ThreadLowPriority = m_DB.readBool(con::SettThreadLowPriority , true);
- m_PathToBrowser = m_DB.readStr (con::SettPathToBrowser , muT(""));
+ m_ThreadLowPriority = m_DB.readBool(con::SettThreadLowPriority, true);
+ m_PathToBrowser = m_DB.readStr(con::SettPathToBrowser, _T(""));
m_HideContactMenuProtos.clear();
m_DB.readTree(con::SettHideContactMenuProtos, getDefaultHideContactMenuProtos(), settingsTree);
@@ -109,16 +110,14 @@ void SettingsSerializer::readFromDB()
upto_each_(i, nHideContactMenuProtos)
{
- m_HideContactMenuProtos.insert(utils::toA(settingsTree.readStr(utils::intToString(i).c_str(), muT(""))));
+ m_HideContactMenuProtos.insert(utils::toA(settingsTree.readStr(utils::intToString(i).c_str(), _T(""))));
}
// -- input settings --
-
-
- m_ChatSessionMinDur = m_DB.readWord(con::SettChatSessionMinDur , 0);
+ m_ChatSessionMinDur = m_DB.readWord(con::SettChatSessionMinDur, 0);
m_ChatSessionTimeout = m_DB.readWord(con::SettChatSessionTimeout, 900);
- m_AverageMinTime = m_DB.readWord(con::SettAverageMinTime , 0);
- m_WordDelimiters = m_DB.readStr (con::SettWordDelimiters , getDefaultWordDelimiters());
+ m_AverageMinTime = m_DB.readWord(con::SettAverageMinTime, 0);
+ m_WordDelimiters = m_DB.readStr(con::SettWordDelimiters, getDefaultWordDelimiters());
m_ProtosIgnore.clear();
m_DB.readTree(con::SettProtosIgnore, getDefaultProtosIgnore(), settingsTree);
@@ -127,18 +126,18 @@ void SettingsSerializer::readFromDB()
upto_each_(i, nIgnoreProtos)
{
- m_ProtosIgnore.insert(utils::toA(settingsTree.readStr(utils::intToString(i).c_str(), muT(""))));
+ m_ProtosIgnore.insert(utils::toA(settingsTree.readStr(utils::intToString(i).c_str(), _T(""))));
}
- m_IgnoreOld = m_DB.readWord(con::SettIgnoreOld , 0);
- m_IgnoreBefore = m_DB.readStr (con::SettIgnoreBefore , muT(""));
- m_IgnoreAfter = m_DB.readStr (con::SettIgnoreAfter , muT(""));
- m_FilterRawRTF = m_DB.readBool(con::SettFilterRawRTF , false);
- m_FilterBBCodes = m_DB.readBool(con::SettFilterBBCodes , false);
- m_MetaContactsMode = m_DB.readByte(con::SettMetaContactsMode , mcmBoth);
- m_MergeContacts = m_DB.readBool(con::SettMergeContacts , false);
+ m_IgnoreOld = m_DB.readWord(con::SettIgnoreOld, 0);
+ m_IgnoreBefore = m_DB.readStr(con::SettIgnoreBefore, _T(""));
+ m_IgnoreAfter = m_DB.readStr(con::SettIgnoreAfter, _T(""));
+ m_FilterRawRTF = m_DB.readBool(con::SettFilterRawRTF, false);
+ m_FilterBBCodes = m_DB.readBool(con::SettFilterBBCodes, false);
+ m_MetaContactsMode = m_DB.readByte(con::SettMetaContactsMode, mcmBoth);
+ m_MergeContacts = m_DB.readBool(con::SettMergeContacts, false);
m_MergeContactsGroups = m_DB.readBool(con::SettMergeContactsGroups, false);
- m_MergeMode = m_DB.readByte(con::SettMergeMode , mmStrictMerge);
+ m_MergeMode = m_DB.readByte(con::SettMergeMode, mmStrictMerge);
// -- column settings --
@@ -153,12 +152,11 @@ void SettingsSerializer::readFromDB()
settingsTree.setKey(colPrefix.c_str());
- Column* pCol = Column::fromUID(settingsTree.readStr(con::KeyGUID, muT("")));
+ Column* pCol = Column::fromUID(settingsTree.readStr(con::KeyGUID, _T("")));
- if (pCol)
- {
+ if (pCol) {
pCol->setEnabled(settingsTree.readBool(con::KeyEnabled, true));
- pCol->setCustomTitle(settingsTree.readStr(con::KeyTitle, muT("")));
+ pCol->setCustomTitle(settingsTree.readStr(con::KeyTitle, _T("")));
settingsTree.setKey((colPrefix + con::SuffixData).c_str());
@@ -167,30 +165,30 @@ void SettingsSerializer::readFromDB()
addCol(pCol);
}
}
-
+
// -- output settings --
- m_RemoveEmptyContacts = m_DB.readBool (con::SettRemoveEmptyContacts , false);
- m_RemoveOutChatsZero = m_DB.readBool (con::SettRemoveOutChatsZero , false);
- m_RemoveOutBytesZero = m_DB.readBool (con::SettRemoveOutBytesZero , false);
- m_RemoveInChatsZero = m_DB.readBool (con::SettRemoveInChatsZero , false);
- m_RemoveInBytesZero = m_DB.readBool (con::SettRemoveInBytesZero , false);
- m_OmitContacts = m_DB.readBool (con::SettOmitContacts , false);
- m_OmitByValue = m_DB.readBool (con::SettOmitByValue , false);
- m_OmitByValueData = m_DB.readByte (con::SettOmitByValueData , obvChatsTotal);
- m_OmitByValueLimit = m_DB.readDWord(con::SettOmitByValueLimit , 5);
- m_OmitByTime = m_DB.readBool (con::SettOmitByTime , false);
- m_OmitByTimeDays = m_DB.readWord (con::SettOmitByTimeDays , 180);
- m_OmitByRank = m_DB.readBool (con::SettOmitByRank , true);
- m_OmitNumOnTop = m_DB.readWord (con::SettOmitNumOnTop , 10);
- m_OmittedInTotals = m_DB.readBool (con::SettOmittedInTotals , true);
- m_OmittedInExtraRow = m_DB.readBool (con::SettOmittedInExtraRow , true);
- m_CalcTotals = m_DB.readBool (con::SettCalcTotals , true);
- m_TableHeader = m_DB.readBool (con::SettTableHeader , true);
- m_TableHeaderRepeat = m_DB.readWord (con::SettTableHeaderRepeat , 0);
- m_TableHeaderVerbose = m_DB.readBool (con::SettTableHeaderVerbose , false);
- m_HeaderTooltips = m_DB.readBool (con::SettHeaderTooltips , true);
- m_HeaderTooltipsIfCustom = m_DB.readBool (con::SettHeaderTooltipsIfCustom, true);
+ m_RemoveEmptyContacts = m_DB.readBool(con::SettRemoveEmptyContacts, false);
+ m_RemoveOutChatsZero = m_DB.readBool(con::SettRemoveOutChatsZero, false);
+ m_RemoveOutBytesZero = m_DB.readBool(con::SettRemoveOutBytesZero, false);
+ m_RemoveInChatsZero = m_DB.readBool(con::SettRemoveInChatsZero, false);
+ m_RemoveInBytesZero = m_DB.readBool(con::SettRemoveInBytesZero, false);
+ m_OmitContacts = m_DB.readBool(con::SettOmitContacts, false);
+ m_OmitByValue = m_DB.readBool(con::SettOmitByValue, false);
+ m_OmitByValueData = m_DB.readByte(con::SettOmitByValueData, obvChatsTotal);
+ m_OmitByValueLimit = m_DB.readDWord(con::SettOmitByValueLimit, 5);
+ m_OmitByTime = m_DB.readBool(con::SettOmitByTime, false);
+ m_OmitByTimeDays = m_DB.readWord(con::SettOmitByTimeDays, 180);
+ m_OmitByRank = m_DB.readBool(con::SettOmitByRank, true);
+ m_OmitNumOnTop = m_DB.readWord(con::SettOmitNumOnTop, 10);
+ m_OmittedInTotals = m_DB.readBool(con::SettOmittedInTotals, true);
+ m_OmittedInExtraRow = m_DB.readBool(con::SettOmittedInExtraRow, true);
+ m_CalcTotals = m_DB.readBool(con::SettCalcTotals, true);
+ m_TableHeader = m_DB.readBool(con::SettTableHeader, true);
+ m_TableHeaderRepeat = m_DB.readWord(con::SettTableHeaderRepeat, 0);
+ m_TableHeaderVerbose = m_DB.readBool(con::SettTableHeaderVerbose, false);
+ m_HeaderTooltips = m_DB.readBool(con::SettHeaderTooltips, true);
+ m_HeaderTooltipsIfCustom = m_DB.readBool(con::SettHeaderTooltipsIfCustom, true);
m_DB.readTree(con::SettSort, getDefaultSort(), settingsTree);
@@ -201,22 +199,22 @@ void SettingsSerializer::readFromDB()
m_Sort[i].by = settingsTree.readIntRanged(con::KeyBy, (i == 0) ? skBytesTotalAvg : skNothing, (i == 0) ? skFIRST : skNothing, skLAST);
m_Sort[i].asc = settingsTree.readBool(con::KeyAsc, i != 0);
}
-
- m_OwnNick = m_DB.readStr (con::SettNickname , defaultNick.c_str());
- m_OutputVariables = m_DB.readBool(con::SettOutputVariables , false);
- m_OutputFile = m_DB.readStr (con::SettOutput , getDefaultOutputFile());
+
+ m_OwnNick = m_DB.readStr(con::SettNickname, defaultNick.c_str());
+ m_OutputVariables = m_DB.readBool(con::SettOutputVariables, false);
+ m_OutputFile = m_DB.readStr(con::SettOutput, getDefaultOutputFile());
m_OutputExtraToFolder = m_DB.readBool(con::SettOutputExtraToFolder, true);
- m_OutputExtraFolder = m_DB.readStr (con::SettOutputExtraFolder , getDefaultOutputExtraFolder());
- m_OverwriteAlways = m_DB.readBool(con::SettOverwriteAlways , false);
- m_AutoOpenOptions = m_DB.readBool(con::SettAutoOpenOptions , false);
- m_AutoOpenStartup = m_DB.readBool(con::SettAutoOpenStartup , false);
- m_AutoOpenMenu = m_DB.readBool(con::SettAutoOpenMenu , false);
+ m_OutputExtraFolder = m_DB.readStr(con::SettOutputExtraFolder, getDefaultOutputExtraFolder());
+ m_OverwriteAlways = m_DB.readBool(con::SettOverwriteAlways, false);
+ m_AutoOpenOptions = m_DB.readBool(con::SettAutoOpenOptions, false);
+ m_AutoOpenStartup = m_DB.readBool(con::SettAutoOpenStartup, false);
+ m_AutoOpenMenu = m_DB.readBool(con::SettAutoOpenMenu, false);
// -- shared column data --
m_FilterWords.clear();
m_DB.readTree(con::SettFilterWords, getDefaultFilterWords(), settingsTree);
-
+
int nFilters = settingsTree.readInt(con::KeyNum, 0);
upto_each_(i, nFilters)
@@ -226,21 +224,20 @@ void SettingsSerializer::readFromDB()
// read filter attributes
settingsTree.setKey(strPrefix.c_str());
- Filter* curFilter = (Filter*)&(m_FilterWords.insert(Filter(settingsTree.readStr(con::KeyID, muT("")))).first);
+ Filter* curFilter = (Filter*)&(m_FilterWords.insert(Filter(settingsTree.readStr(con::KeyID, _T("")))).first);
- curFilter->setName(settingsTree.readStr(con::KeyName, muT("")));
+ curFilter->setName(settingsTree.readStr(con::KeyName, _T("")));
curFilter->setMode(settingsTree.readIntRanged(con::KeyMode, fwmWordsMatching, fwmFIRST, fwmLAST));
int nNumWords = settingsTree.readInt(con::KeyNumWords, 0);
- if (nNumWords > 0)
- {
+ if (nNumWords > 0) {
// read filter words
strPrefix += con::SuffixWords;
settingsTree.setKey(strPrefix.c_str());
upto_each_(j, nNumWords)
{
- curFilter->addWord(settingsTree.readStr(utils::intToString(j).c_str(), muT("")));
+ curFilter->addWord(settingsTree.readStr(utils::intToString(j).c_str(), _T("")));
}
}
}
@@ -254,8 +251,7 @@ void SettingsSerializer::readFromDB()
void SettingsSerializer::writeToDB()
{
// update silently if DB entries are from an older version
- if (isDBUpdateNeeded())
- {
+ if (isDBUpdateNeeded()) {
updateDB();
}
@@ -264,15 +260,15 @@ void SettingsSerializer::writeToDB()
// -- global settings --
- m_DB.writeBool(con::SettOnStartup , m_OnStartup);
- m_DB.writeBool(con::SettMenuItem , m_ShowMainMenu);
- m_DB.writeBool(con::SettShowMenuSub , m_ShowMainMenuSub);
- m_DB.writeBool(con::SettShowContactMenu , m_ShowContactMenu);
+ m_DB.writeBool(con::SettOnStartup, m_OnStartup);
+ m_DB.writeBool(con::SettMenuItem, m_ShowMainMenu);
+ m_DB.writeBool(con::SettShowMenuSub, m_ShowMainMenuSub);
+ m_DB.writeBool(con::SettShowContactMenu, m_ShowContactMenu);
m_DB.writeBool(con::SettShowContactMenuPseudo, m_ShowContactMenuPseudo);
- m_DB.writeByte(con::SettGraphicsMode , m_GraphicsMode);
- m_DB.writeByte(con::SettPNGMode , m_PNGMode);
- m_DB.writeBool(con::SettThreadLowPriority , m_ThreadLowPriority);
- m_DB.writeStr (con::SettPathToBrowser , m_PathToBrowser.c_str());
+ m_DB.writeByte(con::SettGraphicsMode, m_GraphicsMode);
+ m_DB.writeByte(con::SettPNGMode, m_PNGMode);
+ m_DB.writeBool(con::SettThreadLowPriority, m_ThreadLowPriority);
+ m_DB.writeStr(con::SettPathToBrowser, m_PathToBrowser.c_str());
settingsTree.clear();
settingsTree.writeInt(con::KeyNum, m_HideContactMenuProtos.size());
@@ -290,10 +286,10 @@ void SettingsSerializer::writeToDB()
// -- input settings --
- m_DB.writeWord(con::SettChatSessionMinDur , m_ChatSessionMinDur);
+ m_DB.writeWord(con::SettChatSessionMinDur, m_ChatSessionMinDur);
m_DB.writeWord(con::SettChatSessionTimeout, m_ChatSessionTimeout);
- m_DB.writeWord(con::SettAverageMinTime , m_AverageMinTime);
- m_DB.writeStr (con::SettWordDelimiters , m_WordDelimiters.c_str());
+ m_DB.writeWord(con::SettAverageMinTime, m_AverageMinTime);
+ m_DB.writeStr(con::SettWordDelimiters, m_WordDelimiters.c_str());
settingsTree.clear();
settingsTree.writeInt(con::KeyNum, m_ProtosIgnore.size());
@@ -309,15 +305,15 @@ void SettingsSerializer::writeToDB()
m_DB.writeTree(con::SettProtosIgnore, settingsTree);
- m_DB.writeWord(con::SettIgnoreOld , m_IgnoreOld);
- m_DB.writeStr (con::SettIgnoreBefore , m_IgnoreBefore.c_str());
- m_DB.writeStr (con::SettIgnoreAfter , m_IgnoreAfter.c_str());
- m_DB.writeBool(con::SettFilterRawRTF , m_FilterRawRTF);
- m_DB.writeBool(con::SettFilterBBCodes , m_FilterBBCodes);
- m_DB.writeByte(con::SettMetaContactsMode , m_MetaContactsMode);
- m_DB.writeBool(con::SettMergeContacts , m_MergeContacts);
+ m_DB.writeWord(con::SettIgnoreOld, m_IgnoreOld);
+ m_DB.writeStr(con::SettIgnoreBefore, m_IgnoreBefore.c_str());
+ m_DB.writeStr(con::SettIgnoreAfter, m_IgnoreAfter.c_str());
+ m_DB.writeBool(con::SettFilterRawRTF, m_FilterRawRTF);
+ m_DB.writeBool(con::SettFilterBBCodes, m_FilterBBCodes);
+ m_DB.writeByte(con::SettMetaContactsMode, m_MetaContactsMode);
+ m_DB.writeBool(con::SettMergeContacts, m_MergeContacts);
m_DB.writeBool(con::SettMergeContactsGroups, m_MergeContactsGroups);
- m_DB.writeByte(con::SettMergeMode , m_MergeMode);
+ m_DB.writeByte(con::SettMergeMode, m_MergeMode);
// -- column settings --
@@ -347,27 +343,27 @@ void SettingsSerializer::writeToDB()
// -- output settings --
- m_DB.writeBool (con::SettRemoveEmptyContacts , m_RemoveEmptyContacts);
- m_DB.writeBool (con::SettRemoveOutChatsZero , m_RemoveOutChatsZero);
- m_DB.writeBool (con::SettRemoveOutBytesZero , m_RemoveOutBytesZero);
- m_DB.writeBool (con::SettRemoveInChatsZero , m_RemoveInChatsZero);
- m_DB.writeBool (con::SettRemoveInBytesZero , m_RemoveInBytesZero);
- m_DB.writeBool (con::SettOmitContacts , m_OmitContacts);
- m_DB.writeBool (con::SettOmitByValue , m_OmitByValue);
- m_DB.writeByte (con::SettOmitByValueData , m_OmitByValueData);
- m_DB.writeDWord(con::SettOmitByValueLimit , m_OmitByValueLimit);
- m_DB.writeBool (con::SettOmitByTime , m_OmitByTime);
- m_DB.writeWord (con::SettOmitByTimeDays , m_OmitByTimeDays);
- m_DB.writeBool (con::SettOmitByRank , m_OmitByRank);
- m_DB.writeWord (con::SettOmitNumOnTop , m_OmitNumOnTop);
- m_DB.writeBool (con::SettOmittedInTotals , m_OmittedInTotals);
- m_DB.writeBool (con::SettOmittedInExtraRow , m_OmittedInExtraRow);
- m_DB.writeBool (con::SettCalcTotals , m_CalcTotals);
- m_DB.writeBool (con::SettTableHeader , m_TableHeader);
- m_DB.writeWord (con::SettTableHeaderRepeat , m_TableHeaderRepeat);
- m_DB.writeBool (con::SettTableHeaderVerbose , m_TableHeaderVerbose);
- m_DB.writeBool (con::SettHeaderTooltips , m_HeaderTooltips);
- m_DB.writeBool (con::SettHeaderTooltipsIfCustom, m_HeaderTooltipsIfCustom);
+ m_DB.writeBool(con::SettRemoveEmptyContacts, m_RemoveEmptyContacts);
+ m_DB.writeBool(con::SettRemoveOutChatsZero, m_RemoveOutChatsZero);
+ m_DB.writeBool(con::SettRemoveOutBytesZero, m_RemoveOutBytesZero);
+ m_DB.writeBool(con::SettRemoveInChatsZero, m_RemoveInChatsZero);
+ m_DB.writeBool(con::SettRemoveInBytesZero, m_RemoveInBytesZero);
+ m_DB.writeBool(con::SettOmitContacts, m_OmitContacts);
+ m_DB.writeBool(con::SettOmitByValue, m_OmitByValue);
+ m_DB.writeByte(con::SettOmitByValueData, m_OmitByValueData);
+ m_DB.writeDWord(con::SettOmitByValueLimit, m_OmitByValueLimit);
+ m_DB.writeBool(con::SettOmitByTime, m_OmitByTime);
+ m_DB.writeWord(con::SettOmitByTimeDays, m_OmitByTimeDays);
+ m_DB.writeBool(con::SettOmitByRank, m_OmitByRank);
+ m_DB.writeWord(con::SettOmitNumOnTop, m_OmitNumOnTop);
+ m_DB.writeBool(con::SettOmittedInTotals, m_OmittedInTotals);
+ m_DB.writeBool(con::SettOmittedInExtraRow, m_OmittedInExtraRow);
+ m_DB.writeBool(con::SettCalcTotals, m_CalcTotals);
+ m_DB.writeBool(con::SettTableHeader, m_TableHeader);
+ m_DB.writeWord(con::SettTableHeaderRepeat, m_TableHeaderRepeat);
+ m_DB.writeBool(con::SettTableHeaderVerbose, m_TableHeaderVerbose);
+ m_DB.writeBool(con::SettHeaderTooltips, m_HeaderTooltips);
+ m_DB.writeBool(con::SettHeaderTooltipsIfCustom, m_HeaderTooltipsIfCustom);
settingsTree.clear();
@@ -379,15 +375,15 @@ void SettingsSerializer::writeToDB()
settingsTree.writeBool(con::KeyAsc, m_Sort[i].asc);
}
- m_DB.writeStr (con::SettNickname , m_OwnNick.c_str());
- m_DB.writeBool(con::SettOutputVariables , m_OutputVariables);
- m_DB.writeStr (con::SettOutput , m_OutputFile.c_str());
+ m_DB.writeStr(con::SettNickname, m_OwnNick.c_str());
+ m_DB.writeBool(con::SettOutputVariables, m_OutputVariables);
+ m_DB.writeStr(con::SettOutput, m_OutputFile.c_str());
m_DB.writeBool(con::SettOutputExtraToFolder, m_OutputExtraToFolder);
- m_DB.writeStr (con::SettOutputExtraFolder , m_OutputExtraFolder.c_str());
- m_DB.writeBool(con::SettOverwriteAlways , m_OverwriteAlways);
- m_DB.writeBool(con::SettAutoOpenOptions , m_AutoOpenOptions);
- m_DB.writeBool(con::SettAutoOpenStartup , m_AutoOpenStartup);
- m_DB.writeBool(con::SettAutoOpenMenu , m_AutoOpenMenu);
+ m_DB.writeStr(con::SettOutputExtraFolder, m_OutputExtraFolder.c_str());
+ m_DB.writeBool(con::SettOverwriteAlways, m_OverwriteAlways);
+ m_DB.writeBool(con::SettAutoOpenOptions, m_AutoOpenOptions);
+ m_DB.writeBool(con::SettAutoOpenStartup, m_AutoOpenStartup);
+ m_DB.writeBool(con::SettAutoOpenMenu, m_AutoOpenMenu);
m_DB.writeTree(con::SettSort, settingsTree);
@@ -410,8 +406,7 @@ void SettingsSerializer::writeToDB()
settingsTree.writeInt(con::KeyMode, i->getMode());
settingsTree.writeInt(con::KeyNumWords, i->getWords().size());
- if (!i->getWords().empty())
- {
+ if (!i->getWords().empty()) {
// write filter words
strPrefix += con::SuffixWords;
settingsTree.setKey(strPrefix.c_str());
@@ -486,10 +481,10 @@ void SettingsSerializer::setShowSupportInfo(bool bShow)
ext::string SettingsSerializer::getLastStatisticsFile()
{
- return m_DB.readStr(con::SettLastStatisticsFile, muT(""));
+ return m_DB.readStr(con::SettLastStatisticsFile, _T(""));
}
-void SettingsSerializer::setLastStatisticsFile(const mu_text* szFileName)
+void SettingsSerializer::setLastStatisticsFile(const TCHAR* szFileName)
{
m_DB.writeStr(con::SettLastStatisticsFile, szFileName);
}
@@ -506,7 +501,5 @@ void SettingsSerializer::showStatistics()
ext::string strFileName = getLastStatisticsFile();
if (!strFileName.empty() && utils::fileExists(strFileName))
- {
openURL(strFileName.c_str());
- }
}
diff --git a/plugins/HistoryStats/src/settingsserializer.h b/plugins/HistoryStats/src/settingsserializer.h
index 1840757f54..c5477bc96f 100644
--- a/plugins/HistoryStats/src/settingsserializer.h
+++ b/plugins/HistoryStats/src/settingsserializer.h
@@ -15,7 +15,7 @@ private:
MirandaSettings m_DB;
public:
- explicit SettingsSerializer(const mu_ansi* module);
+ explicit SettingsSerializer(const char* module);
void readFromDB();
void writeToDB();
@@ -33,7 +33,7 @@ public:
void setShowSupportInfo(bool bShow);
ext::string getLastStatisticsFile();
- void setLastStatisticsFile(const mu_text* szFileName);
+ void setLastStatisticsFile(const TCHAR* szFileName);
bool canShowStatistics();
void showStatistics();
};
diff --git a/plugins/HistoryStats/src/settingstree.cpp b/plugins/HistoryStats/src/settingstree.cpp
index 6d4159d96f..30d5df7e20 100644
--- a/plugins/HistoryStats/src/settingstree.cpp
+++ b/plugins/HistoryStats/src/settingstree.cpp
@@ -9,13 +9,13 @@ void SettingsTree::makeKeyValid()
m_pCurValues = &m_Keys[m_CurKey];
}
-SettingsTree::SettingsTree()
- : m_pCurValues(NULL)
+SettingsTree::SettingsTree() :
+ m_pCurValues(NULL)
{
}
-SettingsTree::SettingsTree(const ext::string& config)
- : m_pCurValues(NULL)
+SettingsTree::SettingsTree(const ext::string& config) :
+ m_pCurValues(NULL)
{
fromString(config);
}
@@ -23,7 +23,7 @@ SettingsTree::SettingsTree(const ext::string& config)
void SettingsTree::clear()
{
m_Keys.clear();
- setKey(muT(""));
+ setKey(_T(""));
}
void SettingsTree::fromString(const ext::string& config)
@@ -33,10 +33,8 @@ void SettingsTree::fromString(const ext::string& config)
ext::string::size_type i = 0;
ext::string curKey;
- while (i < config.length())
- {
- if (config[i] == muC('{'))
- {
+ while (i < config.length()) {
+ if (config[i] == '{') {
++i;
ValueMap& vals = m_Keys[curKey];
@@ -44,54 +42,44 @@ void SettingsTree::fromString(const ext::string& config)
ext::string curSetting;
ext::string curVal;
- while (i < config.length() && config[i] != muC('}'))
- {
- if (config[i] == muC(':'))
- {
+ while (i < config.length() && config[i] != '}') {
+ if (config[i] == ':') {
curSetting = curVal;
- curVal = muT("");
+ curVal = _T("");
}
- else if (config[i] == muC(';'))
- {
+ else if (config[i] == ';') {
vals[curSetting] = curVal;
- curSetting = muT("");
- curVal = muT("");
+ curSetting = _T("");
+ curVal = _T("");
}
- else if (config[i] == muC('\\'))
- {
+ else if (config[i] == '\\') {
++i;
curVal += config[i];
}
- else
- {
- curVal += config[i];
- }
+ else curVal += config[i];
++i;
}
- curKey = muT("");
- }
- else
- {
- curKey += config[i];
+ curKey = _T("");
}
+ else curKey += config[i];
++i;
}
- setKey(muT(""));
+ setKey(_T(""));
}
ext::string SettingsTree::toString() const
{
- static const mu_text* replaces[5][2] = {
- { muT("\\"), muT("\\\\") },
- { muT("{") , muT("\\{") },
- { muT("}") , muT("\\}") },
- { muT(":") , muT("\\:") },
- { muT(";") , muT("\\;") }
+ static const TCHAR* replaces[5][2] = {
+ { _T("\\"), _T("\\\\") },
+ { _T("{"), _T("\\{") },
+ { _T("}"), _T("\\}") },
+ { _T(":"), _T("\\:") },
+ { _T(";"), _T("\\;") }
};
ext::string data;
@@ -101,14 +89,14 @@ ext::string SettingsTree::toString() const
const ValueMap& vals = i->second;
data += i->first;
- data += muT("{");
+ data += _T("{");
citer_each_(ValueMap, j, vals)
{
data += j->first;
- data += muT(":");
+ data += _T(":");
- ext::string tempSecond = j->second;
+ ext::string tempSecond = j->second;
array_each_(k, replaces)
{
@@ -116,138 +104,114 @@ ext::string SettingsTree::toString() const
}
data += tempSecond;
- data += muT(";");
+ data += _T(";");
}
- data += muT("}");
+ data += _T("}");
}
return data;
}
-void SettingsTree::setKey(const mu_text* key)
+void SettingsTree::setKey(const TCHAR* key)
{
m_CurKey = key;
KeyMap::iterator i = m_Keys.find(key);
if (i != m_Keys.end())
- {
m_pCurValues = &i->second;
- }
else
- {
m_pCurValues = NULL;
- }
}
-bool SettingsTree::readBool(const mu_text* setting, bool errorValue) const
+bool SettingsTree::readBool(const TCHAR* setting, bool errorValue) const
{
- if (m_pCurValues)
- {
+ if (m_pCurValues) {
ValueMap::iterator i = m_pCurValues->find(setting);
- if (i != m_pCurValues->end())
- {
- return (i->second == muT("y"));
+ if (i != m_pCurValues->end()) {
+ return (i->second == _T("y"));
}
}
return errorValue;
}
-int SettingsTree::readInt(const mu_text* setting, int errorValue) const
+int SettingsTree::readInt(const TCHAR* setting, int errorValue) const
{
- if (m_pCurValues)
- {
+ if (m_pCurValues) {
ValueMap::iterator i = m_pCurValues->find(setting);
if (i != m_pCurValues->end())
- {
return _ttoi(i->second.c_str());
- }
}
return errorValue;
}
-int SettingsTree::readIntRanged(const mu_text* setting, int errorValue, int minValue, int maxValue) const
+int SettingsTree::readIntRanged(const TCHAR* setting, int errorValue, int minValue, int maxValue) const
{
int value = readInt(setting, errorValue);
-
if (minValue <= value && value <= maxValue)
- {
return value;
- }
- else
- {
- return errorValue;
- }
+
+ return errorValue;
}
-ext::string SettingsTree::readStr(const mu_text* setting, const mu_text* errorValue) const
+ext::string SettingsTree::readStr(const TCHAR* setting, const TCHAR* errorValue) const
{
- if (m_pCurValues)
- {
+ if (m_pCurValues) {
ValueMap::iterator i = m_pCurValues->find(setting);
if (i != m_pCurValues->end())
- {
return i->second;
- }
}
return errorValue;
}
-void SettingsTree::writeBool(const mu_text* setting, bool value)
+void SettingsTree::writeBool(const TCHAR* setting, bool value)
{
makeKeyValid();
- (*m_pCurValues)[setting] = value ? muT("y") : muT("n");
+ (*m_pCurValues)[setting] = value ? _T("y") : _T("n");
}
-void SettingsTree::writeInt(const mu_text* setting, int value)
+void SettingsTree::writeInt(const TCHAR* setting, int value)
{
makeKeyValid();
(*m_pCurValues)[setting] = utils::intToString(value);
}
-void SettingsTree::writeStr(const mu_text* setting, const mu_text* value)
+void SettingsTree::writeStr(const TCHAR* setting, const TCHAR* value)
{
makeKeyValid();
(*m_pCurValues)[setting] = value;
}
-bool SettingsTree::hasSetting(const mu_text* setting) const
+bool SettingsTree::hasSetting(const TCHAR* setting) const
{
- if (m_pCurValues)
- {
+ if (m_pCurValues) {
ValueMap::const_iterator i = m_pCurValues->find(setting);
-
if (i != m_pCurValues->end())
- {
return true;
- }
}
return false;
}
-bool SettingsTree::delSetting(const mu_text* setting)
+bool SettingsTree::delSetting(const TCHAR* setting)
{
- if (m_pCurValues)
- {
+ if (m_pCurValues) {
ValueMap::iterator i = m_pCurValues->find(setting);
- if (i != m_pCurValues->end())
- {
+ if (i != m_pCurValues->end()) {
m_pCurValues->erase(i);
-
- if (m_pCurValues->size() == 0)
- {
+
+ if (m_pCurValues->size() == 0) {
m_Keys.erase(m_CurKey);
m_pCurValues = NULL;
}
diff --git a/plugins/HistoryStats/src/settingstree.h b/plugins/HistoryStats/src/settingstree.h
index 5f7bc4b07f..e70198e7ce 100644
--- a/plugins/HistoryStats/src/settingstree.h
+++ b/plugins/HistoryStats/src/settingstree.h
@@ -30,20 +30,20 @@ public:
void fromString(const ext::string& config);
ext::string toString() const;
- void setKey(const mu_text* key);
+ void setKey(const TCHAR* key);
const ext::string& getKey() const { return m_CurKey; }
- bool readBool(const mu_text* setting, bool errorValue) const;
- int readInt(const mu_text* setting, int errorValue) const;
- int readIntRanged(const mu_text* setting, int errorValue, int minValue, int maxValue) const;
- ext::string readStr(const mu_text* setting, const mu_text* errorValue) const;
+ bool readBool(const TCHAR* setting, bool errorValue) const;
+ int readInt(const TCHAR* setting, int errorValue) const;
+ int readIntRanged(const TCHAR* setting, int errorValue, int minValue, int maxValue) const;
+ ext::string readStr(const TCHAR* setting, const TCHAR* errorValue) const;
- void writeBool(const mu_text* setting, bool value);
- void writeInt(const mu_text* setting, int value);
- void writeStr(const mu_text* setting, const mu_text* value);
+ void writeBool(const TCHAR* setting, bool value);
+ void writeInt(const TCHAR* setting, int value);
+ void writeStr(const TCHAR* setting, const TCHAR* value);
- bool hasSetting(const mu_text* setting) const;
- bool delSetting(const mu_text* setting);
+ bool hasSetting(const TCHAR* setting) const;
+ bool delSetting(const TCHAR* setting);
};
#endif // HISTORYSTATS_GUARD_SETTINGSTREE_H \ No newline at end of file
diff --git a/plugins/HistoryStats/src/statistic.cpp b/plugins/HistoryStats/src/statistic.cpp
index ca93c8c9fa..0a8e8b4a35 100644
--- a/plugins/HistoryStats/src/statistic.cpp
+++ b/plugins/HistoryStats/src/statistic.cpp
@@ -31,13 +31,11 @@ void Statistic::prepareColumns()
{
Column* pCol = m_Settings.getCol(i);
- if (pCol->isEnabled())
- {
+ if (pCol->isEnabled()) {
int restrictions = pCol->configGetRestrictions(NULL);
// MEMO: checks for columns having no HTML-only support
- if (!bOutputPNG && !(restrictions & Column::crHTMLMask))
- {
+ if (!bOutputPNG && !(restrictions & Column::crHTMLMask)) {
continue;
}
@@ -45,14 +43,12 @@ void Statistic::prepareColumns()
pCol->setHelpers(this, &m_Settings, &m_CharMapper);
- if (pCol->getFeatures() & Column::cfAcquiresData)
- {
+ if (pCol->getFeatures() & Column::cfAcquiresData) {
ext::string dataGUID = pCol->contactDataGetUID();
std::map<ext::string, int>::iterator g2s = dataGUIDToSlot.find(dataGUID);
- if (g2s == dataGUIDToSlot.end())
- {
+ if (g2s == dataGUIDToSlot.end()) {
dataGUIDToSlot[dataGUID] = m_nNextSlot;
m_nNextSlot++;
@@ -61,8 +57,7 @@ void Statistic::prepareColumns()
pCol->contactDataSlotAssign(dataGUIDToSlot[dataGUID]);
- if (pCol->getFeatures() & Column::cfTransformsData)
- {
+ if (pCol->getFeatures() & Column::cfTransformsData) {
m_TransformCols.push_back(pCol);
pCol->contactDataTransformSlotAssign(m_nNextSlot++);
@@ -113,7 +108,7 @@ Contact& Statistic::addContact(const ext::string& nick, const ext::string& proto
{
Contact* pContact = new Contact(this, m_nNextSlot, nick, protoDisplayName, groupName, 1, nSources);
prepareContactData(*pContact);
-
+
m_Contacts.push_back(pContact);
return *pContact;
@@ -128,8 +123,7 @@ const Contact& Statistic::getContact(int index) const
DWORD Statistic::getFirstTime()
{
- if (!m_bHistoryTimeAvailable)
- {
+ if (!m_bHistoryTimeAvailable) {
// put _all_ available contacts (including omitted/total) in one list
ContactListC l;
@@ -138,41 +132,34 @@ DWORD Statistic::getFirstTime()
l.push_back(&getContact(i));
}
- if (hasOmitted())
- {
+ if (hasOmitted()) {
l.push_back(&getOmitted());
}
- if (hasTotals())
- {
+ if (hasTotals()) {
l.push_back(&getTotals());
}
- if (l.size() > 0)
- {
+ if (l.size() > 0) {
DWORD nFirstTime = con::MaxDateTime, nLastTime = con::MinDateTime;
citer_each_(Statistic::ContactListC, c, l)
{
- if ((*c)->isFirstLastTimeValid())
- {
+ if ((*c)->isFirstLastTimeValid()) {
nFirstTime = min(nFirstTime, (*c)->getFirstTime());
nLastTime = max(nLastTime, (*c)->getLastTime());
}
}
- if (nFirstTime == con::MaxDateTime && nLastTime == con::MinDateTime)
- {
+ if (nFirstTime == con::MaxDateTime && nLastTime == con::MinDateTime) {
m_nFirstTime = m_nLastTime = 0;
}
- else
- {
+ else {
m_nFirstTime = nFirstTime;
m_nLastTime = nLastTime;
}
}
- else
- {
+ else {
m_nFirstTime = m_nLastTime = 0;
}
@@ -185,8 +172,7 @@ DWORD Statistic::getFirstTime()
DWORD Statistic::getLastTime()
{
- if (!m_bHistoryTimeAvailable)
- {
+ if (!m_bHistoryTimeAvailable) {
// trigger calculation
getFirstTime();
}
@@ -196,8 +182,7 @@ DWORD Statistic::getLastTime()
DWORD Statistic::getHistoryTime()
{
- if (!m_bHistoryTimeAvailable)
- {
+ if (!m_bHistoryTimeAvailable) {
// trigger calculation
getFirstTime();
}
@@ -207,14 +192,12 @@ DWORD Statistic::getHistoryTime()
ext::string Statistic::createFile(const ext::string& desiredName)
{
- if (!m_Settings.m_OverwriteAlways && utils::fileExists(desiredName))
- {
- mu_text tempBuf[MAX_PATH];
+ if (!m_Settings.m_OverwriteAlways && utils::fileExists(desiredName)) {
+ TCHAR tempBuf[MAX_PATH];
- UINT nUnique = GetTempFileName(m_TempPath.c_str(), muT("his"), 0, tempBuf);
+ UINT nUnique = GetTempFileName(m_TempPath.c_str(), _T("his"), 0, tempBuf);
- if (nUnique == 0)
- {
+ if (nUnique == 0) {
abort();
}
@@ -227,19 +210,17 @@ ext::string Statistic::createFile(const ext::string& desiredName)
ext::string desiredPath = utils::extractPath(desiredName);
- if (!utils::pathExists(desiredPath))
- {
- if (!utils::createPath(desiredPath))
- {
- m_ErrorText = ext::str(ext::kformat(i18n(muT("HistoryStats couldn't create a required folder (#{folder}).\r\n\r\nPlease check the output filename and additional output folder you have chosen for correctness. Additionally, please check whether the file, folder, and/or disk is writable.")))
- % muT("#{folder}") * desiredPath);
+ if (!utils::pathExists(desiredPath)) {
+ if (!utils::createPath(desiredPath)) {
+ m_ErrorText = ext::str(ext::kformat(TranslateT("HistoryStats couldn't create a required folder (#{folder}).\r\n\r\nPlease check the output filename and additional output folder you have chosen for correctness. Additionally, please check whether the file, folder, and/or disk is writable."))
+ % _T("#{folder}") * desiredPath);
}
}
return desiredName;
}
-bool Statistic::newFile(const mu_text* fileExt, ext::string& writeFile, ext::string& finalURL)
+bool Statistic::newFile(const TCHAR* fileExt, ext::string& writeFile, ext::string& finalURL)
{
++m_nLastFileNr;
@@ -247,7 +228,7 @@ bool Statistic::newFile(const mu_text* fileExt, ext::string& writeFile, ext::str
writeFile = createFile(m_OutputPath + finalURL);
// convert relative filename to relative URL
- utils::replaceAllInPlace(finalURL, muT("\\"), muT("/"));
+ utils::replaceAllInPlace(finalURL, _T("\\"), _T("/"));
return true;
}
@@ -256,31 +237,26 @@ bool Statistic::newFilePNG(Canvas& canvas, ext::string& finalURL)
{
Canvas::Digest digest;
- if (!canvas.getDigest(digest))
- {
+ if (!canvas.getDigest(digest)) {
return false;
}
ImageMap::const_iterator i = m_Images.find(digest);
- if (i == m_Images.end())
- {
+ if (i == m_Images.end()) {
ext::string writeFile;
- if (newFilePNG(writeFile, finalURL))
- {
+ if (newFilePNG(writeFile, finalURL)) {
canvas.writePNG(writeFile.c_str());
m_Images.insert(std::make_pair(digest, finalURL));
return true;
}
- else
- {
+ else {
return false;
}
}
- else
- {
+ else {
finalURL = i->second;
return true;
@@ -299,8 +275,7 @@ void Statistic::handleAddMessage(Contact& contact, Message& msg)
void Statistic::handleAddChat(Contact& contact, bool bOutgoing, DWORD localTimestampStarted, DWORD duration)
{
- if (duration >= m_Settings.m_ChatSessionMinDur)
- {
+ if (duration >= m_Settings.m_ChatSessionMinDur) {
contact.addChat(bOutgoing, localTimestampStarted, duration);
iter_each_(std::vector<Column*>, i, m_AcquireCols)
@@ -314,24 +289,22 @@ INT_PTR CALLBACK Statistic::staticProgressProc(HWND hDlg, UINT msg, WPARAM wPara
{
Statistic* pStats = reinterpret_cast<Statistic*>(GetWindowLong(hDlg, GWLP_USERDATA));
- switch (msg)
- {
- case WM_INITDIALOG:
- TranslateDialogDefault(hDlg);
- SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
- return TRUE;
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hDlg);
+ SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
+ return TRUE;
- case WM_DESTROY:
- PostQuitMessage(0);
- return TRUE;
+ case WM_DESTROY:
+ PostQuitMessage(0);
+ return TRUE;
- case WM_COMMAND:
- if (LOWORD(wParam) == IDOK)
- {
- EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE);
- SetEvent(pStats->m_hCancelEvent);
- }
- return TRUE;
+ case WM_COMMAND:
+ if (LOWORD(wParam) == IDOK) {
+ EnableWindow(GetDlgItem(hDlg, IDCANCEL), FALSE);
+ SetEvent(pStats->m_hCancelEvent);
+ }
+ return TRUE;
}
return FALSE;
@@ -339,15 +312,14 @@ INT_PTR CALLBACK Statistic::staticProgressProc(HWND hDlg, UINT msg, WPARAM wPara
void Statistic::setProgressMax(bool bSub, int max)
{
- SendDlgItemMessage(m_hWndProgress, bSub ? IDC_SUBBAR : IDC_MAINBAR, PBM_SETPOS, (WPARAM) 0, (LPARAM) 0);
- SendDlgItemMessage(m_hWndProgress, bSub ? IDC_SUBBAR : IDC_MAINBAR, PBM_SETRANGE, (WPARAM) 0, (LPARAM) MAKELPARAM(0, max));
+ SendDlgItemMessage(m_hWndProgress, bSub ? IDC_SUBBAR : IDC_MAINBAR, PBM_SETPOS, (WPARAM)0, (LPARAM)0);
+ SendDlgItemMessage(m_hWndProgress, bSub ? IDC_SUBBAR : IDC_MAINBAR, PBM_SETRANGE, (WPARAM)0, (LPARAM)MAKELPARAM(0, max));
- SetDlgItemText(m_hWndProgress, bSub ? IDC_SUBPERCENT : IDC_MAINPERCENT, (max > 0) ? muT("0%") : muT(""));
+ SetDlgItemText(m_hWndProgress, bSub ? IDC_SUBPERCENT : IDC_MAINPERCENT, (max > 0) ? _T("0%") : _T(""));
- if (!bSub)
- {
+ if (!bSub) {
setProgressMax(true, 0);
- setProgressLabel(true, muT(""));
+ setProgressLabel(true, _T(""));
}
}
@@ -355,38 +327,35 @@ void Statistic::setProgressLabel(bool bSub, const ext::string& label)
{
SetDlgItemText(m_hWndProgress, bSub ? IDC_SUBTEXT : IDC_MAINTEXT, label.c_str());
- if (!bSub)
- {
+ if (!bSub) {
setProgressMax(true, 0);
- setProgressLabel(true, muT(""));
+ setProgressLabel(true, _T(""));
}
}
void Statistic::stepProgress(bool bSub, int step /* = 1 */)
{
- int pos = SendDlgItemMessage(m_hWndProgress, bSub ? IDC_SUBBAR : IDC_MAINBAR, PBM_GETPOS, (WPARAM) 0, (LPARAM) 0);
- int max = SendDlgItemMessage(m_hWndProgress, bSub ? IDC_SUBBAR : IDC_MAINBAR, PBM_GETRANGE, (WPARAM) FALSE, (LPARAM) NULL);
+ int pos = SendDlgItemMessage(m_hWndProgress, bSub ? IDC_SUBBAR : IDC_MAINBAR, PBM_GETPOS, (WPARAM)0, (LPARAM)0);
+ int max = SendDlgItemMessage(m_hWndProgress, bSub ? IDC_SUBBAR : IDC_MAINBAR, PBM_GETRANGE, (WPARAM)FALSE, (LPARAM)NULL);
pos += step;
- SendDlgItemMessage(m_hWndProgress, bSub ? IDC_SUBBAR : IDC_MAINBAR, PBM_SETPOS, (WPARAM) pos, (LPARAM) 0);
+ SendDlgItemMessage(m_hWndProgress, bSub ? IDC_SUBBAR : IDC_MAINBAR, PBM_SETPOS, (WPARAM)pos, (LPARAM)0);
SetDlgItemText(m_hWndProgress, bSub ? IDC_SUBPERCENT : IDC_MAINPERCENT, utils::ratioToPercent(pos, max).c_str());
- if (!bSub)
- {
+ if (!bSub) {
setProgressMax(true, 0);
- setProgressLabel(true, muT(""));
+ setProgressLabel(true, _T(""));
}
}
bool Statistic::stepInit()
{
// file management
- mu_text tempPath[MAX_PATH];
+ TCHAR tempPath[MAX_PATH];
int nRes = GetTempPath(MAX_PATH, tempPath);
- if (nRes > 0)
- {
+ if (nRes > 0) {
m_TempPath.assign(tempPath, nRes);
}
@@ -401,25 +370,20 @@ bool Statistic::stepInit()
m_TimeMin = 0;
m_TimeMax = 0xFFFFFFFF;
- if (m_Settings.m_IgnoreOld != 0)
- {
+ if (m_Settings.m_IgnoreOld != 0) {
m_TimeMin = getTimeStarted() - 86400 * m_Settings.m_IgnoreOld;
}
- if (m_Settings.getIgnoreBefore() != 0)
- {
- if (m_Settings.m_IgnoreOld != 0)
- {
+ if (m_Settings.getIgnoreBefore() != 0) {
+ if (m_Settings.m_IgnoreOld != 0) {
m_TimeMin = max(m_TimeMin, m_Settings.getIgnoreBefore());
}
- else
- {
+ else {
m_TimeMin = m_Settings.getIgnoreBefore();
}
}
- if (m_Settings.getIgnoreAfter() != 0)
- {
+ if (m_Settings.getIgnoreAfter() != 0) {
m_TimeMax = m_Settings.getIgnoreAfter() + 86399;
}
@@ -428,8 +392,7 @@ bool Statistic::stepInit()
bool Statistic::stepReadDB()
{
- if (shouldTerminate())
- {
+ if (shouldTerminate()) {
return false;
}
@@ -462,61 +425,51 @@ bool Statistic::stepReadDB()
Message curMsg(m_Settings.m_FilterRawRTF && RTFFilter::available(), m_Settings.m_FilterBBCodes);
// iterate through all events
- while (hisContact.hasNext())
- {
+ while (hisContact.hasNext()) {
const DBEVENTINFO& dbei = hisContact.getNext();
bool bOutgoing = bool_(dbei.flags & DBEF_SENT);
// only messages, no URLs, files or anything else
// filter logged status messages from tabSRMM
- if (dbei.eventType == etMessage)
- {
+ if (dbei.eventType == etMessage) {
// convert to local time (everything in this plugin is done in local time)
DWORD localTimestamp = utils::toLocalTime(dbei.timestamp);
- if (localTimestamp >= m_TimeMin && localTimestamp <= m_TimeMax)
- {
- if (dbei.flags & DBEF_UTF)
- {
- mu_ansi* pUTF8Text = reinterpret_cast<mu_ansi*>(dbei.pBlob);
+ if (localTimestamp >= m_TimeMin && localTimestamp <= m_TimeMax) {
+ if (dbei.flags & DBEF_UTF) {
+ char* pUTF8Text = reinterpret_cast<char*>(dbei.pBlob);
int nUTF8Len = utils::getUTF8Len(pUTF8Text);
curMsg.assignTextFromUTF8(pUTF8Text, nUTF8Len);
}
- else
- {
- mu_ansi* pAnsiText = reinterpret_cast<mu_ansi*>(dbei.pBlob);
+ else {
+ char* pAnsiText = reinterpret_cast<char*>(dbei.pBlob);
int nAnsiLenP1 = ext::a::strfunc::len(pAnsiText) + 1;
-#if defined(MU_WIDE)
- mu_wide* pWideText = reinterpret_cast<mu_wide*>(pAnsiText + nAnsiLenP1);
+#if defined(_UNICODE)
+ WCHAR* pWideText = reinterpret_cast<WCHAR*>(pAnsiText + nAnsiLenP1);
int nWideLen = 0;
- int nWideMaxLen = (dbei.cbBlob - nAnsiLenP1) / sizeof(mu_wide);
-
- if (dbei.cbBlob >= nAnsiLenP1 * 3)
- {
- for (int i = 0; i < nWideMaxLen; ++i)
- {
- if (!pWideText[i])
- {
+ int nWideMaxLen = (dbei.cbBlob - nAnsiLenP1) / sizeof(WCHAR);
+
+ if (dbei.cbBlob >= nAnsiLenP1 * 3) {
+ for (int i = 0; i < nWideMaxLen; ++i) {
+ if (!pWideText[i]) {
nWideLen = i;
break;
}
}
}
- if (nWideLen > 0 && nWideLen < nAnsiLenP1)
- {
+ if (nWideLen > 0 && nWideLen < nAnsiLenP1) {
curMsg.assignText(pWideText, nWideLen);
}
- else
- {
+ else {
curMsg.assignText(pAnsiText, nAnsiLenP1 - 1);
}
-#else // MU_WIDE
+#else // _UNICODE
curMsg.assignText(pAnsiText, nAnsiLenP1 - 1);
-#endif // MU_WIDE
+#endif // _UNICODE
}
curMsg.assignInfo(bOutgoing, localTimestamp);
@@ -525,11 +478,9 @@ bool Statistic::stepReadDB()
handleAddMessage(curContact, curMsg);
// handle chats
- if (localTimestamp - lastAddedTime >= (DWORD) m_Settings.m_ChatSessionTimeout || lastAddedTime == 0)
- {
+ if (localTimestamp - lastAddedTime >= (DWORD)m_Settings.m_ChatSessionTimeout || lastAddedTime == 0) {
// new chat started
- if (chatStartTime != 0)
- {
+ if (chatStartTime != 0) {
handleAddChat(curContact, bChatOutgoing, chatStartTime, lastAddedTime - chatStartTime);
}
@@ -542,8 +493,7 @@ bool Statistic::stepReadDB()
}
// non-message events
- if (dbei.eventType != etMessage)
- {
+ if (dbei.eventType != etMessage) {
curContact.addEvent(dbei.eventType, bOutgoing);
}
@@ -551,8 +501,7 @@ bool Statistic::stepReadDB()
}
// post processing for chat detection
- if (chatStartTime != 0)
- {
+ if (chatStartTime != 0) {
handleAddChat(curContact, bChatOutgoing, chatStartTime, lastAddedTime - chatStartTime);
}
@@ -562,8 +511,7 @@ bool Statistic::stepReadDB()
stepProgress(true);
- if (shouldTerminate())
- {
+ if (shouldTerminate()) {
return false;
}
}
@@ -578,13 +526,11 @@ bool Statistic::stepReadDB()
bool Statistic::stepRemoveContacts()
{
- if (!m_Settings.m_RemoveEmptyContacts && !m_Settings.m_RemoveOutChatsZero && !m_Settings.m_RemoveInChatsZero)
- {
+ if (!m_Settings.m_RemoveEmptyContacts && !m_Settings.m_RemoveOutChatsZero && !m_Settings.m_RemoveInChatsZero) {
return true;
}
- if (shouldTerminate())
- {
+ if (shouldTerminate()) {
return false;
}
@@ -592,24 +538,20 @@ bool Statistic::stepRemoveContacts()
{
bool bRemove = false;
Contact* pCur = m_Contacts[i];
-
- if (!bRemove && m_Settings.m_RemoveEmptyContacts)
- {
+
+ if (!bRemove && m_Settings.m_RemoveEmptyContacts) {
bRemove = (pCur->getTotalMessages() == 0);
}
- if (!bRemove && m_Settings.m_RemoveOutChatsZero)
- {
+ if (!bRemove && m_Settings.m_RemoveOutChatsZero) {
bRemove = (pCur->getOutChats() == 0 && (!m_Settings.m_RemoveOutBytesZero || pCur->getOutBytes() == 0));
}
-
- if (!bRemove && m_Settings.m_RemoveInChatsZero)
- {
+
+ if (!bRemove && m_Settings.m_RemoveInChatsZero) {
bRemove = (pCur->getInChats() == 0 && (!m_Settings.m_RemoveInBytesZero || pCur->getInBytes() == 0));
}
- if (bRemove)
- {
+ if (bRemove) {
freeContactData(*pCur);
delete pCur;
@@ -623,8 +565,7 @@ bool Statistic::stepRemoveContacts()
bool Statistic::stepSortContacts()
{
- if (shouldTerminate())
- {
+ if (shouldTerminate()) {
return false;
}
@@ -635,8 +576,7 @@ bool Statistic::stepSortContacts()
upto_each_(i, Settings::cNumSortLevels)
{
- if (m_Settings.m_Sort[i].by == Settings::skNothing)
- {
+ if (m_Settings.m_Sort[i].by == Settings::skNothing) {
cmpDepth = i;
break;
}
@@ -660,11 +600,11 @@ bool Statistic::stepSortContacts()
case Settings::skGroup:
pCmp = new ContactCompareStr(pPrev, &Contact::getGroup);
break;
-
+
case Settings::skBytesOut:
pCmp = new ContactCompare<int>(pPrev, &Contact::getOutBytes);
break;
-
+
case Settings::skBytesIn:
pCmp = new ContactCompare<int>(pPrev, &Contact::getInBytes);
break;
@@ -712,7 +652,7 @@ bool Statistic::stepSortContacts()
case Settings::skBytesOutAvg:
pCmp = new ContactCompare<double>(pPrev, &Contact::getOutBytesAvg);
break;
-
+
case Settings::skBytesInAvg:
pCmp = new ContactCompare<double>(pPrev, &Contact::getInBytesAvg);
break;
@@ -748,11 +688,11 @@ bool Statistic::stepSortContacts()
case Settings::skChatDurationMin:
pCmp = new ContactCompare<int>(pPrev, &Contact::getChatDurMinForSort);
break;
-
+
case Settings::skChatDurationAvg:
pCmp = new ContactCompare<int>(pPrev, &Contact::getChatDurAvgForSort);
break;
-
+
case Settings::skChatDurationMax:
pCmp = new ContactCompare<int>(pPrev, &Contact::getChatDurMaxForSort);
break;
@@ -780,7 +720,7 @@ bool Statistic::stepPreOmitContacts()
{
if (shouldTerminate())
return false;
-
+
iter_each_(std::vector<Column*>, i, m_ActiveCols)
{
(*i)->columnDataBeforeOmit();
@@ -797,37 +737,38 @@ bool Statistic::stepOmitContacts()
if (shouldTerminate())
return false;
- m_pOmitted = new Contact(this, m_nNextSlot, muT(""), muT(""), muT(""), 0, 0);
+ m_pOmitted = new Contact(this, m_nNextSlot, _T(""), _T(""), _T(""), 0, 0);
prepareContactData(*m_pOmitted);
// omit depending on some value
if (m_Settings.m_OmitByValue) {
- static const struct {
+ static const struct
+ {
int type; // 0 = int, 1 = double, 2 = DWORD
double factor; // factor to multiply function output with
int (Contact::*int_fn)() const;
double (Contact::*double_fn)() const;
- DWORD (Contact::*DWORD_fn)() const;
+ DWORD(Contact::*DWORD_fn)() const;
} valueMap[] = {
- { 0, 1.0, &Contact::getInBytes , 0 , 0 },
- { 0, 1.0, &Contact::getOutBytes , 0 , 0 },
- { 0, 1.0, &Contact::getTotalBytes , 0 , 0 },
- { 1, 604800.0, 0 , &Contact::getInBytesAvg , 0 },
- { 1, 604800.0, 0 , &Contact::getOutBytesAvg , 0 },
- { 1, 604800.0, 0 , &Contact::getTotalBytesAvg , 0 },
- { 0, 1.0, &Contact::getInMessages , 0 , 0 },
- { 0, 1.0, &Contact::getOutMessages , 0 , 0 },
- { 0, 1.0, &Contact::getTotalMessages, 0 , 0 },
- { 1, 604800.0, 0 , &Contact::getInMessagesAvg , 0 },
- { 1, 604800.0, 0 , &Contact::getOutMessagesAvg , 0 },
- { 1, 604800.0, 0 , &Contact::getTotalMessagesAvg, 0 },
- { 0, 1.0, &Contact::getInChats , 0 , 0 },
- { 0, 1.0, &Contact::getOutChats , 0 , 0 },
- { 0, 1.0, &Contact::getTotalChats , 0 , 0 },
- { 1, 604800.0, 0 , &Contact::getInChatsAvg , 0 },
- { 1, 604800.0, 0 , &Contact::getOutChatsAvg , 0 },
- { 1, 604800.0, 0 , &Contact::getTotalChatsAvg , 0 },
- { 2, 1/3600.0, 0 , 0 , &Contact::getChatDurSum },
+ { 0, 1.0, &Contact::getInBytes, 0, 0 },
+ { 0, 1.0, &Contact::getOutBytes, 0, 0 },
+ { 0, 1.0, &Contact::getTotalBytes, 0, 0 },
+ { 1, 604800.0, 0, &Contact::getInBytesAvg, 0 },
+ { 1, 604800.0, 0, &Contact::getOutBytesAvg, 0 },
+ { 1, 604800.0, 0, &Contact::getTotalBytesAvg, 0 },
+ { 0, 1.0, &Contact::getInMessages, 0, 0 },
+ { 0, 1.0, &Contact::getOutMessages, 0, 0 },
+ { 0, 1.0, &Contact::getTotalMessages, 0, 0 },
+ { 1, 604800.0, 0, &Contact::getInMessagesAvg, 0 },
+ { 1, 604800.0, 0, &Contact::getOutMessagesAvg, 0 },
+ { 1, 604800.0, 0, &Contact::getTotalMessagesAvg, 0 },
+ { 0, 1.0, &Contact::getInChats, 0, 0 },
+ { 0, 1.0, &Contact::getOutChats, 0, 0 },
+ { 0, 1.0, &Contact::getTotalChats, 0, 0 },
+ { 1, 604800.0, 0, &Contact::getInChatsAvg, 0 },
+ { 1, 604800.0, 0, &Contact::getOutChatsAvg, 0 },
+ { 1, 604800.0, 0, &Contact::getTotalChatsAvg, 0 },
+ { 2, 1 / 3600.0, 0, 0, &Contact::getChatDurSum },
};
int valueKey = m_Settings.m_OmitByValueData;
@@ -928,7 +869,7 @@ bool Statistic::stepCalcTotals()
if (shouldTerminate())
return false;
- m_pTotals = new Contact(this, m_nNextSlot, muT(""), muT(""), muT(""), 0, 0);
+ m_pTotals = new Contact(this, m_nNextSlot, _T(""), _T(""), _T(""), 0, 0);
prepareContactData(*m_pTotals);
setProgressMax(true, m_Contacts.size() + 1);
@@ -939,7 +880,7 @@ bool Statistic::stepCalcTotals()
Contact& curContact = *m_Contacts[i];
setProgressLabel(true, curContact.getNick());
-
+
m_pTotals->merge(curContact);
mergeContactData(*m_pTotals, curContact);
@@ -950,7 +891,7 @@ bool Statistic::stepCalcTotals()
}
// omitted contacts
- setProgressLabel(true, i18n(muT("Omitted contacts")));
+ setProgressLabel(true, TranslateT("Omitted contacts"));
if (m_Settings.m_OmitContacts && m_Settings.m_OmittedInTotals && m_bActuallyOmitted) {
m_pTotals->merge(*m_pOmitted);
@@ -964,8 +905,7 @@ bool Statistic::stepCalcTotals()
bool Statistic::stepPostOmitContacts()
{
- if (shouldTerminate())
- {
+ if (shouldTerminate()) {
return false;
}
@@ -998,7 +938,7 @@ bool Statistic::stepTransformData()
}
// omitted contacts
- setProgressLabel(true, i18n(muT("Omitted contacts")));
+ setProgressLabel(true, TranslateT("Omitted contacts"));
if (m_bActuallyOmitted)
transformContactData(*m_pOmitted);
@@ -1006,11 +946,11 @@ bool Statistic::stepTransformData()
stepProgress(true);
// totals
- setProgressLabel(true, i18n(muT("Totals")));
+ setProgressLabel(true, TranslateT("Totals"));
if (m_Settings.m_CalcTotals)
transformContactData(*m_pTotals);
-
+
stepProgress(true);
return true;
}
@@ -1022,52 +962,40 @@ bool Statistic::stepWriteHTML()
bool bInterrupted = false;
- int j;
-
- /*
- * Init output.
- */
-
+ // Init output.
setProgressMax(true, countContacts() + 2);
- /*
- * Create output stream.
- */
-
+ // Create output stream.
ext::a::ofstream ofs(utils::toA(createFile(m_OutputFile)).c_str());
if (!ofs.good()) {
- m_ErrorText = ext::str(ext::kformat(i18n(muT("HistoryStats couldn't open the output file (#{file}) for write access.\r\n\r\nPlease check the output filename you have chosen for correctness. Additionally, please check whether the file, folder, and/or disk is writable.")))
- % muT("#{file}") * m_OutputFile);
+ m_ErrorText = ext::str(ext::kformat(TranslateT("HistoryStats couldn't open the output file (#{file}) for write access.\r\n\r\nPlease check the output filename you have chosen for correctness. Additionally, please check whether the file, folder, and/or disk is writable."))
+ % _T("#{file}") * m_OutputFile);
return false;
}
UTF8Buffer utf8_buf(ofs);
ext::ostream tos(&utf8_buf);
- /*
- * Inform active columns about beginning output.
- */
-
+ // Inform active columns about beginning output.
iter_each_(std::vector<Column*>, col, m_ActiveCols)
{
(*col)->outputBegin();
}
- /*
- * Output HTML init sequence.
- */
-
+ // Output HTML init sequence.
std::set<ext::string> additionalCSSSelectors;
std::vector<ext::string> additionalCSS;
Column::IDProvider idProvider;
- iter_each_(std::vector<Column*>, col, m_ActiveCols) {
+ iter_each_(std::vector<Column*>, col, m_ActiveCols)
+ {
Column::StyleList cssList = (*col)->outputGetAdditionalStyles(idProvider);
- iter_each_(Column::StyleList, css, cssList) {
+ iter_each_(Column::StyleList, css, cssList)
+ {
if (additionalCSSSelectors.find(css->first) == additionalCSSSelectors.end()) {
- additionalCSS.push_back(css->first + muT(" { ") + css->second + muT(" }"));
+ additionalCSS.push_back(css->first + _T(" { ") + css->second + _T(" }"));
additionalCSSSelectors.insert(css->first);
}
}
@@ -1076,35 +1004,32 @@ bool Statistic::stepWriteHTML()
additionalCSSSelectors.clear();
- tos << muT("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">") << ext::endl
- << muT("<html>") << ext::endl
- << muT("<head>") << ext::endl
- << muT("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />") << ext::endl
- << muT("<meta name=\"generator\" content=\"HistoryStats " << utils::versionToDotted(m_Settings.m_VersionCurrent) << "\" />") << ext::endl
- << muT("<title>")
- << ext::kformat(i18n(muT("Statistics for #{nick} - HistoryStats"))) % muT("#{nick}") * utils::htmlEscape(m_Settings.m_OwnNick)
- << muT("</title>") << ext::endl
- << muT("<style type=\"text/css\">") << ext::endl;
+ tos << _T("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">") << ext::endl
+ << _T("<html>") << ext::endl
+ << _T("<head>") << ext::endl
+ << _T("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />") << ext::endl
+ << _T("<meta name=\"generator\" content=\"HistoryStats " << utils::versionToDotted(m_Settings.m_VersionCurrent) << "\" />") << ext::endl
+ << _T("<title>")
+ << ext::kformat(TranslateT("Statistics for #{nick} - HistoryStats")) % _T("#{nick}") * utils::htmlEscape(m_Settings.m_OwnNick)
+ << _T("</title>") << ext::endl
+ << _T("<style type=\"text/css\">") << ext::endl;
tos << m_Settings.getDefaultStyleSheet();
-
+
iter_each_(std::vector<ext::string>, css, additionalCSS)
{
tos << *css << ext::endl;
}
- tos << muT("</style>") << ext::endl
- << muT("</head>") << ext::endl
- << muT("<body><h1>")
- << ext::kformat(i18n(muT("Statistics for #{nick}"))) % muT("#{nick}") * utils::htmlEscape(m_Settings.m_OwnNick)
- << muT("</h1>") << ext::endl;
- tos << muT("<table>") << ext::endl;
+ tos << _T("</style>") << ext::endl
+ << _T("</head>") << ext::endl
+ << _T("<body><h1>")
+ << ext::kformat(TranslateT("Statistics for #{nick}")) % _T("#{nick}") * utils::htmlEscape(m_Settings.m_OwnNick)
+ << _T("</h1>") << ext::endl;
+ tos << _T("<table>") << ext::endl;
additionalCSS.clear();
- /*
- * Output header.
- */
-
+ // Output header.
SIZE headerSize = { 0, 1 };
iter_each_(std::vector<Column*>, col, m_ActiveCols)
@@ -1115,41 +1040,31 @@ bool Statistic::stepWriteHTML()
headerSize.cy = max(headerSize.cy, colSize.cy);
}
- if (m_Settings.m_TableHeader)
- {
- for (j = 1; j <= headerSize.cy; j++)
- {
- tos << muT("<tr class=\"header\">") << ext::endl;
+ if (m_Settings.m_TableHeader) {
+ for (int j = 1; j <= headerSize.cy; j++) {
+ tos << _T("<tr class=\"header\">") << ext::endl;
iter_each_(std::vector<Column*>, col, m_ActiveCols)
{
(*col)->outputRenderHeader(tos, j, headerSize.cy);
}
- tos << muT("</tr>") << ext::endl;
+ tos << _T("</tr>") << ext::endl;
}
}
- // stop if problem creating files/folders
+ // stop if problem creating files/folders
if (!m_ErrorText.empty())
- {
bInterrupted = true;
- }
if (shouldTerminate())
- {
bInterrupted = true;
- }
- /*
- * Output contacts.
- */
-
- if (!bInterrupted)
- {
+ // Output contacts.
+ if (!bInterrupted) {
upto_each_(i, countContacts())
{
- tos << muT("<tr>") << ext::endl;
+ tos << _T("<tr>") << ext::endl;
const Contact& curContact = getContact(i);
@@ -1160,69 +1075,57 @@ bool Statistic::stepWriteHTML()
(*col)->outputRenderRow(tos, curContact, Column::asContact);
}
- tos << muT("</tr>") << ext::endl;
+ tos << _T("</tr>") << ext::endl;
- if (shouldTerminate())
- {
+ if (shouldTerminate()) {
bInterrupted = true;
break;
}
- // stop if problem creating files/folders
- if (!m_ErrorText.empty())
- {
+ // stop if problem creating files/folders
+ if (!m_ErrorText.empty()) {
bInterrupted = true;
break;
}
- if (m_Settings.m_TableHeader && m_Settings.m_TableHeaderRepeat != 0 && ((i + 1) % m_Settings.m_TableHeaderRepeat == 0))
- {
- for (j = 1; j <= headerSize.cy; ++j)
- {
- tos << muT("<tr class=\"header\">") << ext::endl;
+ if (m_Settings.m_TableHeader && m_Settings.m_TableHeaderRepeat != 0 && ((i + 1) % m_Settings.m_TableHeaderRepeat == 0)) {
+ for (int j = 1; j <= headerSize.cy; ++j) {
+ tos << _T("<tr class=\"header\">") << ext::endl;
iter_each_(std::vector<Column*>, col, m_ActiveCols)
{
(*col)->outputRenderHeader(tos, j, headerSize.cy);
}
- tos << muT("</tr>") << ext::endl;
+ tos << _T("</tr>") << ext::endl;
}
}
stepProgress(true);
}
- } // !bInterrupted
-
- /*
- * Output omitted contacts.
- */
+ }
- if (!bInterrupted && m_Settings.m_OmitContacts && m_Settings.m_OmittedInExtraRow && m_bActuallyOmitted)
- {
- setProgressLabel(true, i18n(muT("Writing omitted contacts")));
+ // Output omitted contacts.
+ if (!bInterrupted && m_Settings.m_OmitContacts && m_Settings.m_OmittedInExtraRow && m_bActuallyOmitted) {
+ setProgressLabel(true, TranslateT("Writing omitted contacts"));
const Contact& omittedContact = getOmitted();
- tos << muT("<tr class=\"omitted\">") << ext::endl;
+ tos << _T("<tr class=\"omitted\">") << ext::endl;
iter_each_(std::vector<Column*>, col, m_ActiveCols)
{
(*col)->outputRenderRow(tos, omittedContact, Column::asOmitted);
}
- tos << muT("</tr>") << ext::endl;
+ tos << _T("</tr>") << ext::endl;
- // stop if problem creating files/folders
+ // stop if problem creating files/folders
if (!m_ErrorText.empty())
- {
bInterrupted = true;
- }
if (shouldTerminate())
- {
bInterrupted = true;
- }
}
stepProgress(true);
@@ -1231,62 +1134,48 @@ bool Statistic::stepWriteHTML()
* Output totals.
*/
- if (!bInterrupted && m_Settings.m_CalcTotals)
- {
- setProgressLabel(true, i18n(muT("Writing totals")));
+ if (!bInterrupted && m_Settings.m_CalcTotals) {
+ setProgressLabel(true, TranslateT("Writing totals"));
const Contact& totalsContact = getTotals();
- tos << muT("<tr class=\"totals\">") << ext::endl;
+ tos << _T("<tr class=\"totals\">") << ext::endl;
iter_each_(std::vector<Column*>, col, m_ActiveCols)
{
(*col)->outputRenderRow(tos, totalsContact, Column::asTotal);
}
- tos << muT("</tr>") << ext::endl;
+ tos << _T("</tr>") << ext::endl;
stepProgress(true);
- /*
- * Finish output.
- */
-
- tos << muT("</table>") << ext::endl;
+ // Finish output.
+ tos << _T("</table>") << ext::endl;
- tos << muT("<div class=\"footer\">")
- << ext::kformat(i18n(muT("Created with #{plugin} #{version} on #{date} at #{time}")))
- % muT("#{plugin}") * muT("<a href=\"http://miranda.dark-passage.de/\">HistoryStats</a>")
- % muT("#{version}") * utils::versionToDotted(m_Settings.m_VersionCurrent)
- % muT("#{date}") * utils::htmlEscape(utils::timestampToDate(getTimeStarted()))
- % muT("#{time}") * utils::htmlEscape(utils::timestampToTime(getTimeStarted()))
- << muT("</div>") << ext::endl;
+ tos << _T("<div class=\"footer\">")
+ << ext::kformat(TranslateT("Created with #{plugin} #{version} on #{date} at #{time}"))
+ % _T("#{plugin}") * _T("<a href=\"http://miranda.dark-passage.de/\">HistoryStats</a>")
+ % _T("#{version}") * utils::versionToDotted(m_Settings.m_VersionCurrent)
+ % _T("#{date}") * utils::htmlEscape(utils::timestampToDate(getTimeStarted()))
+ % _T("#{time}") * utils::htmlEscape(utils::timestampToTime(getTimeStarted()))
+ << _T("</div>") << ext::endl;
- tos << muT("</body></html>") << ext::endl;
- } // !bInterrupted
-
- /*
- * Inform active columns about ending output.
- */
+ tos << _T("</body></html>") << ext::endl;
+ }
+ // Inform active columns about ending output.
iter_each_(std::vector<Column*>, col, m_ActiveCols)
{
(*col)->outputEnd();
}
- /*
- * Close output stream.
- */
-
+ // Close output stream.
tos.flush();
ofs.close();
- /*
- * Handle conflicting files.
- */
-
- if (bInterrupted)
- {
+ // Handle conflicting files.
+ if (bInterrupted) {
iter_each_(ConflictingFiles, fi, m_ConflictingFiles)
{
DeleteFile(fi->second.c_str());
@@ -1295,8 +1184,7 @@ bool Statistic::stepWriteHTML()
m_ConflictingFiles.clear();
}
- if (m_ConflictingFiles.size() > 0)
- {
+ if (m_ConflictingFiles.size() > 0) {
int nResult = DialogBoxParam(
m_hInst,
MAKEINTRESOURCE(IDD_CONFLICT),
@@ -1304,22 +1192,18 @@ bool Statistic::stepWriteHTML()
staticConflictProc,
reinterpret_cast<LPARAM>(&m_ConflictingFiles));
- if (nResult == IDOK)
- {
+ if (nResult == IDOK) {
iter_each_(ConflictingFiles, fi, m_ConflictingFiles)
{
- if (!MoveFileEx(fi->second.c_str(), fi->first.c_str(), MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING))
- {
- if (!MoveFile(fi->second.c_str(), fi->first.c_str()))
- {
+ if (!MoveFileEx(fi->second.c_str(), fi->first.c_str(), MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING)) {
+ if (!MoveFile(fi->second.c_str(), fi->first.c_str())) {
CopyFile(fi->second.c_str(), fi->first.c_str(), FALSE);
DeleteFile(fi->second.c_str());
}
}
}
}
- else
- {
+ else {
iter_each_(ConflictingFiles, fi, m_ConflictingFiles)
{
DeleteFile(fi->second.c_str());
@@ -1329,19 +1213,11 @@ bool Statistic::stepWriteHTML()
m_ConflictingFiles.clear();
}
- /* don't do this, we don't want to delete a file we possibly never touched
- if (bInterrupted)
- {
- // remove partialy generated file, if interrupted
- DeleteFile(m_OutputFile.c_str());
- }
- */
-
return !bInterrupted;
}
-Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HINSTANCE hInst)
- : m_Settings(settings),
+Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HINSTANCE hInst) :
+ m_Settings(settings),
m_CharMapper(m_Settings),
m_hInst(hInst),
m_hWndProgress(NULL),
@@ -1366,20 +1242,14 @@ Statistic::Statistic(const Settings& settings, InvocationSource invokedFrom, HIN
bool Statistic::createStatistics()
{
- /*
- * Prepare event for cancel.
- */
+ // Prepare event for cancel.
m_hCancelEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
-
if (m_hCancelEvent == NULL)
- {
return false;
- }
m_hWndProgress = CreateDialog(m_hInst, MAKEINTRESOURCE(IDD_PROGRESS), 0, staticProgressProc);
- if (m_hWndProgress == NULL)
- {
+ if (m_hWndProgress == NULL) {
CloseHandle(m_hCancelEvent);
m_hCancelEvent = NULL;
return false;
@@ -1387,9 +1257,7 @@ bool Statistic::createStatistics()
SetWindowLong(m_hWndProgress, GWLP_USERDATA, reinterpret_cast<LONG>(this));
- /*
- * Init progress dialog.
- */
+ // Init progress dialog.
utils::centerDialog(m_hWndProgress);
UpdateWindow(m_hWndProgress);
@@ -1399,53 +1267,39 @@ bool Statistic::createStatistics()
bool bDone = false;
MSG msg;
- while (!bDone)
- {
- while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
- {
- if (msg.message == WM_QUIT)
- {
+ while (!bDone) {
+ while (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) {
+ if (msg.message == WM_QUIT) {
bDone = true;
break;
}
- if (!IsDialogMessage(msg.hwnd, &msg))
- {
+ if (!IsDialogMessage(msg.hwnd, &msg)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
if (bDone)
- {
break;
- }
- DWORD result = MsgWaitForMultipleObjects(1, &hThread, FALSE, INFINITE, QS_ALLINPUT);
+ DWORD result = MsgWaitForMultipleObjects(1, &hThread, FALSE, INFINITE, QS_ALLINPUT);
- if (result == WAIT_OBJECT_0 + 1)
- {
- // there is a message in the queue
+ if (result == WAIT_OBJECT_0 + 1) // there is a message in the queue
continue;
- }
- else
- {
- // thread is signaled, i.e. terminated
- DestroyWindow(m_hWndProgress);
- }
+
+ // thread is signaled, i.e. terminated
+ DestroyWindow(m_hWndProgress);
}
/*
* Get result from thread.
*/
- // bool bSuccess = createStatisticsSteps();
- DWORD threadRes;
- bool bSuccess = false;
+ bool bSuccess = false;
+ DWORD threadRes;
if (GetExitCodeThread(hThread, &threadRes))
- {
bSuccess = (threadRes == 0);
- }
/*
* Cleanup.
@@ -1455,8 +1309,7 @@ bool Statistic::createStatistics()
m_hCancelEvent = NULL;
m_hWndProgress = NULL;
- if (bSuccess)
- {
+ if (bSuccess) {
/*
* Save last successfully created statistics
*/
@@ -1471,9 +1324,7 @@ bool Statistic::createStatistics()
(m_InvokedFrom == fromMenu && m_Settings.m_AutoOpenMenu);
if (bOpenAfterwards)
- {
m_Settings.openURL(m_OutputFile.c_str());
- }
}
return bSuccess;
@@ -1481,32 +1332,32 @@ bool Statistic::createStatistics()
bool Statistic::createStatisticsSteps()
{
- static const struct {
+ static const struct
+ {
bool (Statistic::*stepFn)();
- mu_text* stepMsg;
- } stepsInfo[] = {
- { &Statistic::stepInit , I18N(muT("Initializing")) },
- { &Statistic::stepReadDB , I18N(muT("Reading database")) },
- { &Statistic::stepRemoveContacts , I18N(muT("Removing contacts")) },
- { &Statistic::stepSortContacts , I18N(muT("Sorting contacts")) },
- { &Statistic::stepPreOmitContacts , I18N(muT("Precollecting column data")) },
- { &Statistic::stepOmitContacts , I18N(muT("Limiting number of contacts")) },
- { &Statistic::stepCalcTotals , I18N(muT("Calculating totals")) },
- { &Statistic::stepPostOmitContacts, I18N(muT("Postcollecting column data")) },
- { &Statistic::stepTransformData , I18N(muT("Transforming data")) },
- { &Statistic::stepWriteHTML , I18N(muT("Creating HTML")) }
+ TCHAR* stepMsg;
+ }
+ stepsInfo[] = {
+ { &Statistic::stepInit, LPGENT("Initializing") },
+ { &Statistic::stepReadDB, LPGENT("Reading database") },
+ { &Statistic::stepRemoveContacts, LPGENT("Removing contacts") },
+ { &Statistic::stepSortContacts, LPGENT("Sorting contacts") },
+ { &Statistic::stepPreOmitContacts, LPGENT("Precollecting column data") },
+ { &Statistic::stepOmitContacts, LPGENT("Limiting number of contacts") },
+ { &Statistic::stepCalcTotals, LPGENT("Calculating totals") },
+ { &Statistic::stepPostOmitContacts, LPGENT("Postcollecting column data") },
+ { &Statistic::stepTransformData, LPGENT("Transforming data") },
+ { &Statistic::stepWriteHTML, LPGENT("Creating HTML") }
};
setProgressMax(false, array_len(stepsInfo));
array_each_(i, stepsInfo)
{
- setProgressLabel(false, i18n(stepsInfo[i].stepMsg));
+ setProgressLabel(false, TranslateTS(stepsInfo[i].stepMsg));
if (!(this->*stepsInfo[i].stepFn)())
- {
return false;
- }
stepProgress(false);
}
@@ -1514,7 +1365,7 @@ bool Statistic::createStatisticsSteps()
/*
* Last step: We are done.
*/
- setProgressLabel(false, i18n(muT("Done")));
+ setProgressLabel(false, TranslateT("Done"));
return true;
}
@@ -1522,7 +1373,7 @@ bool Statistic::createStatisticsSteps()
DWORD WINAPI Statistic::threadProc(LPVOID lpParameter)
{
Statistic* pStats = reinterpret_cast<Statistic*>(lpParameter);
-
+
SetEvent(pStats->m_hThreadPushEvent);
// perform action
@@ -1530,13 +1381,7 @@ DWORD WINAPI Statistic::threadProc(LPVOID lpParameter)
// check for errors
if (!pStats->m_ErrorText.empty() && !mu::system::terminated())
- {
- MessageBox(
- 0,
- pStats->m_ErrorText.c_str(),
- i18n(muT("HistoryStats - Error")),
- MB_ICONERROR | MB_OK);
- }
+ MessageBox(0, pStats->m_ErrorText.c_str(), TranslateT("HistoryStats - Error"), MB_ICONERROR | MB_OK);
// free statistics
delete pStats;
@@ -1548,11 +1393,8 @@ DWORD WINAPI Statistic::threadProc(LPVOID lpParameter)
DWORD WINAPI Statistic::threadProcSteps(LPVOID lpParameter)
{
Statistic* pStats = reinterpret_cast<Statistic*>(lpParameter);
-
if (pStats->m_Settings.m_ThreadLowPriority)
- {
SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_BELOW_NORMAL);
- }
bool bSuccess = pStats->createStatisticsSteps();
@@ -1561,8 +1403,7 @@ DWORD WINAPI Statistic::threadProcSteps(LPVOID lpParameter)
INT_PTR CALLBACK Statistic::staticConflictProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- if (uMsg == WM_INITDIALOG)
- {
+ if (uMsg == WM_INITDIALOG) {
TranslateDialogDefault(hDlg);
SendMessage(hDlg, WM_SETICON, ICON_BIG, reinterpret_cast<LPARAM>(LoadIcon(g_hInst, MAKEINTRESOURCE(IDI_HISTORYSTATS))));
@@ -1573,12 +1414,10 @@ INT_PTR CALLBACK Statistic::staticConflictProc(HWND hDlg, UINT uMsg, WPARAM wPar
ConflictingFiles* pFiles = reinterpret_cast<ConflictingFiles*>(lParam);
LVCOLUMN lvc;
-
lvc.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_FMT;
lvc.fmt = LVCFMT_LEFT;
lvc.cx = 400;
- lvc.pszText = const_cast<mu_text*>(i18n(muT("Already existing file")));
-
+ lvc.pszText = const_cast<TCHAR*>(TranslateT("Already existing file"));
ListView_InsertColumn(hWndFiles, 0, &lvc);
int nIndex = 0;
@@ -1586,23 +1425,19 @@ INT_PTR CALLBACK Statistic::staticConflictProc(HWND hDlg, UINT uMsg, WPARAM wPar
iter_each_(ConflictingFiles, fi, *pFiles)
{
LVITEM lvi;
-
lvi.mask = LVIF_TEXT;
lvi.iItem = nIndex++;
lvi.iSubItem = 0;
- lvi.pszText = const_cast<mu_text*>(fi->first.c_str());
-
+ lvi.pszText = const_cast<TCHAR*>(fi->first.c_str());
ListView_InsertItem(hWndFiles, &lvi);
}
}
- else if (uMsg == WM_COMMAND)
- {
- switch (LOWORD(wParam))
- {
- case IDOK:
- case IDCANCEL:
- EndDialog(hDlg, LOWORD(wParam));
- return TRUE;
+ else if (uMsg == WM_COMMAND) {
+ switch (LOWORD(wParam)) {
+ case IDOK:
+ case IDCANCEL:
+ EndDialog(hDlg, LOWORD(wParam));
+ return TRUE;
}
}
@@ -1619,14 +1454,12 @@ Statistic::~Statistic()
m_Contacts.clear();
- if (m_pOmitted)
- {
+ if (m_pOmitted) {
freeContactData(*m_pOmitted);
delete m_pOmitted;
}
- if (m_pTotals)
- {
+ if (m_pTotals) {
freeContactData(*m_pTotals);
delete m_pTotals;
}
@@ -1635,13 +1468,10 @@ Statistic::~Statistic()
void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINSTANCE hInst, HWND hWndParent /* = NULL */)
{
// check if running and make running
- if (m_bRunning)
- {
- MessageBox(
- 0,
- i18n(muT("HistoryStats is already generating statistics. Please wait for the already running process to be finished or cancel it and try again.")),
- i18n(muT("HistoryStats")),
- MB_ICONINFORMATION | MB_OK);
+ if (m_bRunning) {
+ MessageBox(0,
+ TranslateT("HistoryStats is already generating statistics. Please wait for the already running process to be finished or cancel it and try again."),
+ TranslateT("HistoryStats"), MB_ICONINFORMATION | MB_OK);
return;
}
@@ -1651,8 +1481,7 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS
Statistic* pStats = new Statistic(settings, invokedFrom, hInst);
// create event for thread stack unwinding
- if ((pStats->m_hThreadPushEvent = CreateEvent(NULL, FALSE, FALSE, NULL)) == NULL)
- {
+ if ((pStats->m_hThreadPushEvent = CreateEvent(NULL, FALSE, FALSE, NULL)) == NULL) {
m_bRunning = false;
return;
}
@@ -1663,13 +1492,9 @@ void Statistic::run(const Settings& settings, InvocationSource invokedFrom, HINS
// wait for thread to place itself on thread unwind stack
if (hThread != NULL)
- {
WaitForSingleObject(pStats->m_hThreadPushEvent, INFINITE);
- }
else
- {
m_bRunning = false;
- }
CloseHandle(pStats->m_hThreadPushEvent);
pStats->m_hThreadPushEvent = NULL;
diff --git a/plugins/HistoryStats/src/statistic.h b/plugins/HistoryStats/src/statistic.h
index ee312619be..530ba57439 100644
--- a/plugins/HistoryStats/src/statistic.h
+++ b/plugins/HistoryStats/src/statistic.h
@@ -202,8 +202,8 @@ public:
// file management
ext::string createFile(const ext::string& desiredName);
- bool newFile(const mu_text* fileExt, ext::string& writeFile, ext::string& finalURL);
- bool newFilePNG(ext::string& writeFile, ext::string& finalURL) { return newFile(muT(".png"), writeFile, finalURL); }
+ bool newFile(const TCHAR* fileExt, ext::string& writeFile, ext::string& finalURL);
+ bool newFilePNG(ext::string& writeFile, ext::string& finalURL) { return newFile(_T(".png"), writeFile, finalURL); }
bool newFilePNG(Canvas& canvas, ext::string& finalURL);
};
diff --git a/plugins/HistoryStats/src/themeapi.cpp b/plugins/HistoryStats/src/themeapi.cpp
deleted file mode 100644
index a15067bc66..0000000000
--- a/plugins/HistoryStats/src/themeapi.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-#include "_globals.h"
-#include "themeapi.h"
-
-/*
- * ThemeAPI
- */
-
-const mu_text* ThemeAPI::m_szThemesDll = muT("uxtheme.dll");
-HMODULE ThemeAPI::m_hThemesDll = NULL;
-bool ThemeAPI::m_bUseTheme = false;
-
-ThemeAPI::fnCloseThemeData ThemeAPI::CloseThemeData = NULL;
-ThemeAPI::fnDrawThemeBackground ThemeAPI::DrawThemeBackground = NULL;
-ThemeAPI::fnIsAppThemed ThemeAPI::IsAppThemed = NULL;
-ThemeAPI::fnIsThemeActive ThemeAPI::IsThemeActive = NULL;
-ThemeAPI::fnOpenThemeData ThemeAPI::OpenThemeData = NULL;
-#if !defined(HISTORYSTATS_THEMEAPI_MINIMAL)
-ThemeAPI::fnDrawThemeIcon ThemeAPI::DrawThemeIcon = NULL;
-ThemeAPI::fnEnableThemeDialogTexture ThemeAPI::EnableThemeDialogTexture = NULL;
-ThemeAPI::fnGetThemePartSize ThemeAPI::GetThemePartSize = NULL;
-#endif
-
-void ThemeAPI::init()
-{
- m_hThemesDll = LoadLibrary(m_szThemesDll);
-
- if (m_hThemesDll)
- {
- CloseThemeData = reinterpret_cast<fnCloseThemeData >(GetProcAddress(m_hThemesDll, muA("CloseThemeData") ));
- DrawThemeBackground = reinterpret_cast<fnDrawThemeBackground >(GetProcAddress(m_hThemesDll, muA("DrawThemeBackground") ));
- IsAppThemed = reinterpret_cast<fnIsAppThemed >(GetProcAddress(m_hThemesDll, muA("IsAppThemed") ));
- IsThemeActive = reinterpret_cast<fnIsThemeActive >(GetProcAddress(m_hThemesDll, muA("IsThemeActive") ));
- OpenThemeData = reinterpret_cast<fnOpenThemeData >(GetProcAddress(m_hThemesDll, muA("OpenThemeData") ));
-#if !defined(HISTORYSTATS_THEMEAPI_MINIMAL)
- DrawThemeIcon = reinterpret_cast<fnDrawThemeIcon >(GetProcAddress(m_hThemesDll, muA("DrawThemeIcon") ));
- EnableThemeDialogTexture = reinterpret_cast<fnEnableThemeDialogTexture>(GetProcAddress(m_hThemesDll, muA("EnableThemeDialogTexture")));
- GetThemePartSize = reinterpret_cast<fnGetThemePartSize >(GetProcAddress(m_hThemesDll, muA("GetThemePartSize") ));
-#endif
-
- m_bUseTheme = IsThemeActive && IsAppThemed;
- }
-}
-
-void ThemeAPI::uninit()
-{
- if (m_hThemesDll)
- {
- FreeLibrary(m_hThemesDll);
-
- m_hThemesDll = NULL;
- m_bUseTheme = false;
- }
-} \ No newline at end of file
diff --git a/plugins/HistoryStats/src/themeapi.h b/plugins/HistoryStats/src/themeapi.h
deleted file mode 100644
index fe3444a604..0000000000
--- a/plugins/HistoryStats/src/themeapi.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#if !defined(HISTORYSTATS_GUARD_THEMEAPI_H)
-#define HISTORYSTATS_GUARD_THEMEAPI_H
-
-#include "_globals.h"
-#include "_consts.h"
-
-#include <uxtheme.h>
-#include <tmschema.h>
-
-#define HISTORYSTATS_THEMEAPI_MINIMAL
-
-class ThemeAPI
- : private pattern::NotInstantiable<ThemeAPI>
-{
-public:
- typedef HRESULT (WINAPI *fnCloseThemeData )(HTHEME hTheme);
- typedef HRESULT (WINAPI *fnDrawThemeBackground )(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, const RECT *pClipRect);
- typedef BOOL (WINAPI *fnIsAppThemed )(VOID);
- typedef BOOL (WINAPI *fnIsThemeActive )(VOID);
- typedef HTHEME (WINAPI *fnOpenThemeData )(HWND hwnd, LPCWSTR pszClassList);
-#if !defined(HISTORYSTATS_THEMEAPI_MINIMAL)
- typedef HRESULT (WINAPI *fnDrawThemeIcon )(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, const RECT *pRect, HIMAGELIST himl, int iImageIndex);
- typedef HRESULT (WINAPI *fnEnableThemeDialogTexture)(HWND hwnd, DWORD dwFlags);
- typedef HRESULT (WINAPI *fnGetThemePartSize )(HTHEME hTheme, HDC hdc, int iPartId, int iStateId, RECT *prc, THEMESIZE eSize, SIZE *psz);
-#endif
-
-public:
- static fnCloseThemeData CloseThemeData;
- static fnDrawThemeBackground DrawThemeBackground;
- static fnIsAppThemed IsAppThemed;
- static fnIsThemeActive IsThemeActive;
- static fnOpenThemeData OpenThemeData;
-#if !defined(HISTORYSTATS_THEMEAPI_MINIMAL)
- static fnDrawThemeIcon DrawThemeIcon;
- static fnEnableThemeDialogTexture EnableThemeDialogTexture;
- static fnGetThemePartSize GetThemePartSize;
-#endif
-
-private:
- static const mu_text* m_szThemesDll;
- static HMODULE m_hThemesDll;
- static bool m_bUseTheme;
-
-public:
- static void init();
- static void uninit();
- static bool useTheme() { return m_bUseTheme && IsThemeActive() && IsAppThemed(); }
-};
-
-#endif // HISTORYSTATS_GUARD_THEMEAPI_H \ No newline at end of file
diff --git a/plugins/HistoryStats/src/utf8buffer.h b/plugins/HistoryStats/src/utf8buffer.h
index 9d1b013d99..e4727afc30 100644
--- a/plugins/HistoryStats/src/utf8buffer.h
+++ b/plugins/HistoryStats/src/utf8buffer.h
@@ -5,37 +5,37 @@
#include <string>
class UTF8Buffer
- : public std::basic_streambuf<mu_text, std::char_traits<mu_text> >
+ : public std::basic_streambuf<TCHAR, std::char_traits<TCHAR> >
, private pattern::NotCopyable<UTF8Buffer>
{
private:
- typedef std::char_traits<mu_text> _Tr;
+ typedef std::char_traits<TCHAR> _Tr;
private:
int m_BufSize;
- mu_text* m_pBuf;
+ TCHAR* m_pBuf;
ext::a::ostream& m_Stream;
- mu_ansi* m_pUTF8Buf;
- mu_wide* m_pBufW;
+ char* m_pUTF8Buf;
+ WCHAR* m_pBufW;
-#if !defined(MU_WIDE)
- mu_wide m_CharMap[256];
-#endif // MU_WIDE
+#if !defined(_UNICODE)
+ WCHAR m_CharMap[256];
+#endif // _UNICODE
private:
- void dump(const mu_text* pBegin, const mu_text* pEnd)
+ void dump(const TCHAR* pBegin, const TCHAR* pEnd)
{
size_t len = pEnd - pBegin;
-#if !defined(MU_WIDE)
- mu_wide* pW = m_pBufW;
- mu_ansi* pA = m_pBuf;
+#if !defined(_UNICODE)
+ WCHAR* pW = m_pBufW;
+ char* pA = m_pBuf;
while (pA < pEnd)
{
*pW++ = m_CharMap[static_cast<unsigned char>(*pA++)];
}
-#endif // MU_WIDE
+#endif // _UNICODE
size_t utf8_len = utils::rawUTF8Encode(m_pBufW, len, m_pUTF8Buf);
m_Stream.write(m_pUTF8Buf, utf8_len);
@@ -81,26 +81,26 @@ public:
explicit UTF8Buffer(ext::a::ostream& outStream, int bufferSize = 4096)
: m_BufSize(bufferSize), m_Stream(outStream)
{
- m_pBuf = new mu_text[m_BufSize];
- m_pUTF8Buf = new mu_ansi[3 * m_BufSize];
+ m_pBuf = new TCHAR[m_BufSize];
+ m_pUTF8Buf = new char[3 * m_BufSize];
-#if defined(MU_WIDE)
+#if defined(_UNICODE)
m_pBufW = m_pBuf;
-#else // MU_WIDE
- m_pBufW = new mu_wide[m_BufSize];
-#endif // MU_WIDE
+#else // _UNICODE
+ m_pBufW = new WCHAR[m_BufSize];
+#endif // _UNICODE
-#if !defined(MU_WIDE)
- mu_ansi ANSIChars[256];
+#if !defined(_UNICODE)
+ char ANSIChars[256];
array_each_(i, ANSIChars)
{
- ANSIChars[i] = static_cast<mu_ansi>(i);
+ ANSIChars[i] = static_cast<char>(i);
}
- m_CharMap[0] = muC(' ');
+ m_CharMap[0] = ' ';
MultiByteToWideChar(CP_ACP, 0, ANSIChars + 1, 255, m_CharMap + 1, 255);
-#endif // MU_WIDE
+#endif // _UNICODE
setp(m_pBuf, m_pBuf + m_BufSize);
}
@@ -110,9 +110,9 @@ public:
delete[] m_pBuf;
delete[] m_pUTF8Buf;
-#if !defined(MU_WIDE)
+#if !defined(_UNICODE)
delete[] m_pBufW;
-#endif // MU_WIDE
+#endif // _UNICODE
}
};
diff --git a/plugins/HistoryStats/src/utils.cpp b/plugins/HistoryStats/src/utils.cpp
index ba1cabc53f..c73b8d941d 100644
--- a/plugins/HistoryStats/src/utils.cpp
+++ b/plugins/HistoryStats/src/utils.cpp
@@ -12,45 +12,39 @@
namespace utils
{
- ext::string timestampToString(DWORD value, const mu_text* format)
+ ext::string timestampToString(DWORD value, const TCHAR* format)
{
- mu_text temp[100] = { 0 };
+ TCHAR temp[100] = { 0 };
- return (ext::strfunc::ftime(temp, 100, format, gmtime(reinterpret_cast<time_t*>(&value))) > 0) ? temp : muT("");
+ return (ext::strfunc::ftime(temp, 100, format, gmtime(reinterpret_cast<time_t*>(&value))) > 0) ? temp : _T("");
}
- ext::string tmStructToString(const tm& value, const mu_text* format)
+ ext::string tmStructToString(const tm& value, const TCHAR* format)
{
- mu_text temp[100] = { 0 };
+ TCHAR temp[100] = { 0 };
- return (ext::strfunc::ftime(temp, 100, format, &value) > 0) ? temp : muT("");
+ return (ext::strfunc::ftime(temp, 100, format, &value) > 0) ? temp : _T("");
}
ext::string durationToString(DWORD value)
{
- mu_text temp[100] = { 0 };
+ TCHAR temp[100] = { 0 };
value += 59;
value /= 60;
if (value >= 1440)
- {
- ext::strfunc::sprintf(temp, muT("%dd %02d:%02d"), value / 1440, (value / 60) % 24, value % 60);
- }
+ ext::strfunc::sprintf(temp, _T("%dd %02d:%02d"), value / 1440, (value / 60) % 24, value % 60);
else
- {
- ext::strfunc::sprintf(temp, muT("%02d:%02d"), value / 60, value % 60);
- }
+ ext::strfunc::sprintf(temp, _T("%02d:%02d"), value / 60, value % 60);
return temp;
}
DWORD parseDate(const ext::string& date)
{
- if (date.length() != 10 || date[4] != muC('-') || date[7] != muC('-'))
- {
+ if (date.length() != 10 || date[4] != '-' || date[7] != '-')
return 0;
- }
struct tm dateTM;
@@ -63,9 +57,7 @@ namespace utils
time_t dateTT = mktime(&dateTM);
if (dateTT == -1)
- {
return 0;
- }
dateTM.tm_year = 1970 - 1900;
dateTM.tm_mon = 1 - 1;
@@ -76,55 +68,48 @@ namespace utils
time_t baseTT = mktime(&dateTM);
if (baseTT == -1)
- {
return 0;
- }
return dateTT - baseTT + 2 * 86400;
}
ext::string intToString(int value)
{
- mu_text temp[100] = { 0 };
+ TCHAR temp[100] = { 0 };
- ext::strfunc::sprintf(temp, muT("%d"), value);
+ ext::strfunc::sprintf(temp, _T("%d"), value);
return temp;
}
ext::string intToPadded(int value, int len)
{
- mu_text temp[100] = { 0 };
+ TCHAR temp[100] = { 0 };
- ext::strfunc::sprintf(temp, muT("%0*d"), len, value);
+ ext::strfunc::sprintf(temp, _T("%0*d"), len, value);
return temp;
}
ext::string intToGrouped(int value)
{
- mu_text temp[100] = { 0 };
+ TCHAR temp[100] = { 0 };
const char* grouping = Locale::grouping();
- ext::strfunc::sprintf(temp, muT("%d"), value);
+ ext::strfunc::sprintf(temp, _T("%d"), value);
if (*grouping == CHAR_MAX || *grouping <= 0)
- {
return temp;
- }
ext::string str = temp;
ext::string::size_type pos = str.length();
- ext::string::size_type prefix = (temp[0] == muC('+') || temp[0] == muC('-')) ? 1 : 0;
+ ext::string::size_type prefix = (temp[0] == '+' || temp[0] == '-') ? 1 : 0;
- while (*grouping != CHAR_MAX && *grouping > 0 && pos > prefix + *grouping)
- {
+ while (*grouping != CHAR_MAX && *grouping > 0 && pos > prefix + *grouping) {
str.insert(pos -= *grouping, 1, Locale::thousandSep());
if (grouping[1] > 0)
- {
++grouping;
- }
}
return str;
@@ -132,42 +117,35 @@ namespace utils
ext::string floatToString(double value, int precision)
{
- mu_text temp[100] = { 0 };
+ TCHAR temp[100] = { 0 };
- ext::strfunc::sprintf(temp, muT("%.*f"), precision, value);
+ ext::strfunc::sprintf(temp, _T("%.*f"), precision, value);
return temp;
}
ext::string floatToGrouped(double value, int precision)
{
- mu_text temp[100] = { 0 };
+ TCHAR temp[100] = { 0 };
const char* grouping = Locale::grouping();
- ext::strfunc::sprintf(temp, muT("%.*f"), precision, value);
+ ext::strfunc::sprintf(temp, _T("%.*f"), precision, value);
if (*grouping == CHAR_MAX || *grouping <= 0)
- {
return temp;
- }
ext::string str = temp;
ext::string::size_type pos = str.find(Locale::decimalPoint());
- ext::string::size_type prefix = (temp[0] == muC('+') || temp[0] == muC('-')) ? 1 : 0;
+ ext::string::size_type prefix = (temp[0] == '+' || temp[0] == '-') ? 1 : 0;
if (pos == ext::string::npos)
- {
pos = str.length();
- }
- while (*grouping != CHAR_MAX && *grouping > 0 && pos > prefix + *grouping)
- {
+ while (*grouping != CHAR_MAX && *grouping > 0 && pos > prefix + *grouping) {
str.insert(pos -= *grouping, 1, Locale::thousandSep());
if (grouping[1] > 0)
- {
++grouping;
- }
}
return str;
@@ -176,26 +154,24 @@ namespace utils
ext::string ratioToPercent(int numerator, int denominator)
{
float value = 0.0;
- mu_text temp[100] = { 0 };
+ TCHAR temp[100] = { 0 };
- if (denominator != 0)
- {
+ if (denominator != 0) {
value = 1.0f * numerator / denominator;
}
- ext::strfunc::sprintf(temp, muT("%.0f%%"), 100.0f * value);
+ ext::strfunc::sprintf(temp, _T("%.0f%%"), 100.0f * value);
return temp;
}
- void replaceAllInPlace(ext::string& text, const mu_text* find, const mu_text* replace)
+ void replaceAllInPlace(ext::string& text, const TCHAR* find, const TCHAR* replace)
{
ext::string::size_type pos = 0;
ext::string::size_type find_len = ext::strfunc::len(find);
ext::string::size_type replace_len = ext::strfunc::len(replace);
- while ((pos = text.find(find, pos, find_len)) != ext::string::npos)
- {
+ while ((pos = text.find(find, pos, find_len)) != ext::string::npos) {
text.erase(pos, find_len);
text.insert(pos, replace, replace_len);
pos += replace_len;
@@ -204,191 +180,155 @@ namespace utils
void htmlEscapeInPlace(ext::string& text)
{
- replaceAllInPlace(text, muT("&") , muT("&amp;") );
- replaceAllInPlace(text, muT("\""), muT("&quot;"));
- replaceAllInPlace(text, muT("<") , muT("&lt;") );
- replaceAllInPlace(text, muT(">") , muT("&gt;") );
+ replaceAllInPlace(text, _T("&"), _T("&amp;"));
+ replaceAllInPlace(text, _T("\""), _T("&quot;"));
+ replaceAllInPlace(text, _T("<"), _T("&lt;"));
+ replaceAllInPlace(text, _T(">"), _T("&gt;"));
}
- const mu_text* stripPrefix(const mu_text* szPrefix, const mu_text* szText)
+ const TCHAR* stripPrefix(const TCHAR* szPrefix, const TCHAR* szText)
{
int i = 0;
- while (szPrefix[i] != muC('\0') && szText[i] != muC('\0') && szPrefix[i] == szText[i])
- {
+ while (szPrefix[i] != '\0' && szText[i] != '\0' && szPrefix[i] == szText[i])
++i;
- }
- if (szPrefix[i] == muC('\0'))
- {
+ if (szPrefix[i] == '\0')
return szText + i;
- }
- else
- {
- return szText;
- }
+
+ return szText;
}
- ext::string replaceVariables(const ext::string& strFormat, DWORD timeValue, const mu_text* szNick /* = muT("") */)
+ ext::string replaceVariables(const ext::string& strFormat, DWORD timeValue, const TCHAR* szNick /* = _T("") */)
{
- static const mu_text* szMonthName[][2] = {
- { I18N(muT("month3:Jan")), I18N(muT("monthF:January")) },
- { I18N(muT("month3:Feb")), I18N(muT("monthF:February")) },
- { I18N(muT("month3:Mar")), I18N(muT("monthF:March")) },
- { I18N(muT("month3:Apr")), I18N(muT("monthF:April")) },
- { I18N(muT("month3:May")), I18N(muT("monthF:May")) },
- { I18N(muT("month3:Jun")), I18N(muT("monthF:June")) },
- { I18N(muT("month3:Jul")), I18N(muT("monthF:July")) },
- { I18N(muT("month3:Aug")), I18N(muT("monthF:August")) },
- { I18N(muT("month3:Sep")), I18N(muT("monthF:September")) },
- { I18N(muT("month3:Oct")), I18N(muT("monthF:October")) },
- { I18N(muT("month3:Nov")), I18N(muT("monthF:November")) },
- { I18N(muT("month3:Dec")), I18N(muT("monthF:December")) },
+ static const TCHAR* szMonthName[][2] = {
+ { LPGENT("month3:Jan"), LPGENT("monthF:January") },
+ { LPGENT("month3:Feb"), LPGENT("monthF:February") },
+ { LPGENT("month3:Mar"), LPGENT("monthF:March") },
+ { LPGENT("month3:Apr"), LPGENT("monthF:April") },
+ { LPGENT("month3:May"), LPGENT("monthF:May") },
+ { LPGENT("month3:Jun"), LPGENT("monthF:June") },
+ { LPGENT("month3:Jul"), LPGENT("monthF:July") },
+ { LPGENT("month3:Aug"), LPGENT("monthF:August") },
+ { LPGENT("month3:Sep"), LPGENT("monthF:September") },
+ { LPGENT("month3:Oct"), LPGENT("monthF:October") },
+ { LPGENT("month3:Nov"), LPGENT("monthF:November") },
+ { LPGENT("month3:Dec"), LPGENT("monthF:December") },
};
- static const mu_text* szWDayName[][3] = {
- { I18N(muT("wday2:Mo")), I18N(muT("wday3:Mon")), I18N(muT("wdayF:Monday")) },
- { I18N(muT("wday2:Tu")), I18N(muT("wday3:Tue")), I18N(muT("wdayF:Tuesday")) },
- { I18N(muT("wday2:We")), I18N(muT("wday3:Wed")), I18N(muT("wdayF:Wednesday")) },
- { I18N(muT("wday2:Th")), I18N(muT("wday3:Thu")), I18N(muT("wdayF:Thursday")) },
- { I18N(muT("wday2:Fr")), I18N(muT("wday3:Fri")), I18N(muT("wdayF:Friday")) },
- { I18N(muT("wday2:Sa")), I18N(muT("wday3:Sat")), I18N(muT("wdayF:Saturday")) },
- { I18N(muT("wday2:Su")), I18N(muT("wday3:Sun")), I18N(muT("wdayF:Sunday")) },
+ static const TCHAR* szWDayName[][3] = {
+ { LPGENT("wday2:Mo"), LPGENT("wday3:Mon"), LPGENT("wdayF:Monday") },
+ { LPGENT("wday2:Tu"), LPGENT("wday3:Tue"), LPGENT("wdayF:Tuesday") },
+ { LPGENT("wday2:We"), LPGENT("wday3:Wed"), LPGENT("wdayF:Wednesday") },
+ { LPGENT("wday2:Th"), LPGENT("wday3:Thu"), LPGENT("wdayF:Thursday") },
+ { LPGENT("wday2:Fr"), LPGENT("wday3:Fri"), LPGENT("wdayF:Friday") },
+ { LPGENT("wday2:Sa"), LPGENT("wday3:Sat"), LPGENT("wdayF:Saturday") },
+ { LPGENT("wday2:Su"), LPGENT("wday3:Sun"), LPGENT("wdayF:Sunday") },
};
struct tm timeTM = *gmtime(reinterpret_cast<time_t*>(&timeValue));
ext::string strOut = strFormat;
- ext::string::size_type posOpen = strOut.find(muC('%'));
+ ext::string::size_type posOpen = strOut.find('%');
- while (posOpen != ext::string::npos)
- {
- ext::string::size_type posClose = strOut.find(muC('%'), posOpen + 1);
+ while (posOpen != ext::string::npos) {
+ ext::string::size_type posClose = strOut.find('%', posOpen + 1);
- if (posOpen != ext::string::npos)
- {
+ if (posOpen != ext::string::npos) {
ext::string strVar = strOut.substr(posOpen + 1, posClose - posOpen - 1);
ext::string strSubst;
// match variable and generate substitution
- if (strVar == muT("h"))
- {
+ if (strVar == _T("h")) {
strSubst = intToString(timeTM.tm_hour % 12 + (timeTM.tm_hour % 12 == 0 ? 12 : 0));
}
- else if (strVar == muT("hh"))
- {
+ else if (strVar == _T("hh")) {
strSubst = intToPadded(timeTM.tm_hour % 12 + (timeTM.tm_hour % 12 == 0 ? 12 : 0), 2);
}
- else if (strVar == muT("H"))
- {
+ else if (strVar == _T("H")) {
strSubst = intToString(timeTM.tm_hour);
}
- else if (strVar == muT("HH"))
- {
+ else if (strVar == _T("HH")) {
strSubst = intToPadded(timeTM.tm_hour, 2);
}
- else if (strVar == muT("m"))
- {
+ else if (strVar == _T("m")) {
strSubst = intToString(timeTM.tm_min);
}
- else if (strVar == muT("mm"))
- {
+ else if (strVar == _T("mm")) {
strSubst = intToPadded(timeTM.tm_min, 2);
}
- else if (strVar == muT("s"))
- {
+ else if (strVar == _T("s")) {
strSubst = intToString(timeTM.tm_sec);
}
- else if (strVar == muT("ss"))
- {
+ else if (strVar == _T("ss")) {
strSubst = intToPadded(timeTM.tm_sec, 2);
}
- else if (strVar == muT("tt"))
- {
- strSubst = timeTM.tm_hour / 12 ? i18n(muT("pm")) : i18n(muT("am"));
+ else if (strVar == _T("tt")) {
+ strSubst = timeTM.tm_hour / 12 ? TranslateT("pm") : TranslateT("am");
}
- else if (strVar == muT("TT"))
- {
- strSubst = timeTM.tm_hour / 12 ? i18n(muT("PM")) : i18n(muT("AM"));
+ else if (strVar == _T("TT")) {
+ strSubst = timeTM.tm_hour / 12 ? TranslateT("PM") : TranslateT("AM");
}
- else if (strVar == muT("yy"))
- {
+ else if (strVar == _T("yy")) {
strSubst = intToPadded((timeTM.tm_year + 1900) % 100, 2);
}
- else if (strVar == muT("yyyy"))
- {
+ else if (strVar == _T("yyyy")) {
strSubst = intToPadded(timeTM.tm_year + 1900, 4);
}
- else if (strVar == muT("M"))
- {
+ else if (strVar == _T("M")) {
strSubst = intToString(timeTM.tm_mon + 1);
}
- else if (strVar == muT("MM"))
- {
+ else if (strVar == _T("MM")) {
strSubst = intToPadded(timeTM.tm_mon + 1, 2);
}
- else if (strVar == muT("MMM"))
- {
- strSubst = stripPrefix(muT("month3:"), i18n(szMonthName[timeTM.tm_mon % 12][0]));
+ else if (strVar == _T("MMM")) {
+ strSubst = stripPrefix(_T("month3:"), TranslateTS(szMonthName[timeTM.tm_mon % 12][0]));
}
- else if (strVar == muT("MMMM"))
- {
- strSubst = stripPrefix(muT("monthF:"), i18n(szMonthName[timeTM.tm_mon % 12][1]));
+ else if (strVar == _T("MMMM")) {
+ strSubst = stripPrefix(_T("monthF:"), TranslateTS(szMonthName[timeTM.tm_mon % 12][1]));
}
- else if (strVar == muT("d"))
- {
+ else if (strVar == _T("d")) {
strSubst = intToString(timeTM.tm_mday);
}
- else if (strVar == muT("dd"))
- {
+ else if (strVar == _T("dd")) {
strSubst = intToPadded(timeTM.tm_mday, 2);
}
- else if (strVar == muT("ww"))
- {
- strSubst = stripPrefix(muT("wday2:"), i18n(szWDayName[(timeTM.tm_wday + 6) % 7][0]));
+ else if (strVar == _T("ww")) {
+ strSubst = stripPrefix(_T("wday2:"), TranslateTS(szWDayName[(timeTM.tm_wday + 6) % 7][0]));
}
- else if (strVar == muT("www"))
- {
- strSubst = stripPrefix(muT("wday3:"), i18n(szWDayName[(timeTM.tm_wday + 6) % 7][1]));
+ else if (strVar == _T("www")) {
+ strSubst = stripPrefix(_T("wday3:"), TranslateTS(szWDayName[(timeTM.tm_wday + 6) % 7][1]));
}
- else if (strVar == muT("wwww"))
- {
- strSubst = stripPrefix(muT("wdayF:"), i18n(szWDayName[(timeTM.tm_wday + 6) % 7][2]));
+ else if (strVar == _T("wwww")) {
+ strSubst = stripPrefix(_T("wdayF:"), TranslateTS(szWDayName[(timeTM.tm_wday + 6) % 7][2]));
}
- else if (strVar == muT("miranda_path"))
- {
+ else if (strVar == _T("miranda_path")) {
strSubst = getMirandaPath();
}
- else if (strVar == muT("profile_path"))
- {
+ else if (strVar == _T("profile_path")) {
strSubst = getProfilePath();
}
- else if (strVar == muT("profile_name"))
- {
+ else if (strVar == _T("profile_name")) {
strSubst = getProfileName();
}
- else if (strVar == muT("nick"))
- {
+ else if (strVar == _T("nick")) {
strSubst = szNick;
}
- else if (strVar == muT(""))
- {
- strSubst = muT("%");
+ else if (strVar == _T("")) {
+ strSubst = _T("%");
}
// perform actual substitution
- if (!strSubst.empty())
- {
+ if (!strSubst.empty()) {
strOut.replace(posOpen, posClose - posOpen + 1, strSubst);
posClose += strSubst.length() - strVar.length() - 2;
}
}
- else
- {
+ else {
break;
}
- posOpen = strOut.find(muC('%'), posClose + 1);
+ posOpen = strOut.find('%', posClose + 1);
}
return strOut;
@@ -397,7 +337,7 @@ namespace utils
ext::string toLowerCase(const ext::string& text)
{
int len = text.length();
- mu_text* buf = new mu_text[len + 1];
+ TCHAR* buf = new TCHAR[len + 1];
LCID lcid = GetUserDefaultLCID();
@@ -408,14 +348,14 @@ namespace utils
ext::string ret_str(buf, len);
delete[] buf;
-
+
return ret_str;
}
ext::string toUpperCase(const ext::string& text)
{
int len = text.length();
- mu_text* buf = new mu_text[len + 1];
+ TCHAR* buf = new TCHAR[len + 1];
LCID lcid = GetUserDefaultLCID();
@@ -426,30 +366,29 @@ namespace utils
ext::string ret_str(buf, len);
delete[] buf;
-
+
return ret_str;
}
DWORD dottedToVersion(ext::string version)
{
- union {
+ union
+ {
__int32 combined;
__int8 parts[4];
} res = { 0 };
int part = 3;
- while (!version.empty() && part >= 0)
- {
- ext::string::size_type dotPos = version.find(muT("."));
+ while (!version.empty() && part >= 0) {
+ ext::string::size_type dotPos = version.find(_T("."));
- if (dotPos == ext::string::npos)
- {
+ if (dotPos == ext::string::npos) {
dotPos = version.length();
}
res.parts[part--] = _ttoi(version.substr(0, dotPos).c_str());
-
+
version.erase(0, dotPos + 1);
}
@@ -458,11 +397,11 @@ namespace utils
ext::string versionToDotted(DWORD version)
{
- mu_text temp[16] = { 0 };
+ TCHAR temp[16] = { 0 };
ext::strfunc::sprintf(
temp,
- muT("%d.%d.%d.%d"),
+ _T("%d.%d.%d.%d"),
(version >> 24) & 0xFF,
(version >> 16) & 0xFF,
(version >> 8) & 0xFF,
@@ -471,13 +410,13 @@ namespace utils
return temp;
}
- ext::a::string convertWToA(const mu_wide* str, size_t len)
+ ext::a::string convertWToA(const WCHAR* str, size_t len)
{
- mu_ansi* buf = new mu_ansi[len + 1];
+ char* buf = new char[len + 1];
len = WideCharToMultiByte(CP_ACP, 0, str, len, buf, len, NULL, NULL);
- buf[len] = muC('\0');
+ buf[len] = '\0';
ext::a::string ret_str(buf, len);
@@ -486,195 +425,171 @@ namespace utils
return ret_str;
}
- ext::w::string convertAToW(const mu_ansi* str, size_t len)
+ ext::w::string convertAToW(const char* str, size_t len)
{
- mu_wide* buf = new mu_wide[len + 1];
+ WCHAR* buf = new WCHAR[len + 1];
len = MultiByteToWideChar(CP_ACP, 0, str, len, buf, len);
- buf[len] = muC('\0');
+ buf[len] = '\0';
ext::w::string ret_str(buf, len);
delete[] buf;
-
+
return ret_str;
}
- ext::a::string convertTToUTF8(const mu_text* str, size_t str_len)
+ ext::a::string convertTToUTF8(const TCHAR* str, size_t str_len)
{
-#if defined(MU_WIDE)
- const mu_wide* conv_str = str;
-#else // MU_WIDE
+#if defined(_UNICODE)
+ const WCHAR* conv_str = str;
+#else // _UNICODE
const ext::w::string conv_strX = convertAToW(str, str_len);
- const mu_wide* conv_str = conv_strX.c_str();
-#endif // MU_WIDE
+ const WCHAR* conv_str = conv_strX.c_str();
+#endif // _UNICODE
int len = 0;
upto_each_(i, str_len)
{
- mu_wide c = conv_str[i];
+ WCHAR c = conv_str[i];
- if (c <= 0x007F)
- {
+ if (c <= 0x007F) {
len++;
}
- else if (c <= 0x07FF)
- {
+ else if (c <= 0x07FF) {
len += 2;
}
- else
- {
+ else {
len += 3;
}
}
- ext::a::string out_str(len, muC('_'));
-
+ ext::a::string out_str(len, '_');
+
int pos = 0;
upto_each_(i, str_len)
{
- mu_wide c = conv_str[i];
+ WCHAR c = conv_str[i];
- if (c <= 0x007F)
- {
- out_str[pos++] = (unsigned char) c;
+ if (c <= 0x007F) {
+ out_str[pos++] = (unsigned char)c;
}
- else if (c <= 0x07FF)
- {
- out_str[pos++] = (unsigned char) 0xC0 | (c >> 6);
- out_str[pos++] = (unsigned char) 0x80 | (c & 0x3F);
+ else if (c <= 0x07FF) {
+ out_str[pos++] = (unsigned char)0xC0 | (c >> 6);
+ out_str[pos++] = (unsigned char)0x80 | (c & 0x3F);
}
- else
- {
- out_str[pos++] = (unsigned char) 0xE0 | (c >> 12);
- out_str[pos++] = (unsigned char) 0x80 | ((c >> 6) & 0x3F);
- out_str[pos++] = (unsigned char) 0x80 | (c & 0x3F);
+ else {
+ out_str[pos++] = (unsigned char)0xE0 | (c >> 12);
+ out_str[pos++] = (unsigned char)0x80 | ((c >> 6) & 0x3F);
+ out_str[pos++] = (unsigned char)0x80 | (c & 0x3F);
}
}
return out_str;
}
- ext::string convertUTF8ToT(const mu_ansi* str, size_t str_len)
+ ext::string convertUTF8ToT(const char* str, size_t str_len)
{
size_t len = 0, in_pos = 0;
- while (in_pos < str_len)
- {
- mu_ansi c = str[in_pos];
+ while (in_pos < str_len) {
+ char c = str[in_pos];
- if ((c & 0x80) == 0x00)
- {
+ if ((c & 0x80) == 0x00) {
in_pos++;
}
- else if ((c & 0xE0) == 0xC0)
- {
+ else if ((c & 0xE0) == 0xC0) {
in_pos += 2;
}
- else if ((c & 0xF0) == 0xE0)
- {
+ else if ((c & 0xF0) == 0xE0) {
in_pos += 3;
}
- else
- {
+ else {
in_pos++;
}
len++;
}
- ext::w::string out_str(len, muC('_'));
+ ext::w::string out_str(len, '_');
size_t out_pos = 0;
in_pos = 0;
- while (in_pos < str_len)
- {
- unsigned char c = (unsigned char) str[in_pos];
+ while (in_pos < str_len) {
+ unsigned char c = (unsigned char)str[in_pos];
- if ((c & 0x80) == 0x00)
- {
- out_str[out_pos] = (mu_wide) c;
+ if ((c & 0x80) == 0x00) {
+ out_str[out_pos] = (WCHAR)c;
in_pos++;
}
- else if ((c & 0xE0) == 0xC0)
- {
- out_str[out_pos] = (mu_wide) (((c & 0x1F) << 6) | ((unsigned char) str[in_pos + 1] & 0x3F));
+ else if ((c & 0xE0) == 0xC0) {
+ out_str[out_pos] = (WCHAR)(((c & 0x1F) << 6) | ((unsigned char)str[in_pos + 1] & 0x3F));
in_pos += 2;
}
- else if ((c & 0xF0) == 0xE0)
- {
- out_str[out_pos] = (mu_wide) (((c & 0x0F) << 12) | (((unsigned char) str[in_pos + 1] & 0x3F) << 6) | ((unsigned char) str[in_pos + 2] & 0x3F));
+ else if ((c & 0xF0) == 0xE0) {
+ out_str[out_pos] = (WCHAR)(((c & 0x0F) << 12) | (((unsigned char)str[in_pos + 1] & 0x3F) << 6) | ((unsigned char)str[in_pos + 2] & 0x3F));
in_pos += 3;
}
- else
- {
+ else {
in_pos++;
}
out_pos++;
}
-#if defined(MU_WIDE)
+#if defined(_UNICODE)
return out_str;
-#else // MU_WIDE
+#else // _UNICODE
return convertWToA(out_str.c_str(), out_str.length());
-#endif // MU_WIDE
+#endif // _UNICODE
}
- size_t rawUTF8Encode(const mu_wide* pIn, size_t lenIn, mu_ansi* pOut)
+ size_t rawUTF8Encode(const WCHAR* pIn, size_t lenIn, char* pOut)
{
- mu_ansi* pOutBegin = pOut;
+ char* pOutBegin = pOut;
upto_each_(i, lenIn)
{
- mu_wide c = pIn[i];
+ WCHAR c = pIn[i];
- if (c <= 0x007F)
- {
- *pOut++ = (unsigned char) c;
+ if (c <= 0x007F) {
+ *pOut++ = (unsigned char)c;
}
- else if (c <= 0x07FF)
- {
- *pOut++ = (unsigned char) 0xC0 | (c >> 6);
- *pOut++ = (unsigned char) 0x80 | (c & 0x3F);
+ else if (c <= 0x07FF) {
+ *pOut++ = (unsigned char)0xC0 | (c >> 6);
+ *pOut++ = (unsigned char)0x80 | (c & 0x3F);
}
- else
- {
- *pOut++ = (unsigned char) 0xE0 | (c >> 12);
- *pOut++ = (unsigned char) 0x80 | ((c >> 6) & 0x3F);
- *pOut++ = (unsigned char) 0x80 | (c & 0x3F);
+ else {
+ *pOut++ = (unsigned char)0xE0 | (c >> 12);
+ *pOut++ = (unsigned char)0x80 | ((c >> 6) & 0x3F);
+ *pOut++ = (unsigned char)0x80 | (c & 0x3F);
}
}
return (pOut - pOutBegin);
}
- size_t getUTF8Len(const mu_ansi* str)
+ size_t getUTF8Len(const char* str)
{
size_t len = 0, in_pos = 0, str_len = ext::a::strfunc::len(str);
- while (in_pos < str_len)
- {
- mu_ansi c = str[in_pos];
+ while (in_pos < str_len) {
+ char c = str[in_pos];
- if ((c & 0x80) == 0x00)
- {
+ if ((c & 0x80) == 0x00) {
in_pos++;
}
- else if ((c & 0xE0) == 0xC0)
- {
+ else if ((c & 0xE0) == 0xC0) {
in_pos += 2;
}
- else if ((c & 0xF0) == 0xE0)
- {
+ else if ((c & 0xF0) == 0xE0) {
in_pos += 3;
}
- else
- {
+ else {
in_pos++;
}
@@ -689,14 +604,12 @@ namespace utils
WIN32_FIND_DATA wfd;
HANDLE hFind = FindFirstFile(fileName.c_str(), &wfd);
- if (hFind != INVALID_HANDLE_VALUE)
- {
+ if (hFind != INVALID_HANDLE_VALUE) {
FindClose(hFind);
return true;
}
- else
- {
+ else {
return false;
}
}
@@ -704,16 +617,14 @@ namespace utils
bool pathExists(const ext::string& path)
{
WIN32_FIND_DATA wfd;
- HANDLE hFind = FindFirstFile((path + muT(".")).c_str(), &wfd);
+ HANDLE hFind = FindFirstFile((path + _T(".")).c_str(), &wfd);
- if (hFind != INVALID_HANDLE_VALUE)
- {
+ if (hFind != INVALID_HANDLE_VALUE) {
FindClose(hFind);
return (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
}
- else
- {
+ else {
return false;
}
}
@@ -721,12 +632,8 @@ namespace utils
bool isRelative(const ext::string& fileName)
{
if (fileName.length() > 2)
- {
- if ((fileName[1] == muC(':') && fileName[2] == muC('\\')) || (fileName[0] == muC('\\') && fileName[1] == muC('\\')))
- {
+ if ((fileName[1] == ':' && fileName[2] == '\\') || (fileName[0] == '\\' && fileName[1] == '\\'))
return false;
- }
- }
return true;
}
@@ -734,55 +641,49 @@ namespace utils
bool isValidFilePart(ext::string filePart)
{
// check for disallowed chars
- if (filePart.find_first_of(muT("<>:\"/\\|?*")) != ext::string::npos)
- {
+ if (filePart.find_first_of(_T("<>:\"/\\|?*")) != ext::string::npos)
return false;
- }
// check for dots only
- if (filePart.find_first_not_of(muC('.')) == ext::string::npos)
- {
+ if (filePart.find_first_not_of('.') == ext::string::npos)
return false;
- }
// check for disallowed names
- static const mu_text* disallowedNames[] = {
- muT("clock$"),
- muT("aux"),
- muT("con"),
- muT("nul"),
- muT("prn"),
- muT("com1"),
- muT("com2"),
- muT("com3"),
- muT("com4"),
- muT("com5"),
- muT("com6"),
- muT("com7"),
- muT("com8"),
- muT("com9"),
- muT("lpt1"),
- muT("lpt2"),
- muT("lpt3"),
- muT("lpt4"),
- muT("lpt5"),
- muT("lpt6"),
- muT("lpt7"),
- muT("lpt8"),
- muT("lpt9")
+ static const TCHAR* disallowedNames[] = {
+ _T("clock$"),
+ _T("aux"),
+ _T("con"),
+ _T("nul"),
+ _T("prn"),
+ _T("com1"),
+ _T("com2"),
+ _T("com3"),
+ _T("com4"),
+ _T("com5"),
+ _T("com6"),
+ _T("com7"),
+ _T("com8"),
+ _T("com9"),
+ _T("lpt1"),
+ _T("lpt2"),
+ _T("lpt3"),
+ _T("lpt4"),
+ _T("lpt5"),
+ _T("lpt6"),
+ _T("lpt7"),
+ _T("lpt8"),
+ _T("lpt9")
};
- ext::string::size_type pos = filePart.find(muC('.'));
+ ext::string::size_type pos = filePart.find('.');
- if (pos != ext::string::npos)
- {
+ if (pos != ext::string::npos) {
filePart.erase(pos);
}
array_each_(i, disallowedNames)
{
- if (filePart == disallowedNames[i])
- {
+ if (filePart == disallowedNames[i]) {
return false;
}
}
@@ -793,14 +694,12 @@ namespace utils
bool isValidFile(const ext::string& fileName)
{
// find the last backslash to extract file name
- ext::string::size_type pos = fileName.rfind(muC('\\'));
+ ext::string::size_type pos = fileName.rfind('\\');
- if (pos == ext::string::npos)
- {
+ if (pos == ext::string::npos) {
pos = 0;
}
- else
- {
+ else {
// is a path, if ends with a backslash
if (pos == fileName.length() - 1)
return false;
@@ -814,28 +713,24 @@ namespace utils
ext::string extractPath(const ext::string& fileName)
{
- ext::string::size_type pos = fileName.rfind(muC('\\'));
+ ext::string::size_type pos = fileName.rfind('\\');
- if (pos == ext::string::npos)
- {
- return muT("");
+ if (pos == ext::string::npos) {
+ return _T("");
}
- else
- {
+ else {
return fileName.substr(0, pos + 1);
}
}
ext::string extractFile(const ext::string& fileName)
{
- ext::string::size_type pos = fileName.rfind(muC('\\'));
+ ext::string::size_type pos = fileName.rfind('\\');
- if (pos == ext::string::npos)
- {
+ if (pos == ext::string::npos) {
return fileName;
}
- else
- {
+ else {
return fileName.substr(pos + 1);
}
}
@@ -846,37 +741,32 @@ namespace utils
std::stack<ext::string> subDirs;
// create stack of missing subdirs and validate them
- while (curPath.length() > 3 && !pathExists(curPath))
- {
- ext::string::size_type pos = curPath.rfind(muC('\\'), curPath.length() - 2);
+ while (curPath.length() > 3 && !pathExists(curPath)) {
+ ext::string::size_type pos = curPath.rfind('\\', curPath.length() - 2);
- if (pos == ext::string::npos)
- {
+ if (pos == ext::string::npos) {
pos = -1;
}
subDirs.push(curPath.substr(pos + 1, curPath.length() - pos - 2));
curPath.erase(pos + 1);
- if (!isValidFilePart(subDirs.top()))
- {
+ if (!isValidFilePart(subDirs.top())) {
return false;
}
}
// try to create subdirs in reverse order
- while (!subDirs.empty())
- {
+ while (!subDirs.empty()) {
const ext::string& curDir = subDirs.top();
curPath += curDir;
- if (!CreateDirectory(curPath.c_str(), NULL))
- {
+ if (!CreateDirectory(curPath.c_str(), NULL)) {
return false;
}
- curPath += muT("\\");
+ curPath += _T("\\");
subDirs.pop();
}
@@ -886,9 +776,9 @@ namespace utils
ext::string colorToHTML(COLORREF crColor)
{
- static const mu_text hexDigits[] = muT("0123456789ABCDEF");
+ static const TCHAR hexDigits[] = _T("0123456789ABCDEF");
- ext::string htmlColor(7, muC('#'));
+ ext::string htmlColor(7, '#');
upto_each_(i, 3)
{
@@ -906,7 +796,7 @@ namespace utils
struct rgb { int r, g, b; };
rgb fromRGB = { GetRValue(fromColor), GetGValue(fromColor), GetBValue(fromColor) };
- rgb toRGB = { GetRValue(toColor), GetGValue(toColor), GetBValue(toColor) };
+ rgb toRGB = { GetRValue(toColor), GetGValue(toColor), GetBValue(toColor) };
upto_each_(i, 256)
{
@@ -919,28 +809,26 @@ namespace utils
void ensureRange(int& value, int min, int max, int fallback)
{
- if (value < min || value > max)
- {
+ if (value < min || value > max) {
value = fallback;
}
}
void ensureRange(unsigned int& value, unsigned int min, unsigned int max, unsigned int fallback)
{
- if (value < min || value > max)
- {
+ if (value < min || value > max) {
value = fallback;
}
}
ext::string getGUID()
{
- static const mu_text hexDigits[] = muT("0123456789ABCDEF");
+ static const TCHAR hexDigits[] = _T("0123456789ABCDEF");
GUID guid;
CoCreateGuid(&guid);
- ext::string strGUID(2 * sizeof(guid), muC('_'));
+ ext::string strGUID(2 * sizeof(guid), '_');
upto_each_(i, sizeof(guid))
{
@@ -955,15 +843,13 @@ namespace utils
void centerDialog(HWND hDlg, HWND hParent /* = NULL */)
{
- if (!hParent)
- {
+ if (!hParent) {
hParent = GetParent(hDlg);
}
RECT rDlg, rParent;
- if (GetWindowRect(hParent, &rParent) && GetWindowRect(hDlg, &rDlg))
- {
+ if (GetWindowRect(hParent, &rParent) && GetWindowRect(hDlg, &rDlg)) {
SetWindowPos(
hDlg,
0,
@@ -973,8 +859,7 @@ namespace utils
0,
SWP_NOSIZE | SWP_NOZORDER);
}
- else if (GetWindowRect(hDlg, &rDlg))
- {
+ else if (GetWindowRect(hDlg, &rDlg)) {
SetWindowPos(
hDlg,
0,
@@ -1007,11 +892,10 @@ namespace utils
{
static ext::string strMirandaPath;
- if (strMirandaPath.empty())
- {
- mu_text szPath[MAX_PATH] = { 0 };
+ if (strMirandaPath.empty()) {
+ TCHAR szPath[MAX_PATH] = { 0 };
- mu::utils::pathToAbsolute(muT("x"), szPath);
+ mu::utils::pathToAbsolute(_T("x"), szPath);
strMirandaPath = extractPath(szPath);
}
@@ -1022,16 +906,15 @@ namespace utils
{
static ext::string strProfilePath;
- if (strProfilePath.empty())
- {
- mu_text szPath[MAX_PATH] = { 0 };
+ if (strProfilePath.empty()) {
+ TCHAR szPath[MAX_PATH] = { 0 };
mu::db::getProfilePath(MAX_PATH, szPath);
strProfilePath = szPath;
- if (strProfilePath.empty() || strProfilePath[strProfilePath.length() - 1] != muC('\\'))
+ if (strProfilePath.empty() || strProfilePath[strProfilePath.length() - 1] != '\\')
{
- strProfilePath += muT("\\");
+ strProfilePath += _T("\\");
}
}
@@ -1042,17 +925,15 @@ namespace utils
{
static ext::string strProfileName;
- if (strProfileName.empty())
- {
- mu_text szName[MAX_PATH] = { 0 };
+ if (strProfileName.empty()) {
+ TCHAR szName[MAX_PATH] = { 0 };
mu::db::getProfileName(MAX_PATH, szName);
strProfileName = szName;
- ext::string::size_type posDot = strProfileName.rfind(muC('.'));
+ ext::string::size_type posDot = strProfileName.rfind('.');
- if (posDot != ext::string::npos && posDot != 0)
- {
+ if (posDot != ext::string::npos && posDot != 0) {
strProfileName.erase(posDot);
}
}
@@ -1066,8 +947,8 @@ namespace utils
*/
OS::OS()
- : m_bIsXPPlus(false),
- m_ImageListColor(ILC_COLORDDB) // MEMO: maybe change this to ILC_COLOR{8,16,24}
+: m_bIsXPPlus(false),
+m_ImageListColor(ILC_COLORDDB) // MEMO: maybe change this to ILC_COLOR{8,16,24}
{
m_SmIcon.cx = 16; // GetSystemMetrics(SM_CXSMICON);
m_SmIcon.cy = 16; // GetSystemMetrics(SM_CYSMICON);
@@ -1076,12 +957,10 @@ OS::OS()
osvi.dwOSVersionInfoSize = sizeof(osvi);
- if (GetVersionEx(&osvi))
- {
+ if (GetVersionEx(&osvi)) {
m_bIsXPPlus = ((osvi.dwMajorVersion == 5 && osvi.dwMinorVersion >= 1) || osvi.dwMajorVersion >= 6);
- if (m_bIsXPPlus)
- {
+ if (m_bIsXPPlus) {
m_ImageListColor = ILC_COLOR32;
}
}
@@ -1095,11 +974,8 @@ OS OS::m_Data;
void Locale::init()
{
- setlocale(LC_ALL, muA(""));
- // setlocale(LC_ALL, muA("French_France"));
- // setlocale(LC_ALL, muA("English_USA"));
- // setlocale(LC_ALL, muA("Russian_Russia"));
-
+ setlocale(LC_ALL, "");
+
m_Data.m_ThousandSep = utils::fromA(localeconv()->thousands_sep).c_str()[0];
m_Data.m_DecimalPoint = utils::fromA(localeconv()->decimal_point).c_str()[0];
m_Data.m_Grouping = localeconv()->grouping;
@@ -1111,25 +987,19 @@ Locale Locale::m_Data;
* RTFFilter
*/
-RTFFilter::RTFFilter()
- : m_hRTFConv(NULL)
+RTFFilter::RTFFilter() :
+ m_hRTFConv(NULL)
{
}
void RTFFilter::init()
{
- if (!(m_Data.m_hRTFConv = LoadLibrary(muT("rtfconv.dll"))))
- {
- if (!(m_Data.m_hRTFConv = LoadLibrary(muT("plugins\\rtfconv.dll"))))
- {
+ if (!(m_Data.m_hRTFConv = LoadLibrary(_T("rtfconv.dll"))))
+ if (!(m_Data.m_hRTFConv = LoadLibrary(_T("plugins\\rtfconv.dll"))))
return;
- }
- }
- if (!(m_Data.m_RTFConvString = reinterpret_cast<RTFCONVSTRING>(GetProcAddress(m_Data.m_hRTFConv, muA("RtfconvString")))))
- {
+ if (!(m_Data.m_RTFConvString = reinterpret_cast<RTFCONVSTRING>(GetProcAddress(m_Data.m_hRTFConv, "RtfconvString")))) {
FreeLibrary(m_Data.m_hRTFConv);
-
m_Data.m_hRTFConv = NULL;
}
@@ -1138,8 +1008,7 @@ void RTFFilter::init()
void RTFFilter::uninit()
{
- if (m_Data.m_hRTFConv)
- {
+ if (m_Data.m_hRTFConv) {
DeleteCriticalSection(&m_Data.m_RTFConvCS);
FreeLibrary(m_Data.m_hRTFConv);
@@ -1153,49 +1022,45 @@ ext::t::string RTFFilter::filter(const ext::t::string& str)
// protect, because library is not thread-safe
EnterCriticalSection(&m_Data.m_RTFConvCS);
-#if defined(MU_WIDE)
+#if defined(_UNICODE)
const ext::a::string strA = utils::toA(str);
-#else // MU_WIDE
+#else // _UNICODE
const ext::a::string& strA = str;
-#endif // MU_WIDE
+#endif // _UNICODE
intptr_t len = m_Data.m_RTFConvString(
strA.c_str(),
NULL,
0,
- MU_DO_BOTH(GetACP(), CP_UNICODE),
- CONVMODE_USE_SYSTEM_TABLE | MU_DO_BOTH(0, CONVMODE_NO_OUTPUT_BOM),
+ CP_UNICODE,
+ CONVMODE_USE_SYSTEM_TABLE | CONVMODE_NO_OUTPUT_BOM,
0);
- if (len == -1)
- {
+ if (len == -1) {
// someting went wrong, maybe it's not a real RTF string
LeaveCriticalSection(&m_Data.m_RTFConvCS);
-
return str;
}
- mu_text* out_buf = new mu_text[len / sizeof(mu_text)];
+ TCHAR* out_buf = new TCHAR[len / sizeof(TCHAR)];
intptr_t res = m_Data.m_RTFConvString(
strA.c_str(),
out_buf,
0,
- MU_DO_BOTH(GetACP(), CP_UNICODE),
- CONVMODE_USE_SYSTEM_TABLE | MU_DO_BOTH(0, CONVMODE_NO_OUTPUT_BOM),
+ CP_UNICODE,
+ CONVMODE_USE_SYSTEM_TABLE | CONVMODE_NO_OUTPUT_BOM,
len);
- if (res == -1)
- {
+ if (res == -1) {
// someting went wrong, maybe it's not a real RTF string
delete[] out_buf;
LeaveCriticalSection(&m_Data.m_RTFConvCS);
-
return str;
}
- ext::t::string out_str(out_buf, res / sizeof(mu_text) - 1);
+ ext::t::string out_str(out_buf, res / sizeof(TCHAR)-1);
delete[] out_buf;
LeaveCriticalSection(&m_Data.m_RTFConvCS);
diff --git a/plugins/HistoryStats/src/utils.h b/plugins/HistoryStats/src/utils.h
index aa2e5a57a0..49cab7f9be 100644
--- a/plugins/HistoryStats/src/utils.h
+++ b/plugins/HistoryStats/src/utils.h
@@ -7,14 +7,14 @@
namespace utils
{
// time formatting
- ext::string timestampToString(DWORD value, const mu_text* format);
- ext::string tmStructToString(const tm& value, const mu_text* format);
- inline ext::string timestampToDateTime(DWORD value) { return timestampToString(value, muT("%c")); }
- inline ext::string timestampToDate(DWORD value) { return timestampToString(value, muT("%x")); }
- inline ext::string timestampToTime(DWORD value) { return timestampToString(value, muT("%X")); }
+ ext::string timestampToString(DWORD value, const TCHAR* format);
+ ext::string tmStructToString(const tm& value, const TCHAR* format);
+ inline ext::string timestampToDateTime(DWORD value) { return timestampToString(value, _T("%c")); }
+ inline ext::string timestampToDate(DWORD value) { return timestampToString(value, _T("%x")); }
+ inline ext::string timestampToTime(DWORD value) { return timestampToString(value, _T("%X")); }
ext::string durationToString(DWORD value);
DWORD parseDate(const ext::string& date);
- inline ext::string formatDate(DWORD dwTimestamp) { return timestampToString(dwTimestamp, muT("%Y-%m-%d")); }
+ inline ext::string formatDate(DWORD dwTimestamp) { return timestampToString(dwTimestamp, _T("%Y-%m-%d")); }
// number formatting
ext::string intToString(int value);
@@ -27,12 +27,12 @@ namespace utils
ext::string ratioToPercent(int numerator, int denominator);
// text conversion
- void replaceAllInPlace(ext::string& text, const mu_text* find, const mu_text* replace);
+ void replaceAllInPlace(ext::string& text, const TCHAR* find, const TCHAR* replace);
void htmlEscapeInPlace(ext::string& text);
- inline ext::string replaceAll(ext::string text, const mu_text* find, const mu_text* replace) { replaceAllInPlace(text, find, replace); return text; }
+ inline ext::string replaceAll(ext::string text, const TCHAR* find, const TCHAR* replace) { replaceAllInPlace(text, find, replace); return text; }
inline ext::string htmlEscape(ext::string text) { htmlEscapeInPlace(text); return text; }
- const mu_text* stripPrefix(const mu_text* szPrefix, const mu_text* szText);
- ext::string replaceVariables(const ext::string& strFormat, DWORD timeValue, const mu_text* szNick = muT(""));
+ const TCHAR* stripPrefix(const TCHAR* szPrefix, const TCHAR* szText);
+ ext::string replaceVariables(const ext::string& strFormat, DWORD timeValue, const TCHAR* szNick = _T(""));
// case conversion
ext::string toLowerCase(const ext::string& text);
@@ -46,24 +46,24 @@ namespace utils
ext::string versionToDotted(DWORD version);
// character conversion (wide, ansi, utf8)
- ext::a::string convertWToA(const mu_wide* str, size_t len);
- ext::w::string convertAToW(const mu_ansi* str, size_t len);
- ext::a::string convertTToUTF8(const mu_text* str, size_t str_len);
- ext::string convertUTF8ToT(const mu_ansi* str, size_t str_len);
- size_t rawUTF8Encode(const mu_wide* pIn, size_t lenIn, mu_ansi* pOut);
- size_t getUTF8Len(const mu_ansi* str);
+ ext::a::string convertWToA(const WCHAR* str, size_t len);
+ ext::w::string convertAToW(const char* str, size_t len);
+ ext::a::string convertTToUTF8(const TCHAR* str, size_t str_len);
+ ext::string convertUTF8ToT(const char* str, size_t str_len);
+ size_t rawUTF8Encode(const WCHAR* pIn, size_t lenIn, char* pOut);
+ size_t getUTF8Len(const char* str);
// character conversion (convenience functions)
- inline ext::a::string toA(const mu_text* str) { return MU_DO_BOTH(str, convertWToA(str, ext::strfunc::len(str))); }
- inline ext::w::string toW(const mu_text* str) { return MU_DO_BOTH(convertAToW(str, ext::strfunc::len(str)), str); }
- inline ext::string fromA(const mu_ansi* str) { return MU_DO_BOTH(str, convertAToW(str, ext::a::strfunc::len(str))); }
- inline ext::string fromW(const mu_wide* str) { return MU_DO_BOTH(convertWToA(str, ext::w::strfunc::len(str)), str); }
- inline ext::a::string toA(const ext::string& str) { return MU_DO_BOTH(str, convertWToA(str.c_str(), str.length())); }
- inline ext::w::string toW(const ext::string& str) { return MU_DO_BOTH(convertAToW(str.c_str(), str.length()), str); }
- inline ext::string fromA(const ext::a::string& str) { return MU_DO_BOTH(str, convertAToW(str.c_str(), str.length())); }
- inline ext::string fromW(const ext::w::string& str) { return MU_DO_BOTH(convertWToA(str.c_str(), str.length()), str); }
- inline ext::a::string toUTF8(const mu_text* str) { return convertTToUTF8(str, ext::strfunc::len(str)); }
- inline ext::string fromUTF8(const mu_ansi* str) { return convertUTF8ToT(str, ext::a::strfunc::len(str)); }
+ inline ext::a::string toA(const TCHAR* str) { return convertWToA(str, ext::strfunc::len(str)); }
+ inline ext::w::string toW(const TCHAR* str) { return str; }
+ inline ext::string fromA(const char* str) { return convertAToW(str, ext::a::strfunc::len(str)); }
+ inline ext::string fromW(const WCHAR* str) { return str; }
+ inline ext::a::string toA(const ext::string& str) { return convertWToA(str.c_str(), str.length()); }
+ inline ext::w::string toW(const ext::string& str) { return str; }
+ inline ext::string fromA(const ext::a::string& str) { return convertAToW(str.c_str(), str.length()); }
+ inline ext::string fromW(const ext::w::string& str) { return str; }
+ inline ext::a::string toUTF8(const TCHAR* str) { return convertTToUTF8(str, ext::strfunc::len(str)); }
+ inline ext::string fromUTF8(const char* str) { return convertUTF8ToT(str, ext::a::strfunc::len(str)); }
inline ext::a::string toUTF8(const ext::string& str) { return convertTToUTF8(str.c_str(), str.length()); }
inline ext::string fromUTF8(const ext::a::string& str) { return convertUTF8ToT(str.c_str(), str.length()); }
@@ -128,8 +128,8 @@ class Locale
: private pattern::NotCopyable<Locale>
{
private:
- mu_text m_DecimalPoint;
- mu_text m_ThousandSep;
+ TCHAR m_DecimalPoint;
+ TCHAR m_ThousandSep;
ext::a::string m_Grouping;
private:
@@ -140,8 +140,8 @@ private:
public:
static void init();
- static mu_text decimalPoint() { return m_Data.m_DecimalPoint; }
- static mu_text thousandSep() { return m_Data.m_ThousandSep; }
+ static TCHAR decimalPoint() { return m_Data.m_DecimalPoint; }
+ static TCHAR thousandSep() { return m_Data.m_ThousandSep; }
static const char* grouping() { return m_Data.m_Grouping.c_str(); }
};
diff --git a/plugins/HistoryStats/src/version.h b/plugins/HistoryStats/src/version.h
index 28c23a27c4..f4c0e313e5 100644
--- a/plugins/HistoryStats/src/version.h
+++ b/plugins/HistoryStats/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
-#define __MINOR_VERSION 1
-#define __RELEASE_NUM 5
-#define __BUILD_NUM 3
+#define __MINOR_VERSION 2
+#define __RELEASE_NUM 0
+#define __BUILD_NUM 1
#include <stdver.h>