summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tipper/common.h1
-rw-r--r--tipper/popwin.cpp7
-rw-r--r--tipper/subst.cpp11
-rw-r--r--tipper/tipper.cpp42
-rw-r--r--tipper/tipper.mdsp2
-rw-r--r--tipper/translations.cpp5
-rw-r--r--tipper/translations.h2
-rw-r--r--tipper/version.h2
8 files changed, 41 insertions, 31 deletions
diff --git a/tipper/common.h b/tipper/common.h
index 7cf7690..bc11b16 100644
--- a/tipper/common.h
+++ b/tipper/common.h
@@ -78,5 +78,6 @@ extern HFONT hFontTitle, hFontLabels, hFontValues;
extern COLORREF colTitle, colLabels, colBg, colValues;
extern int code_page;
+extern bool unicode_system;
extern struct MM_INTERFACE memoryManagerInterface;
diff --git a/tipper/popwin.cpp b/tipper/popwin.cpp
index 5110ae8..a092663 100644
--- a/tipper/popwin.cpp
+++ b/tipper/popwin.cpp
@@ -207,11 +207,16 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
// don't use stored status message
DBDeleteContactSetting(pwd->hContact, MODULE, "TempStatusMsg");
- {
+ if(unicode_system) {
TCHAR *stzCDN = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)pwd->hContact, GCDNF_TCHAR);
if(stzCDN) _tcsncpy(pwd->swzTitle, stzCDN, TITLE_TEXT_LEN);
else _tcscpy(pwd->swzTitle, TranslateT("(Unknown)"));
+ } else {
+ char *szCDN = (char *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)pwd->hContact, 0);
+
+ if(szCDN) a2t(szCDN, pwd->swzTitle, TITLE_TEXT_LEN);
+ else _tcscpy(pwd->swzTitle, TranslateT("(Unknown)"));
}
SendMessage(hwnd, PUM_REFRESH_VALUES, 0, 0);
diff --git a/tipper/subst.cpp b/tipper/subst.cpp
index 683c87a..92f35ef 100644
--- a/tipper/subst.cpp
+++ b/tipper/subst.cpp
@@ -91,7 +91,12 @@ bool uid(HANDLE hContact, TCHAR *buff, int bufflen) {
_ltot(ci.dVal, buff, 10);
break;
case CNFT_ASCIIZ:
- a2t((char *)ci.pszVal, buff, bufflen); // what's up with TCHAR in CONTACTINFO?!?!?
+ if(unicode_system) {
+ //w2t((char *)ci.pszVal, buff, bufflen); // what's up with TCHAR in CONTACTINFO?!?!?
+ w2t((wchar_t *)ci.pszVal, buff, bufflen);
+ } else {
+ a2t((char *)ci.pszVal, buff, bufflen);
+ }
break;
default:
return false;
@@ -142,9 +147,9 @@ TCHAR *GetStatusMessageText(HANDLE hContact) {
TCHAR *ret = 0;
DBVARIANT dbv;
if(!DBGetContactSettingTString(hContact, MODULE, "TempStatusMsg", &dbv)) {
- if(_tcslen(dbv.ptszVal)) {
+ if(dbv.ptszVal && dbv.ptszVal[0]) {
ret = _tcsdup(dbv.ptszVal);
- StripBBCodesInPlace(ret); // todo - fix for ansi build
+ StripBBCodesInPlace(ret);
} else CallContactService(hContact, PSS_GETAWAYMSG, 0, 0);
DBFreeVariant(&dbv);
/*
diff --git a/tipper/tipper.cpp b/tipper/tipper.cpp
index cc03ca9..7d45727 100644
--- a/tipper/tipper.cpp
+++ b/tipper/tipper.cpp
@@ -12,6 +12,8 @@
HMODULE hInst = 0;
HANDLE mainThread = 0;
+bool unicode_system;
+
FontID font_id_title = {0}, font_id_labels = {0}, font_id_values = {0};
ColourID colour_id_bg = {0}, colour_id_border = {0}, colour_id_divider = {0}, colour_id_sidebar = {0};
FontIDW font_id_titlew = {0}, font_id_labelsw = {0}, font_id_valuesw = {0};
@@ -58,33 +60,34 @@ extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVers
}
int ReloadFont(WPARAM wParam, LPARAM lParam) {
- LOGFONT log_font;
if(ServiceExists(MS_FONT_GETW)) {
+ LOGFONTW log_font;
if(hFontTitle) DeleteObject(hFontTitle);
options.title_col = CallService(MS_FONT_GETW, (WPARAM)&font_id_titlew, (LPARAM)&log_font);
- hFontTitle = CreateFontIndirect(&log_font);
+ hFontTitle = CreateFontIndirectW(&log_font);
if(hFontLabels) DeleteObject(hFontLabels);
options.label_col = CallService(MS_FONT_GETW, (WPARAM)&font_id_labelsw, (LPARAM)&log_font);
- hFontLabels = CreateFontIndirect(&log_font);
+ hFontLabels = CreateFontIndirectW(&log_font);
if(hFontValues) DeleteObject(hFontValues);
options.value_col = CallService(MS_FONT_GETW, (WPARAM)&font_id_valuesw, (LPARAM)&log_font);
- hFontValues = CreateFontIndirect(&log_font);
+ hFontValues = CreateFontIndirectW(&log_font);
options.bg_col = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_bgw, 0);
options.border_col = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_borderw, 0);
options.sidebar_col = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_sidebarw, 0);
options.div_col = CallService(MS_COLOUR_GETW, (WPARAM)&colour_id_dividerw, 0);
} else {
+ LOGFONTA log_font;
if(hFontTitle) DeleteObject(hFontTitle);
options.title_col = CallService(MS_FONT_GET, (WPARAM)&font_id_title, (LPARAM)&log_font);
- hFontTitle = CreateFontIndirect(&log_font);
+ hFontTitle = CreateFontIndirectA(&log_font);
if(hFontLabels) DeleteObject(hFontLabels);
options.label_col = CallService(MS_FONT_GET, (WPARAM)&font_id_labels, (LPARAM)&log_font);
- hFontLabels = CreateFontIndirect(&log_font);
+ hFontLabels = CreateFontIndirectA(&log_font);
if(hFontValues) DeleteObject(hFontValues);
options.value_col = CallService(MS_FONT_GET, (WPARAM)&font_id_values, (LPARAM)&log_font);
- hFontValues = CreateFontIndirect(&log_font);
+ hFontValues = CreateFontIndirectA(&log_font);
options.bg_col = CallService(MS_COLOUR_GET, (WPARAM)&colour_id_bg, 0);
options.border_col = CallService(MS_COLOUR_GET, (WPARAM)&colour_id_border, 0);
@@ -201,16 +204,16 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
colour_id_sidebarw.defcolour = RGB(192, 192, 192);
colour_id_sidebarw.order = 0;
- CallService(MS_COLOUR_REGISTERT, (WPARAM)&colour_id_bgw, 0);
- CallService(MS_COLOUR_REGISTERT, (WPARAM)&colour_id_borderw, 0);
- CallService(MS_COLOUR_REGISTERT, (WPARAM)&colour_id_dividerw, 0);
- CallService(MS_COLOUR_REGISTERT, (WPARAM)&colour_id_sidebarw, 0);
+ CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_bgw, 0);
+ CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_borderw, 0);
+ CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_dividerw, 0);
+ CallService(MS_COLOUR_REGISTERW, (WPARAM)&colour_id_sidebarw, 0);
ReloadFont(0, 0);
HookEvent(ME_FONT_RELOAD, ReloadFont);
} else if(ServiceExists(MS_FONT_REGISTER)) {
- font_id_title.cbSize = sizeof(FontIDW);
+ font_id_title.cbSize = sizeof(FontID);
font_id_title.flags = FIDF_ALLOWEFFECTS;
t2a(TranslateT("Tooltips"), font_id_title.group, 64);
t2a(TranslateT("Title"), font_id_title.name, 64);
@@ -224,7 +227,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
font_id_title.deffontsettings.colour = RGB(255, 0, 0);
font_id_title.flags |= FIDF_DEFAULTVALID;
- font_id_labels.cbSize = sizeof(FontIDW);
+ font_id_labels.cbSize = sizeof(FontID);
font_id_labels.flags = FIDF_ALLOWEFFECTS;
t2a(TranslateT("Tooltips"), font_id_labels.group, 64);
t2a(TranslateT("Labels"), font_id_labels.name, 64);
@@ -238,7 +241,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
font_id_labels.deffontsettings.colour = RGB(128, 128, 128);
font_id_labels.flags |= FIDF_DEFAULTVALID;
- font_id_values.cbSize = sizeof(FontIDW);
+ font_id_values.cbSize = sizeof(FontID);
font_id_values.flags = FIDF_ALLOWEFFECTS;
t2a(TranslateT("Tooltips"), font_id_values.group, 64);
t2a(TranslateT("Values"), font_id_values.name, 64);
@@ -256,7 +259,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
CallService(MS_FONT_REGISTER, (WPARAM)&font_id_labels, 0);
CallService(MS_FONT_REGISTER, (WPARAM)&font_id_values, 0);
- colour_id_bg.cbSize = sizeof(ColourIDW);
+ colour_id_bg.cbSize = sizeof(ColourID);
t2a(TranslateT("Tooltips"), colour_id_bg.group, 64);
t2a(TranslateT("Background"), colour_id_bg.name, 64);
strcpy(colour_id_bg.dbSettingsGroup, MODULE);
@@ -264,7 +267,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
colour_id_bg.defcolour = RGB(219, 219, 219);
colour_id_bg.order = 0;
- colour_id_border.cbSize = sizeof(ColourIDW);
+ colour_id_border.cbSize = sizeof(ColourID);
t2a(TranslateT("Tooltips"), colour_id_border.group, 64);
t2a(TranslateT("Border"), colour_id_border.name, 64);
strcpy(colour_id_border.dbSettingsGroup, MODULE);
@@ -272,7 +275,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
colour_id_border.defcolour = 0;
colour_id_border.order = 0;
- colour_id_divider.cbSize = sizeof(ColourIDW);
+ colour_id_divider.cbSize = sizeof(ColourID);
t2a(TranslateT("Tooltips"), colour_id_divider.group, 64);
t2a(TranslateT("Dividers"), colour_id_divider.name, 64);
strcpy(colour_id_divider.dbSettingsGroup, MODULE);
@@ -280,7 +283,7 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) {
colour_id_divider.defcolour = 0;
colour_id_divider.order = 0;
- colour_id_sidebar.cbSize = sizeof(ColourIDW);
+ colour_id_sidebar.cbSize = sizeof(ColourID);
t2a(TranslateT("Tooltips"), colour_id_sidebar.group, 64);
t2a(TranslateT("Sidebar"), colour_id_sidebar.name, 64);
strcpy(colour_id_sidebar.dbSettingsGroup, MODULE);
@@ -360,6 +363,9 @@ extern "C" int TIPPER_API Load(PLUGINLINK *link) {
set_codepage();
+ char szVer[128];
+ unicode_system = (CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(szVer), (LPARAM)szVer) == 0 && strstr(szVer, "Unicode"));
+
// get the internal malloc/free()
memoryManagerInterface.cbSize = sizeof(memoryManagerInterface);
CallService(MS_SYSTEM_GET_MMI, 0, (LPARAM)&memoryManagerInterface);
diff --git a/tipper/tipper.mdsp b/tipper/tipper.mdsp
index c298c55..7aceee5 100644
--- a/tipper/tipper.mdsp
+++ b/tipper/tipper.mdsp
@@ -104,6 +104,6 @@ extraResourceOptions=
1=resource.rc
[Other]
[History]
-version.h,750
tipper.cpp,3306
+version.h,750
message_pump.cpp,4300
diff --git a/tipper/translations.cpp b/tipper/translations.cpp
index 4e5dbd8..276ddcd 100644
--- a/tipper/translations.cpp
+++ b/tipper/translations.cpp
@@ -9,7 +9,6 @@ DBVTranslation *translations = 0;
DWORD next_func_id;
-bool unicode_system;
HANDLE hServiceAdd;
void AddTranslation(DBVTranslation *new_trans) {
@@ -561,10 +560,6 @@ int ServiceAddTranslation(WPARAM wParam, LPARAM lParam) {
}
void InitTranslations() {
-
- char szVer[128];
- unicode_system = (CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(szVer), (LPARAM)szVer) == 0 && strstr(szVer, "Unicode"));
-
next_func_id = DBGetContactSettingDword(0, MODULE, "NextFuncId", 1);
#define INT_TRANS_COUNT 18
diff --git a/tipper/translations.h b/tipper/translations.h
index 66dc137..2b3abb1 100644
--- a/tipper/translations.h
+++ b/tipper/translations.h
@@ -3,8 +3,6 @@
#include "m_tipper.h"
-extern bool unicode_system;
-
extern int num_tfuncs;
extern DBVTranslation *translations;
diff --git a/tipper/version.h b/tipper/version.h
index 50f59ba..5dae0b6 100644
--- a/tipper/version.h
+++ b/tipper/version.h
@@ -4,7 +4,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 3
#define __RELEASE_NUM 0
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM
#define __FILEVERSION_STRING_DOTS __MAJOR_VERSION.__MINOR_VERSION.__RELEASE_NUM.__BUILD_NUM