diff options
-rw-r--r-- | tipper/common.h | 7 | ||||
-rw-r--r-- | tipper/message_pump.cpp | 93 | ||||
-rw-r--r-- | tipper/message_pump.h | 1 | ||||
-rw-r--r-- | tipper/options.cpp | 115 | ||||
-rw-r--r-- | tipper/popwin.cpp | 15 | ||||
-rw-r--r-- | tipper/str_utils.cpp | 101 | ||||
-rw-r--r-- | tipper/str_utils.h | 10 | ||||
-rw-r--r-- | tipper/subst.cpp | 58 | ||||
-rw-r--r-- | tipper/tipper.cpp | 372 | ||||
-rw-r--r-- | tipper/tipper.dsp | 20 | ||||
-rw-r--r-- | tipper/tipper_9.vcproj | 52 | ||||
-rw-r--r-- | tipper/translations.cpp | 133 |
12 files changed, 281 insertions, 696 deletions
diff --git a/tipper/common.h b/tipper/common.h index f98fbb8..70ac51e 100644 --- a/tipper/common.h +++ b/tipper/common.h @@ -23,7 +23,7 @@ #define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
#endif
-#define MIRANDA_VER 0x0600 // for tabbed options
+#define MIRANDA_VER 0x0700 // for tabbed options
#include <m_stdhdr.h>
@@ -71,13 +71,8 @@ #define MODULE "Tipper"
extern HMODULE hInst;
-extern PLUGINLINK *pluginLink;
-extern HANDLE mainThread;
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/message_pump.cpp b/tipper/message_pump.cpp index baed871..be7fa92 100644 --- a/tipper/message_pump.cpp +++ b/tipper/message_pump.cpp @@ -15,47 +15,47 @@ unsigned int CALLBACK MessagePumpThread(void *param) HWND hwndTip = 0;
MSG hwndMsg = {0};
- while(GetMessage(&hwndMsg, 0, 0, 0) > 0 && !Miranda_Terminated()) {
- if(!IsDialogMessage(hwndMsg.hwnd, &hwndMsg)) {
- switch(hwndMsg.message) {
+ while (GetMessage(&hwndMsg, 0, 0, 0) > 0 && !Miranda_Terminated())
+ {
+ if (!IsDialogMessage(hwndMsg.hwnd, &hwndMsg))
+ {
+ switch(hwndMsg.message)
+ {
case MUM_CREATEPOPUP:
- {
- if(hwndTip) DestroyWindow(hwndTip);
- // if child of clist, zorder is right, but it steals the first click on a contact :(
+ if(hwndTip) DestroyWindow(hwndTip);
+ // if child of clist, zorder is right, but it steals the first click on a contact :(
- // copy topmost exstyle from clist, since we'll put clist under tip in WM_CREATE message
- //LONG clist_exstyle = GetWindowLong((HWND)CallService(MS_CLUI_GETHWND, 0, 0), GWL_EXSTYLE);
- //hwndTip = CreateWindowEx((clist_exstyle & WS_EX_TOPMOST), POP_WIN_CLASS, _T("TipperPopup"), WS_POPUP, 0, 0, 0, 0, 0/*(HWND)CallService(MS_CLUI_GETHWND, 0, 0)*/, 0, hInst, (LPVOID)hwndMsg.lParam);
+ // copy topmost exstyle from clist, since we'll put clist under tip in WM_CREATE message
+ //LONG clist_exstyle = GetWindowLong((HWND)CallService(MS_CLUI_GETHWND, 0, 0), GWL_EXSTYLE);
+ //hwndTip = CreateWindowEx((clist_exstyle & WS_EX_TOPMOST), POP_WIN_CLASS, _T("TipperPopup"), WS_POPUP, 0, 0, 0, 0, 0/*(HWND)CallService(MS_CLUI_GETHWND, 0, 0)*/, 0, hInst, (LPVOID)hwndMsg.lParam);
- hwndTip = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("TipperPopup"), WS_POPUP, 0, 0, 0, 0, 0/*(HWND)CallService(MS_CLUI_GETHWND, 0, 0)*/, 0, hInst, (LPVOID)hwndMsg.lParam);
- if(hwndMsg.lParam) free((LPVOID)hwndMsg.lParam);
- }
+ hwndTip = CreateWindowEx(WS_EX_TOOLWINDOW | WS_EX_TOPMOST, POP_WIN_CLASS, _T("TipperPopup"), WS_POPUP, 0, 0, 0, 0, 0/*(HWND)CallService(MS_CLUI_GETHWND, 0, 0)*/, 0, hInst, (LPVOID)hwndMsg.lParam);
+ if(hwndMsg.lParam) free((LPVOID)hwndMsg.lParam);
break;
case MUM_DELETEPOPUP:
- {
- if(hwndTip) {
- DestroyWindow(hwndTip);
- hwndTip = 0;
- }
+ if(hwndTip) {
+ DestroyWindow(hwndTip);
+ hwndTip = NULL;
}
break;
+
case MUM_GOTSTATUS:
- {
- if(hwndTip) SendMessage(hwndTip, PUM_SETSTATUSTEXT, hwndMsg.wParam, hwndMsg.lParam);
- else if(hwndMsg.lParam) free((void *)hwndMsg.lParam);
- }
+ if(hwndTip) SendMessage(hwndTip, PUM_SETSTATUSTEXT, hwndMsg.wParam, hwndMsg.lParam);
+ else if(hwndMsg.lParam) free((void *)hwndMsg.lParam);
break;
+
+ case MUM_REDRAW:
+ if(hwndTip) SendMessage(hwndTip, PUM_REFRESH_VALUES, hwndMsg.wParam, hwndMsg.lParam);
+ break;
+
case MUM_GOTAVATAR:
- {
- if(hwndTip) SendMessage(hwndTip, PUM_SETAVATAR, hwndMsg.wParam, hwndMsg.lParam);
- }
+ if(hwndTip) SendMessage(hwndTip, PUM_SETAVATAR, hwndMsg.wParam, hwndMsg.lParam);
break;
+
default:
- {
- TranslateMessage(&hwndMsg);
- DispatchMessage(&hwndMsg);
- }
+ TranslateMessage(&hwndMsg);
+ DispatchMessage(&hwndMsg);
break;
}
}
@@ -68,12 +68,6 @@ void PostMPMessage(UINT msg, WPARAM wParam, LPARAM lParam) { PostThreadMessage(message_pump_thread_id, msg, wParam, lParam);
}
-// given a popup data pointer, and a handle to an event, this function
-// will post a message to the message queue which will set the hwnd value
-// and then set the event...so create an event, call this function and then wait on the event
-// when the event is signalled, the hwnd will be valid
-void FindWindow(POPUPDATAW *pd, HANDLE hEvent, HWND *hwnd);
-
void InitMessagePump() {
WNDCLASS popup_win_class = {0};
popup_win_class.style = 0;
@@ -127,6 +121,7 @@ int ShowTipHook(WPARAM wParam, LPARAM lParam) { return 0;
}
+#ifdef _UNICODE
INT_PTR ShowTipW(WPARAM wParam, LPARAM lParam) {
CLCINFOTIP *clcit = (CLCINFOTIP *)lParam;
if(clcit->isGroup) return 0; // no group tips (since they're pretty useless)
@@ -146,6 +141,7 @@ INT_PTR ShowTipW(WPARAM wParam, LPARAM lParam) { PostMPMessage(MUM_CREATEPOPUP, 0, (LPARAM)clcit2);
return 1;
}
+#endif
INT_PTR HideTip(WPARAM wParam, LPARAM lParam) {
//CLCINFOTIP *clcit = (CLCINFOTIP *)lParam;
@@ -160,24 +156,31 @@ int HideTipHook(WPARAM wParam, LPARAM lParam) { int ProtoAck(WPARAM wParam, LPARAM lParam) {
ACKDATA *ack = (ACKDATA *)lParam;
- char *szMsg = (char *)ack->lParam;
- if(ack->type == ACKTYPE_AWAYMSG && ack->result == ACKRESULT_SUCCESS)
+ if (ack->type == ACKTYPE_AWAYMSG && ack->result == ACKRESULT_SUCCESS)
{
#ifdef _UNICODE
DBVARIANT dbv;
- bool unicode = !DBGetContactSetting(ack->hContact, "CList", "StatusMsg", &dbv) &&
- (dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
- DBFreeVariant(&dbv);
- if (unicode) {
- DBGetContactSettingWString(ack->hContact, "CList", "StatusMsg", &dbv);
- PostMPMessage(MUM_GOTSTATUS, (WPARAM)ack->hContact, (LPARAM)_wcsdup(dbv.pwszVal));
+ if (!DBGetContactSetting(ack->hContact, "CList", "StatusMsg", &dbv))
+ {
+ bool unicode = (dbv.type == DBVT_UTF8 || dbv.type == DBVT_WCHAR);
DBFreeVariant(&dbv);
+ if (unicode) {
+ DBGetContactSettingTString(ack->hContact, "CList", "StatusMsg", &dbv);
+ PostMPMessage(MUM_GOTSTATUS, (WPARAM)ack->hContact, (LPARAM)_tcsdup(dbv.ptszVal));
+ DBFreeVariant(&dbv);
+ return 0;
+ }
}
- else
#endif
- if (szMsg && szMsg[0])
- PostMPMessage(MUM_GOTSTATUS, (WPARAM)ack->hContact, (LPARAM)a2t(szMsg));
+ char *szMsg = (char *)ack->lParam;
+ if (szMsg && szMsg[0])
+ PostMPMessage(MUM_GOTSTATUS, (WPARAM)ack->hContact, (LPARAM)a2t(szMsg));
+ }
+ else if (ack->type == ACKTYPE_GETINFO && ack->result == ACKRESULT_SUCCESS)
+ {
+ PostMPMessage(MUM_REDRAW, (WPARAM)ack->hContact, 0);
}
+
return 0;
}
diff --git a/tipper/message_pump.h b/tipper/message_pump.h index f72d5bc..fe59dad 100644 --- a/tipper/message_pump.h +++ b/tipper/message_pump.h @@ -7,6 +7,7 @@ void PostMPMessage(UINT msg, WPARAM, LPARAM); #define MUM_DELETEPOPUP (WM_USER + 0x012)
#define MUM_GOTSTATUS (WM_USER + 0x013)
#define MUM_GOTAVATAR (WM_USER + 0x014)
+#define MUM_REDRAW (WM_USER + 0x015)
extern HMODULE hUserDll;
extern BOOL (WINAPI *MySetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
diff --git a/tipper/options.cpp b/tipper/options.cpp index 05b6e0a..4ebe0a2 100644 --- a/tipper/options.cpp +++ b/tipper/options.cpp @@ -142,25 +142,19 @@ void CreateDefaultItems() { bool LoadDS(DisplaySubst *ds, int index) {
char setting[512];
DBVARIANT dbv;
- mir_snprintf(setting, 512, "Name%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "Name%d", index);
ds->name[0] = 0;
- if(!DBGetContactSettingWString(0, MODULE, setting, &dbv)) {
- w2t(dbv.pwszVal, ds->name, LABEL_LEN);
- DBFreeVariant(&dbv);
- } else if(!DBGetContactSettingStringUtf(0, MODULE, setting, &dbv)) {
- u2t(dbv.pszVal, ds->name, LABEL_LEN);
- DBFreeVariant(&dbv);
- } else if(!DBGetContactSetting(0, MODULE, setting, &dbv)) {
- if(dbv.type == DBVT_ASCIIZ) a2t(dbv.pszVal, ds->name, LABEL_LEN);
+ if (!DBGetContactSettingTString(0, MODULE, setting, &dbv)) {
+ _tcsncpy(ds->name, dbv.ptszVal, SIZEOF(ds->name));
+ ds->name[SIZEOF(ds->name) - 1] = 0;
DBFreeVariant(&dbv);
} else
return false;
- ds->name[LABEL_LEN - 1] = 0;
- mir_snprintf(setting, 512, "Type%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "Type%d", index);
ds->type = (DisplaySubstType)DBGetContactSettingByte(0, MODULE, setting, DVT_PROTODB);
- mir_snprintf(setting, 512, "Module%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "Module%d", index);
ds->module_name[0] = 0;
if(!DBGetContactSettingString(0, MODULE, setting, &dbv)) {
strncpy(ds->module_name, dbv.pszVal, MODULE_NAME_LEN);
@@ -189,58 +183,42 @@ bool LoadDS(DisplaySubst *ds, int index) { void SaveDS(DisplaySubst *ds, int index) {
char setting[512];
- mir_snprintf(setting, 512, "Name%d", index);
- if(DBWriteContactSettingTString(0, MODULE, setting, ds->name)) {
- char buff[LABEL_LEN];
- t2a(ds->name, buff, LABEL_LEN);
- DBWriteContactSettingString(0, MODULE, setting, buff);
- }
- mir_snprintf(setting, 512, "Type%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "Name%d", index);
+ DBWriteContactSettingTString(0, MODULE, setting, ds->name);
+ mir_snprintf(setting, SIZEOF(setting), "Type%d", index);
DBWriteContactSettingByte(0, MODULE, setting, (BYTE)ds->type);
- mir_snprintf(setting, 512, "Module%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "Module%d", index);
DBWriteContactSettingString(0, MODULE, setting, ds->module_name);
- mir_snprintf(setting, 512, "Setting%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "Setting%d", index);
DBWriteContactSettingString(0, MODULE, setting, ds->setting_name);
- mir_snprintf(setting, 512, "TransFuncId%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "TransFuncId%d", index);
DBWriteContactSettingDword(0, MODULE, setting, (WORD)ds->translate_func_id);
}
-bool LoadDI(DisplayItem *di, int index) {
+bool LoadDI(DisplayItem *di, int index)
+{
char setting[512];
DBVARIANT dbv;
- mir_snprintf(setting, 512, "DILabel%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "DILabel%d", index);
di->label[0] = 0;
- if(!DBGetContactSettingWString(0, MODULE, setting, &dbv)) {
- w2t(dbv.pwszVal, di->label, LABEL_LEN);
- DBFreeVariant(&dbv);
- } else if(!DBGetContactSettingStringUtf(0, MODULE, setting, &dbv)) {
- u2t(dbv.pszVal, di->label, LABEL_LEN);
- DBFreeVariant(&dbv);
- } else if(!DBGetContactSetting(0, MODULE, setting, &dbv)) {
- if(dbv.type == DBVT_ASCIIZ) a2t(dbv.pszVal, di->label, LABEL_LEN);
+ if (!DBGetContactSettingTString(0, MODULE, setting, &dbv)) {
+ _tcsncpy( di->label, dbv.ptszVal, SIZEOF(di->label));
+ di->label[SIZEOF(di->label) - 1] = 0;
DBFreeVariant(&dbv);
} else
return false;
- di->label[LABEL_LEN - 1] = 0;
- mir_snprintf(setting, 512, "DIValue%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "DIValue%d", index);
di->value[0] = 0;
- if(!DBGetContactSettingWString(0, MODULE, setting, &dbv)) {
- w2t(dbv.pwszVal, di->value, VALUE_LEN);
- DBFreeVariant(&dbv);
- } else if(!DBGetContactSettingStringUtf(0, MODULE, setting, &dbv)) {
- u2t(dbv.pszVal, di->value, VALUE_LEN);
- DBFreeVariant(&dbv);
- } else if(!DBGetContactSetting(0, MODULE, setting, &dbv)) {
- if(dbv.type == DBVT_ASCIIZ) a2t(dbv.pszVal, di->value, VALUE_LEN);
+ if(!DBGetContactSettingTString(0, MODULE, setting, &dbv)) {
+ _tcsncpy(di->value, dbv.ptszVal, SIZEOF(di->value));
+ di->value[SIZEOF(di->value) - 1] = 0;
DBFreeVariant(&dbv);
}
- di->value[VALUE_LEN - 1] = 0;
-
- mir_snprintf(setting, 512, "DILineAbove%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "DILineAbove%d", index);
di->line_above = (DBGetContactSettingByte(0, MODULE, setting, 0) == 1);
- mir_snprintf(setting, 512, "DIValNewline%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "DIValNewline%d", index);
di->value_newline = (DBGetContactSettingByte(0, MODULE, setting, 0) == 1);
return true;
@@ -248,21 +226,13 @@ bool LoadDI(DisplayItem *di, int index) { void SaveDI(DisplayItem *di, int index) {
char setting[512];
- mir_snprintf(setting, 512, "DILabel%d", index);
- if(DBWriteContactSettingTString(0, MODULE, setting, di->label)) {
- char buff[LABEL_LEN];
- t2a(di->label, buff, LABEL_LEN);
- DBWriteContactSettingString(0, MODULE, setting, buff);
- }
- mir_snprintf(setting, 512, "DIValue%d", index);
- if(DBWriteContactSettingTString(0, MODULE, setting, di->value)) {
- char buff[VALUE_LEN];
- t2a(di->value, buff, VALUE_LEN);
- DBWriteContactSettingString(0, MODULE, setting, buff);
- }
- mir_snprintf(setting, 512, "DILineAbove%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "DILabel%d", index);
+ DBWriteContactSettingTString(0, MODULE, setting, di->label);
+ mir_snprintf(setting, SIZEOF(setting), "DIValue%d", index);
+ DBWriteContactSettingTString(0, MODULE, setting, di->value);
+ mir_snprintf(setting, SIZEOF(setting), "DILineAbove%d", index);
DBWriteContactSettingByte(0, MODULE, setting, di->line_above ? 1 : 0);
- mir_snprintf(setting, 512, "DIValNewline%d", index);
+ mir_snprintf(setting, SIZEOF(setting), "DIValNewline%d", index);
DBWriteContactSettingByte(0, MODULE, setting, di->value_newline ? 1 : 0);
}
@@ -277,7 +247,7 @@ void SaveOptions() { DBWriteContactSettingByte(0, MODULE, "Animate", (options.animate ? 1 : 0));
DBWriteContactSettingByte(0, MODULE, "TransparentBg", (options.trans_bg ? 1 : 0));
DBWriteContactSettingByte(0, MODULE, "TitleLayout", (BYTE)options.title_layout);
- if(ServiceExists(MS_AV_DRAWAVATAR))
+ if (ServiceExists(MS_AV_DRAWAVATAR))
DBWriteContactSettingByte(0, MODULE, "AVLayout", (BYTE)options.av_layout);
DBWriteContactSettingDword(0, MODULE, "AVSize", options.av_size);
DBWriteContactSettingDword(0, MODULE, "TextIndent", options.text_indent);
@@ -1169,37 +1139,26 @@ static INT_PTR CALLBACK DlgProcOptLayout(HWND hwndDlg, UINT msg, WPARAM wParam, int OptInit(WPARAM wParam, LPARAM lParam) {
OPTIONSDIALOGPAGE odp = { 0 };
- DWORD mirVir = (DWORD)CallService(MS_SYSTEM_GETVERSION, 0, 0);
- odp.cbSize = (mirVir >= 0x00060000 ? sizeof(odp) : OPTIONPAGE_OLD_SIZE2);
- //odp.cbSize = sizeof(odp);
+ odp.cbSize = sizeof(odp);
odp.flags = ODPF_BOLDGROUPS;
- //odp.flags |= ODPF_UNICODE;
odp.position = -790000000;
odp.hInstance = hInst;
-
+ odp.pszTitle = LPGEN("Tooltips");
+ odp.pszGroup = LPGEN("Customize");
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_WINDOW);
- odp.pszTab = Translate("Window");
- odp.pszTitle = (mirVir >= 0x00060000 ? Translate("Tooltips") : Translate("Tooltips View"));;
- odp.pszGroup = Translate("Customize");
- odp.nIDBottomSimpleControl = 0;
+ odp.pszTab = LPGEN("Window");
odp.pfnDlgProc = DlgProcOptWindow;
CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_LAYOUT);
- odp.pszTab = Translate("Layout");
- odp.pszTitle = (mirVir >= 0x00060000 ? Translate("Tooltips") : Translate("Tooltips View"));;
- odp.pszGroup = Translate("Customize");
- odp.nIDBottomSimpleControl = 0;
+ odp.pszTab = LPGEN("Layout");
odp.pfnDlgProc = DlgProcOptLayout;
CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_CONTENT);
- odp.pszTab = Translate("Content");
- odp.pszTitle = (mirVir >= 0x00060000 ? Translate("Tooltips") : Translate("Tooltips Content"));;
- odp.pszGroup = Translate("Customize");
- odp.nIDBottomSimpleControl = 0;
+ odp.pszTab = LPGEN("Content");
odp.pfnDlgProc = DlgProcOptContent;
CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp );
diff --git a/tipper/popwin.cpp b/tipper/popwin.cpp index 7952c40..ac6143c 100644 --- a/tipper/popwin.cpp +++ b/tipper/popwin.cpp @@ -242,22 +242,17 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa pwd->hContact = pwd->clcit.hItem;
pwd->iconIndex = (int)CallService(MS_CLIST_GETCONTACTICON, (WPARAM)pwd->hContact, 0);
+ CallContactService(pwd->hContact, PSS_GETINFO, SGIF_ONOPEN, 0);
+
// don't use stored status message
// problem with delete setting?
//DBDeleteContactSetting(pwd->hContact, MODULE, "TempStatusMsg");
DBWriteContactSettingTString(pwd->hContact, MODULE, "TempStatusMsg", _T(""));
- 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);
+ TCHAR *stzCDN = (TCHAR *) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)pwd->hContact, GCDNF_TCHAR);
- if(szCDN) a2t(szCDN, pwd->swzTitle, TITLE_TEXT_LEN);
- else _tcscpy(pwd->swzTitle, TranslateT("(Unknown)"));
- }
+ if(stzCDN) _tcsncpy(pwd->swzTitle, stzCDN, TITLE_TEXT_LEN);
+ else _tcscpy(pwd->swzTitle, TranslateT("(Unknown)"));
//get avatar if possible
char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)pwd->hContact, 0);
diff --git a/tipper/str_utils.cpp b/tipper/str_utils.cpp index b226bfe..d1273be 100644 --- a/tipper/str_utils.cpp +++ b/tipper/str_utils.cpp @@ -18,35 +18,6 @@ bool w2a(const wchar_t *ws, char *buff, int bufflen) { return true;
}
-bool u2w(const char *us, wchar_t *buff, int bufflen) {
- if(us) MultiByteToWideChar(CP_UTF8, 0, us, -1, buff, bufflen);
- return true;
-}
-
-bool w2u(const wchar_t *ws, char *buff, int bufflen) {
- if(ws) WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, bufflen, 0, 0);
- return true;
-}
-
-bool a2u(const char *as, char *buff, int bufflen) {
- if(!as) return false;
-
- wchar_t *ws = a2w(as);
- if(ws) WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, bufflen, 0, 0);
- free(ws);
- return true;
-}
-
-bool u2a(const char *us, char *buff, int bufflen) {
- if(!us) return false;
-
- wchar_t *ws = u2w(us);
- if(ws) WideCharToMultiByte(code_page, 0, ws, -1, buff, bufflen, 0, 0);
- free(ws);
- return true;
-}
-
-
bool t2w(const TCHAR *ts, wchar_t *buff, int bufflen) {
#ifdef _UNICODE
wcsncpy(buff, ts, bufflen);
@@ -83,42 +54,6 @@ bool a2t(const char *as, TCHAR *buff, int bufflen) { #endif
}
-bool t2u(const TCHAR *ts, char *buff, int bufflen) {
-#ifdef _UNICODE
- return w2u(ts, buff, bufflen);
-#else
- return a2u(ts, buff, bufflen);
-#endif
-}
-
-bool u2t(const char *us, TCHAR *buff, int bufflen) {
-#ifdef _UNICODE
- return u2w(us, buff, bufflen);
-#else
- return u2a(us, buff, bufflen);
-#endif
-}
-
-wchar_t *u2w(const char *us) {
- if(us) {
- int size = MultiByteToWideChar(CP_UTF8, 0, us, -1, 0, 0);
- wchar_t *buff = (wchar_t *)malloc(size * sizeof(wchar_t));
- MultiByteToWideChar(CP_UTF8, 0, us, -1, buff, size);
- return buff;
- } else
- return 0;
-}
-
-char *w2u(const wchar_t *ws) {
- if(ws) {
- int size = WideCharToMultiByte(CP_UTF8, 0, ws, -1, 0, 0, 0, 0);
- char *buff = (char *)malloc(size);
- WideCharToMultiByte(CP_UTF8, 0, ws, -1, buff, size, 0, 0);
- return buff;
- } else
- return 0;
-}
-
wchar_t *a2w(const char *as) {
int size = MultiByteToWideChar(code_page, 0, as, -1, 0, 0);
wchar_t *buff = (wchar_t *)malloc(size * sizeof(wchar_t));
@@ -133,20 +68,6 @@ char *w2a(const wchar_t *ws) { return buff;
}
-char *u2a(const char *utfs) {
- wchar_t *ws = u2w(utfs);
- char *ret = w2a(ws);
- free(ws);
- return ret;
-}
-
-char *a2u(const char *as) {
- wchar_t *ws = a2w(as);
- char *ret = w2u(ws);
- free(ws);
- return ret;
-}
-
TCHAR *w2t(const wchar_t *ws) {
#ifdef _UNICODE
return wcsdup(ws);
@@ -179,25 +100,3 @@ TCHAR *a2t(const char *as) { return _strdup(as);
#endif
}
-
-TCHAR *u2t(const char *utfs) {
-#ifdef _UNICODE
- return u2w(utfs);
-#else
- wchar_t *ws = u2w(utfs);
- char *ret = w2a(ws);
- free(ws);
- return ret;
-#endif
-}
-
-char *t2u(const TCHAR *ts) {
-#ifdef _UNICODE
- return w2u(ts);
-#else
- wchar_t *ws = a2w(ts);
- char *ret = w2u(ws);
- free(ws);
- return ret;
-#endif
-}
diff --git a/tipper/str_utils.h b/tipper/str_utils.h index 5cef279..26071a1 100644 --- a/tipper/str_utils.h +++ b/tipper/str_utils.h @@ -7,7 +7,6 @@ bool a2w(const char *as, wchar_t *buff, int bufflen); bool w2a(const wchar_t *ws, char *buff, int bufflen);
bool u2w(const char *us, wchar_t *buff, int bufflen);
-bool w2u(const wchar_t *ws, char *buff, int bufflen);
bool a2u(const char *as, char *buff, int bufflen);
bool u2a(const char *ws, char *buff, int bufflen);
@@ -18,23 +17,14 @@ bool w2t(const wchar_t *ws, TCHAR *buff, int bufflen); bool t2a(const TCHAR *ts, char *buff, int bufflen);
bool a2t(const char *as, TCHAR *buff, int bufflen);
-bool t2u(const TCHAR *ts, char *buff, int bufflen);
-bool u2t(const char *us, TCHAR *buff, int bufflen);
// remember to free return value
wchar_t *a2w(const char *as);
char *w2a(const wchar_t *ws);
-wchar_t *u2w(const char *us);
-char *w2u(const wchar_t *ws);
-
-char *u2a(const char *us);
-char *a2u(const char *as);
-
wchar_t *t2w(const TCHAR *ts);
TCHAR *w2t(const wchar_t *ws);
-TCHAR *u2t(const char *us);
char *t2u(const TCHAR *ts);
char *t2a(const TCHAR *ts);
diff --git a/tipper/subst.cpp b/tipper/subst.cpp index cd10998..2e8a6aa 100644 --- a/tipper/subst.cpp +++ b/tipper/subst.cpp @@ -12,7 +12,7 @@ void StripBBCodesInPlace(TCHAR *text) { int len = (int)_tcslen(text);
while(read <= len) { // copy terminating null too
- while(read <= len && text[read] != _T('[')) {
+ while(read <= len && text[read] != '[') {
if(text[read] != text[write]) text[write] = text[read];
read++; write++;
}
@@ -23,12 +23,12 @@ void StripBBCodesInPlace(TCHAR *text) { else if(len - read >= 4 && (_tcsnicmp(text + read, _T("[/b]"), 4) == 0 || _tcsnicmp(text + read, _T("[/i]"), 4) == 0))
read += 4;
else if(len - read >= 6 && (_tcsnicmp(text + read, _T("[color"), 6) == 0)) {
- while(read < len && text[read] != L']') read++;
+ while(read < len && text[read] != ']') read++;
read++;// skip the ']'
} else if(len - read >= 8 && (_tcsnicmp(text + read, _T("[/color]"), 8) == 0))
read += 8;
else if(len - read >= 5 && (_tcsnicmp(text + read, _T("[size"), 5) == 0)) {
- while(read < len && text[read] != L']') read++;
+ while(read < len && text[read] != ']') read++;
read++;// skip the ']'
} else if(len - read >= 7 && (_tcsnicmp(text + read, _T("[/size]"), 7) == 0))
read += 7;
@@ -58,23 +58,13 @@ DWORD last_message_timestamp(HANDLE hContact) { }
void format_timestamp(DWORD ts, char *format, TCHAR *buff, int bufflen) {
- if(unicode_system) {
- TCHAR form[16];
- DBTIMETOSTRINGT dbt = {0};
- dbt.cbDest = bufflen;
- dbt.szDest = buff;
- a2t(format, form, 16);
- dbt.szFormat = form;
- CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt);
- } else {
- char buffA[512];
- DBTIMETOSTRING dbt = {0};
- dbt.cbDest = sizeof(buffA);
- dbt.szDest = buffA;
- dbt.szFormat = format;
- CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)ts, (LPARAM)&dbt);
- a2t(buffA, buff, bufflen);
- }
+ TCHAR form[16];
+ DBTIMETOSTRINGT dbt = {0};
+ dbt.cbDest = bufflen;
+ dbt.szDest = buff;
+ a2t(format, form, 16);
+ dbt.szFormat = form;
+ CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt);
}
bool uid(HANDLE hContact, char *proto, TCHAR *buff, int bufflen) {
@@ -83,7 +73,7 @@ bool uid(HANDLE hContact, char *proto, TCHAR *buff, int bufflen) { ci.hContact = hContact;
// pass in proto so we can get uid when hContact == 0 (i.e. our own uid for a given proto)
ci.szProto = proto;//(char *)CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hcontact,0);
- ci.dwFlag = CNF_UNIQUEID | (unicode_system ? CNF_UNICODE : 0);
+ ci.dwFlag = CNF_UNIQUEID | CNF_TCHAR;
if(!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM)&ci)) {
switch(ci.type) {
case CNFT_BYTE:
@@ -96,12 +86,8 @@ bool uid(HANDLE hContact, char *proto, TCHAR *buff, int bufflen) { _ltot(ci.dVal, buff, 10);
break;
case CNFT_ASCIIZ:
- 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);
- }
+ _tcsncpy(buff, ci.pszVal, bufflen);
+ buff[bufflen-1] = 0;
break;
default:
return false;
@@ -142,21 +128,9 @@ TCHAR *GetLastMessageText(HANDLE hContact) { if(dbei.cbBlob == 0 || dbei.pBlob == 0) return 0;
- TCHAR *msg = 0;
- if ( ServiceExists( MS_DB_EVENT_GETTEXT )) {
- TCHAR *buf = DbGetEventTextT( &dbei, CP_ACP );
- msg = _tcsdup( buf );
- mir_free( buf );
- }
- else {
- unsigned int msglen = (unsigned)strlen((char *)dbei.pBlob) + 1;
-
- // does blob contain unicode message?
- if(msglen < dbei.cbBlob)
- msg = w2t((wchar_t *)(&dbei.pBlob[msglen]));
- else
- msg = a2t((char *)dbei.pBlob);
- }
+ TCHAR *buf = DbGetEventTextT( &dbei, CP_ACP );
+ TCHAR *msg = _tcsdup( buf );
+ mir_free( buf );
StripBBCodesInPlace(msg);
return msg;
diff --git a/tipper/tipper.cpp b/tipper/tipper.cpp index 6a8600a..206d981 100644 --- a/tipper/tipper.cpp +++ b/tipper/tipper.cpp @@ -9,22 +9,17 @@ #include "popwin.h"
#include "str_utils.h"
-HMODULE hInst = 0;
-HANDLE mainThread = 0;
+HMODULE hInst;
-bool unicode_system;
+FontIDT font_id_title, font_id_labels, font_id_values;
+ColourIDT colour_id_bg, colour_id_border, colour_id_divider, colour_id_sidebar;
-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};
-ColourIDW colour_id_bgw = {0}, colour_id_borderw = {0}, colour_id_dividerw = {0}, colour_id_sidebarw = {0};
-
-HFONT hFontTitle = 0, hFontLabels = 0, hFontValues = 0;
+HFONT hFontTitle, hFontLabels, hFontValues;
// hooked here so it's in the main thread
-HANDLE hAvChangeEvent = 0, hAvContactChangeEvent = 0, hShowTipEvent = 0, hHideTipEvent = 0, hAckEvent = 0, hFramesSBShow = 0, hFramesSBHide = 0, hSettingChangedEvent = 0;
-
-HANDLE hShowTipService = 0, hShowTipWService = 0, hHideTipService = 0;
+HANDLE hAvChangeEvent, hAvContactChangeEvent, hShowTipEvent, hHideTipEvent;
+HANDLE hAckEvent, hFramesSBShow, hFramesSBHide, hSettingChangedEvent;
+HANDLE hShowTipService, hShowTipWService, hHideTipService;
MM_INTERFACE mmi;
TIME_API tmi;
@@ -48,7 +43,7 @@ PLUGININFOEX pluginInfo={ #endif
};
-PLUGINLINK *pluginLink = 0;
+PLUGINLINK *pluginLink;
extern "C" BOOL APIENTRY DllMain( HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
@@ -62,11 +57,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda return &pluginInfo;
}
-extern "C" __declspec(dllexport) PLUGININFO* MirandaPluginInfo(DWORD mirandaVersion)
-{
- pluginInfo.cbSize = sizeof(PLUGININFO);
- return (PLUGININFO*)&pluginInfo;
-}
static const MUUID interfaces[] = {MIID_TOOLTIPS, MIID_LAST};
extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
@@ -78,39 +68,21 @@ extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) int ReloadFont(WPARAM wParam, LPARAM lParam) {
- 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 = CreateFontIndirectW(&log_font);
- if(hFontLabels) DeleteObject(hFontLabels);
- options.label_col = CallService(MS_FONT_GETW, (WPARAM)&font_id_labelsw, (LPARAM)&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 = 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 = CreateFontIndirectA(&log_font);
- if(hFontLabels) DeleteObject(hFontLabels);
- options.label_col = CallService(MS_FONT_GET, (WPARAM)&font_id_labels, (LPARAM)&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 = 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);
- options.sidebar_col = CallService(MS_COLOUR_GET, (WPARAM)&colour_id_sidebar, 0);
- options.div_col = CallService(MS_COLOUR_GET, (WPARAM)&colour_id_divider, 0);
- }
+ LOGFONT log_font;
+ if(hFontTitle) DeleteObject(hFontTitle);
+ options.title_col = CallService(MS_FONT_GETT, (WPARAM)&font_id_title, (LPARAM)&log_font);
+ hFontTitle = CreateFontIndirect(&log_font);
+ if(hFontLabels) DeleteObject(hFontLabels);
+ options.label_col = CallService(MS_FONT_GETT, (WPARAM)&font_id_labels, (LPARAM)&log_font);
+ hFontLabels = CreateFontIndirect(&log_font);
+ if(hFontValues) DeleteObject(hFontValues);
+ options.value_col = CallService(MS_FONT_GETT, (WPARAM)&font_id_values, (LPARAM)&log_font);
+ hFontValues = CreateFontIndirect(&log_font);
+
+ options.bg_col = CallService(MS_COLOUR_GETT, (WPARAM)&colour_id_bg, 0);
+ options.border_col = CallService(MS_COLOUR_GETT, (WPARAM)&colour_id_border, 0);
+ options.sidebar_col = CallService(MS_COLOUR_GETT, (WPARAM)&colour_id_sidebar, 0);
+ options.div_col = CallService(MS_COLOUR_GETT, (WPARAM)&colour_id_divider, 0);
return 0;
}
@@ -161,202 +133,92 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) { CallService(MS_UPDATE_REGISTER, 0, (WPARAM)&update);
}
- if(ServiceExists(MS_FONT_REGISTERW)) {
- font_id_titlew.cbSize = sizeof(FontIDW);
- font_id_titlew.flags = FIDF_ALLOWEFFECTS;
- t2w(TranslateT("Tooltips"), font_id_titlew.group, 64);
- t2w(TranslateT("Title"), font_id_titlew.name, 64);
- strcpy(font_id_titlew.dbSettingsGroup, MODULE);
- strcpy(font_id_titlew.prefix, "FontFirst");
- font_id_titlew.order = 0;
-
- font_id_titlew.deffontsettings.charset = DEFAULT_CHARSET;
- font_id_titlew.deffontsettings.size = -14;
- font_id_titlew.deffontsettings.style = DBFONTF_BOLD;
- font_id_titlew.deffontsettings.colour = RGB(255, 0, 0);
- font_id_titlew.flags |= FIDF_DEFAULTVALID;
-
- font_id_labelsw.cbSize = sizeof(FontIDW);
- font_id_labelsw.flags = FIDF_ALLOWEFFECTS;
- t2w(TranslateT("Tooltips"), font_id_labelsw.group, 64);
- t2w(TranslateT("Labels"), font_id_labelsw.name, 64);
- strcpy(font_id_labelsw.dbSettingsGroup, MODULE);
- strcpy(font_id_labelsw.prefix, "FontLabels");
- font_id_labelsw.order = 1;
-
- font_id_labelsw.deffontsettings.charset = DEFAULT_CHARSET;
- font_id_labelsw.deffontsettings.size = -12;
- font_id_labelsw.deffontsettings.style = DBFONTF_ITALIC;
- font_id_labelsw.deffontsettings.colour = RGB(128, 128, 128);
- font_id_labelsw.flags |= FIDF_DEFAULTVALID;
-
- font_id_valuesw.cbSize = sizeof(FontIDW);
- font_id_valuesw.flags = FIDF_ALLOWEFFECTS;
- t2w(TranslateT("Tooltips"), font_id_valuesw.group, 64);
- t2w(TranslateT("Values"), font_id_valuesw.name, 64);
- strcpy(font_id_valuesw.dbSettingsGroup, MODULE);
- strcpy(font_id_valuesw.prefix, "FontValues");
- font_id_valuesw.order = 2;
-
- font_id_valuesw.deffontsettings.charset = DEFAULT_CHARSET;
- font_id_valuesw.deffontsettings.size = -12;
- font_id_valuesw.deffontsettings.style = 0;
- font_id_valuesw.deffontsettings.colour = RGB(0, 0, 0);
- font_id_valuesw.flags |= FIDF_DEFAULTVALID;
-
- CallService(MS_FONT_REGISTERW, (WPARAM)&font_id_titlew, 0);
- CallService(MS_FONT_REGISTERW, (WPARAM)&font_id_labelsw, 0);
- CallService(MS_FONT_REGISTERW, (WPARAM)&font_id_valuesw, 0);
-
- colour_id_bgw.cbSize = sizeof(ColourIDW);
- t2w(TranslateT("Tooltips"), colour_id_bgw.group, 64);
- t2w(TranslateT("Background"), colour_id_bgw.name, 64);
- strcpy(colour_id_bgw.dbSettingsGroup, MODULE);
- strcpy(colour_id_bgw.setting, "ColourBg");
- colour_id_bgw.defcolour = RGB(219, 219, 219);
- colour_id_bgw.order = 0;
-
- colour_id_borderw.cbSize = sizeof(ColourIDW);
- t2w(TranslateT("Tooltips"), colour_id_borderw.group, 64);
- t2w(TranslateT("Border"), colour_id_borderw.name, 64);
- strcpy(colour_id_borderw.dbSettingsGroup, MODULE);
- strcpy(colour_id_borderw.setting, "BorderCol");
- colour_id_borderw.defcolour = 0;
- colour_id_borderw.order = 0;
-
- colour_id_dividerw.cbSize = sizeof(ColourIDW);
- t2w(TranslateT("Tooltips"), colour_id_dividerw.group, 64);
- t2w(TranslateT("Dividers"), colour_id_dividerw.name, 64);
- strcpy(colour_id_dividerw.dbSettingsGroup, MODULE);
- strcpy(colour_id_dividerw.setting, "DividerCol");
- colour_id_dividerw.defcolour = 0;
- colour_id_dividerw.order = 0;
-
- colour_id_sidebarw.cbSize = sizeof(ColourIDW);
- t2w(TranslateT("Tooltips"), colour_id_sidebarw.group, 64);
- t2w(TranslateT("Sidebar"), colour_id_sidebarw.name, 64);
- strcpy(colour_id_sidebarw.dbSettingsGroup, MODULE);
- strcpy(colour_id_sidebarw.setting, "SidebarCol");
- colour_id_sidebarw.defcolour = RGB(192, 192, 192);
- colour_id_sidebarw.order = 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(FontID);
- font_id_title.flags = FIDF_ALLOWEFFECTS;
- t2a(TranslateT("Tooltips"), font_id_title.group, 64);
- t2a(TranslateT("Title"), font_id_title.name, 64);
- strcpy(font_id_title.dbSettingsGroup, MODULE);
- strcpy(font_id_title.prefix, "FontFirst");
- font_id_title.order = 0;
-
- font_id_title.deffontsettings.charset = DEFAULT_CHARSET;
- font_id_title.deffontsettings.size = -14;
- font_id_title.deffontsettings.style = DBFONTF_BOLD;
- font_id_title.deffontsettings.colour = RGB(255, 0, 0);
- font_id_title.flags |= FIDF_DEFAULTVALID;
-
- 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);
- strcpy(font_id_labels.dbSettingsGroup, MODULE);
- strcpy(font_id_labels.prefix, "FontLabels");
- font_id_labels.order = 1;
-
- font_id_labels.deffontsettings.charset = DEFAULT_CHARSET;
- font_id_labels.deffontsettings.size = -12;
- font_id_labels.deffontsettings.style = DBFONTF_ITALIC;
- font_id_labels.deffontsettings.colour = RGB(128, 128, 128);
- font_id_labels.flags |= FIDF_DEFAULTVALID;
-
- 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);
- strcpy(font_id_values.dbSettingsGroup, MODULE);
- strcpy(font_id_values.prefix, "FontValues");
- font_id_values.order = 2;
-
- font_id_values.deffontsettings.charset = DEFAULT_CHARSET;
- font_id_values.deffontsettings.size = -12;
- font_id_values.deffontsettings.style = 0;
- font_id_values.deffontsettings.colour = RGB(0, 0, 0);
- font_id_values.flags |= FIDF_DEFAULTVALID;
-
- CallService(MS_FONT_REGISTER, (WPARAM)&font_id_title, 0);
- CallService(MS_FONT_REGISTER, (WPARAM)&font_id_labels, 0);
- CallService(MS_FONT_REGISTER, (WPARAM)&font_id_values, 0);
-
- 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);
- strcpy(colour_id_bg.setting, "ColourBg");
- colour_id_bg.defcolour = RGB(219, 219, 219);
- colour_id_bg.order = 0;
-
- 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);
- strcpy(colour_id_border.setting, "BorderCol");
- colour_id_border.defcolour = 0;
- colour_id_border.order = 0;
-
- 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);
- strcpy(colour_id_divider.setting, "DividerCol");
- colour_id_divider.defcolour = 0;
- colour_id_divider.order = 0;
-
- 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);
- strcpy(colour_id_sidebar.setting, "SidebarCol");
- colour_id_sidebar.defcolour = RGB(192, 192, 192);
- colour_id_sidebar.order = 0;
-
- CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_bg, 0);
- CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_border, 0);
- CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_divider, 0);
- CallService(MS_COLOUR_REGISTER, (WPARAM)&colour_id_sidebar, 0);
-
- ReloadFont(0, 0);
-
- HookEvent(ME_FONT_RELOAD, ReloadFont);
- } else {
- options.title_col = RGB(255, 0, 0); options.label_col = RGB(128, 128, 128), options.value_col = 0;
- options.bg_col = RGB(219, 219, 219);
- options.border_col = options.div_col = 0;
- options.sidebar_col = RGB(192, 192, 192);
-
- LOGFONT lf = {0};
- lf.lfCharSet = DEFAULT_CHARSET;
- lf.lfHeight = -14;
- lf.lfWeight = FW_BOLD;
- hFontTitle = CreateFontIndirect(&lf);
-
- lf.lfHeight = -12;
- lf.lfWeight = 0;
- lf.lfItalic = TRUE;
- hFontLabels = CreateFontIndirect(&lf);
-
- lf.lfHeight = -12;
- lf.lfWeight = 0;
- lf.lfItalic = FALSE;
- hFontValues = CreateFontIndirect(&lf);
- }
+ font_id_title.cbSize = sizeof(FontIDT);
+ font_id_title.flags = FIDF_ALLOWEFFECTS;
+ _tcscpy(font_id_title.group, LPGENT("Tooltips"));
+ _tcscpy(font_id_title.name, LPGENT("Title"));
+ strcpy(font_id_title.dbSettingsGroup, MODULE);
+ strcpy(font_id_title.prefix, "FontFirst");
+ font_id_title.order = 0;
+
+ font_id_title.deffontsettings.charset = DEFAULT_CHARSET;
+ font_id_title.deffontsettings.size = -14;
+ font_id_title.deffontsettings.style = DBFONTF_BOLD;
+ font_id_title.deffontsettings.colour = RGB(255, 0, 0);
+ font_id_title.flags |= FIDF_DEFAULTVALID;
+
+ font_id_labels.cbSize = sizeof(FontIDT);
+ font_id_labels.flags = FIDF_ALLOWEFFECTS;
+ _tcscpy(font_id_labels.group, LPGENT("Tooltips"));
+ _tcscpy(font_id_labels.name, LPGENT("Labels"));
+ strcpy(font_id_labels.dbSettingsGroup, MODULE);
+ strcpy(font_id_labels.prefix, "FontLabels");
+ font_id_labels.order = 1;
+
+ font_id_labels.deffontsettings.charset = DEFAULT_CHARSET;
+ font_id_labels.deffontsettings.size = -12;
+ font_id_labels.deffontsettings.style = DBFONTF_ITALIC;
+ font_id_labels.deffontsettings.colour = RGB(128, 128, 128);
+ font_id_labels.flags |= FIDF_DEFAULTVALID;
+
+ font_id_values.cbSize = sizeof(FontIDT);
+ font_id_values.flags = FIDF_ALLOWEFFECTS;
+ _tcscpy(font_id_values.group, LPGENT("Tooltips"));
+ _tcscpy(font_id_values.name, LPGENT("Values"));
+ strcpy(font_id_values.dbSettingsGroup, MODULE);
+ strcpy(font_id_values.prefix, "FontValues");
+ font_id_values.order = 2;
+
+ font_id_values.deffontsettings.charset = DEFAULT_CHARSET;
+ font_id_values.deffontsettings.size = -12;
+ font_id_values.deffontsettings.style = 0;
+ font_id_values.deffontsettings.colour = RGB(0, 0, 0);
+ font_id_values.flags |= FIDF_DEFAULTVALID;
+
+ CallService(MS_FONT_REGISTERT, (WPARAM)&font_id_title, 0);
+ CallService(MS_FONT_REGISTERT, (WPARAM)&font_id_labels, 0);
+ CallService(MS_FONT_REGISTERT, (WPARAM)&font_id_values, 0);
+
+ colour_id_bg.cbSize = sizeof(ColourIDT);
+ _tcscpy(colour_id_bg.group, LPGENT("Tooltips"));
+ _tcscpy(colour_id_bg.name, LPGENT("Background"));
+ strcpy(colour_id_bg.dbSettingsGroup, MODULE);
+ strcpy(colour_id_bg.setting, "ColourBg");
+ colour_id_bg.defcolour = RGB(219, 219, 219);
+ colour_id_bg.order = 0;
+
+ colour_id_border.cbSize = sizeof(ColourIDT);
+ _tcscpy(colour_id_border.group, LPGENT("Tooltips"));
+ _tcscpy(colour_id_border.name, LPGENT("Border"));
+ strcpy(colour_id_border.dbSettingsGroup, MODULE);
+ strcpy(colour_id_border.setting, "BorderCol");
+ colour_id_border.defcolour = 0;
+ colour_id_border.order = 0;
+
+ colour_id_divider.cbSize = sizeof(ColourIDT);
+ _tcscpy(colour_id_divider.group, LPGENT("Tooltips"));
+ _tcscpy(colour_id_divider.name, LPGENT("Dividers"));
+ strcpy(colour_id_divider.dbSettingsGroup, MODULE);
+ strcpy(colour_id_divider.setting, "DividerCol");
+ colour_id_divider.defcolour = 0;
+ colour_id_divider.order = 0;
+
+ colour_id_sidebar.cbSize = sizeof(ColourIDT);
+ _tcscpy(colour_id_sidebar.group, LPGENT("Tooltips"));
+ _tcscpy(colour_id_sidebar.name, LPGENT("Sidebar"));
+ strcpy(colour_id_sidebar.dbSettingsGroup, MODULE);
+ strcpy(colour_id_sidebar.setting, "SidebarCol");
+ colour_id_sidebar.defcolour = RGB(192, 192, 192);
+ colour_id_sidebar.order = 0;
+
+ CallService(MS_COLOUR_REGISTERT, (WPARAM)&colour_id_bg, 0);
+ CallService(MS_COLOUR_REGISTERT, (WPARAM)&colour_id_border, 0);
+ CallService(MS_COLOUR_REGISTERT, (WPARAM)&colour_id_divider, 0);
+ CallService(MS_COLOUR_REGISTERT, (WPARAM)&colour_id_sidebar, 0);
+
+ ReloadFont(0, 0);
+
+ HookEvent(ME_FONT_RELOAD, ReloadFont);
hAvChangeEvent = HookEvent(ME_AV_AVATARCHANGED, AvatarChanged);
hAvContactChangeEvent = HookEvent(ME_AV_CONTACTAVATARCHANGED, AvatarChanged);
@@ -397,13 +259,8 @@ HANDLE hEventPreShutdown, hEventModulesLoaded; extern "C" int TIPPER_API Load(PLUGINLINK *link) {
pluginLink = link;
- DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &mainThread, 0, FALSE, DUPLICATE_SAME_ACCESS);
-
set_codepage();
- char szVer[128];
- unicode_system = (CallService(MS_SYSTEM_GETVERSIONTEXT, (WPARAM)sizeof(szVer), (LPARAM)szVer) == 0 && strstr(szVer, "Unicode"));
-
mir_getMMI(&mmi);
mir_getTMI(&tmi);
@@ -425,7 +282,9 @@ extern "C" int TIPPER_API Load(PLUGINLINK *link) { // for compatibility with mToolTip status tooltips
hShowTipService = CreateServiceFunction("mToolTip/ShowTip", ShowTip);
+#ifdef _UNICODE
hShowTipWService = CreateServiceFunction("mToolTip/ShowTipW", ShowTipW);
+#endif
hHideTipService = CreateServiceFunction("mToolTip/HideTip", HideTip);
hEventPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, Shutdown);
@@ -442,12 +301,9 @@ extern "C" int TIPPER_API Unload() { UnhookEvent(hEventModulesLoaded);
DeinitOptions();
- if(ServiceExists(MS_FONT_REGISTERW)) {
- DeleteObject(hFontTitle);
- DeleteObject(hFontLabels);
- DeleteObject(hFontValues);
- } // otherwise, no need to delete the handle
+ DeleteObject(hFontTitle);
+ DeleteObject(hFontLabels);
+ DeleteObject(hFontValues);
DeinitTranslations();
- CloseHandle(mainThread);
return 0;
}
diff --git a/tipper/tipper.dsp b/tipper/tipper.dsp index 007b117..3137416 100644 --- a/tipper/tipper.dsp +++ b/tipper/tipper.dsp @@ -42,10 +42,10 @@ RSC=rc.exe # PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
-# PROP Ignore_Export_Lib 0
+# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "tipper_EXPORTS" /YX /FD /c
-# ADD CPP /nologo /MD /W3 /GX /Zi /O1 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TIPPER_EXPORTS" /Yu"common.h" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O1 /I "../../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "TIPPER_EXPORTS" /FR /Yu"common.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
@@ -55,7 +55,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib wsock32.lib /nologo /dll /map /debug /machine:I386 /out:"../../bin/Release/Plugins/tipper.dll" /filealign:512
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib /nologo /dll /map /debug /machine:I386 /filealign:512
# SUBTRACT LINK32 /pdb:none /incremental:yes
!ELSEIF "$(CFG)" == "tipper - Win32 Debug"
@@ -82,7 +82,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"../../bin/Debug/plugins/tipper.dll" /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib /nologo /dll /debug /machine:I386 /out:"../../bin/Debug/plugins/tipper.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none /incremental:no
!ELSEIF "$(CFG)" == "tipper - Win32 Release Unicode"
@@ -97,23 +97,23 @@ LINK32=link.exe # PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release_Unicode"
# PROP Intermediate_Dir "Release_Unicode"
-# PROP Ignore_Export_Lib 0
+# PROP Ignore_Export_Lib 1
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MD /W3 /GX /Zi /O1 /I "../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "NO_GZIP" /D "PNG_NO_STDIO" /D "PNG_NO_CONSOLE_IO" /FD /c
# SUBTRACT BASE CPP /YX
-# ADD CPP /nologo /MD /W3 /GX /Zi /O1 /I "../../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "UNICODE" /D "_USRDLL" /D "TIPPER_EXPORTS" /Yu"common.h" /FD /c
+# ADD CPP /nologo /MD /W3 /Zi /O1 /I "../../../include" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "UNICODE" /D "_USRDLL" /D "TIPPER_EXPORTS" /D MICROSOFT_LAYER_FOR_UNICODE=1 /Yu"common.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x419 /d "NDEBUG"
-# ADD RSC /l 0x419 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /map /debug /machine:I386 /out:"../../bin/Release/Plugins/tipper.dll" /filealign:512
# SUBTRACT BASE LINK32 /pdb:none /incremental:yes
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib wsock32.lib /nologo /dll /map /debug /machine:I386 /out:"../../bin/Release Unicode/Plugins/tipper.dll" /filealign:512
-# SUBTRACT LINK32 /pdb:none /incremental:yes
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib /nologo /dll /machine:I386 /filealign:512
+# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "tipper - Win32 Debug Unicode"
@@ -141,7 +141,7 @@ BSC32=bscmake.exe LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../../bin/Debug/plugins/tipper.dll" /pdbtype:sept
# SUBTRACT BASE LINK32 /pdb:none /incremental:no
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib comctl32.lib wsock32.lib /nologo /dll /debug /machine:I386 /out:"../../bin/Debug Unicode/plugins/tipper.dll" /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib comctl32.lib unicows.lib /nologo /dll /debug /machine:I386 /out:"../../bin/Debug Unicode/plugins/tipper.dll" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none /incremental:no
!ENDIF
diff --git a/tipper/tipper_9.vcproj b/tipper/tipper_9.vcproj index 0dc9048..f5f24c0 100644 --- a/tipper/tipper_9.vcproj +++ b/tipper/tipper_9.vcproj @@ -45,7 +45,7 @@ Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include;..\..\..\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TIPPER_EXPORTS;_UNICODE;UNICODE;MICROSOFT_LAYER_FOR_UNICODE=1"
+ PreprocessorDefinitions="_DEBUG;_USRDLL;TIPPER_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -68,8 +68,7 @@ <Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
- AdditionalDependencies="comctl32.lib wsock32.lib"
- GenerateManifest="false"
+ AdditionalDependencies="comctl32.lib"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
@@ -125,7 +124,7 @@ Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include;..\..\..\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TIPPER_EXPORTS;_UNICODE;UNICODE;MICROSOFT_LAYER_FOR_UNICODE=1"
+ PreprocessorDefinitions="_DEBUG;_USRDLL;TIPPER_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -147,9 +146,8 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="comctl32.lib wsock32.lib"
+ AdditionalDependencies="comctl32.lib"
LinkIncremental="2"
- GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
@@ -208,7 +206,7 @@ FavorSizeOrSpeed="2"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="../../include;..\..\..\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TIPPER_EXPORTS;_UNICODE;UNICODE;MICROSOFT_LAYER_FOR_UNICODE=1"
+ PreprocessorDefinitions="NDEBUG;_USRDLL;TIPPER_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="2"
@@ -233,9 +231,8 @@ <Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
- AdditionalDependencies="comctl32.lib wsock32.lib"
- GenerateManifest="false"
- IgnoreDefaultLibraryNames="Kernel32.lib Advapi32.lib User32.lib Gdi32.lib Shell32.lib Comdlg32.lib Version.lib Mpr.lib Rasapi32.lib Winmm.lib Winspool.lib Vfw32.lib Secur32.lib Oleacc.lib Oledlg.lib Sensapi.lib"
+ AdditionalDependencies="comctl32.lib"
+ IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
@@ -243,7 +240,6 @@ OptimizeForWindows98="0"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
ImportLibrary="$(IntDir)/$(TargetName).lib"
TargetMachine="1"
/>
@@ -300,7 +296,7 @@ FavorSizeOrSpeed="2"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="../../include;..\..\..\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TIPPER_EXPORTS;_UNICODE;UNICODE;MICROSOFT_LAYER_FOR_UNICODE=1"
+ PreprocessorDefinitions="NDEBUG;_USRDLL;TIPPER_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="2"
@@ -324,17 +320,15 @@ />
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="comctl32.lib wsock32.lib"
+ AdditionalDependencies="comctl32.lib"
LinkIncremental="1"
- GenerateManifest="false"
- IgnoreDefaultLibraryNames="Kernel32.lib Advapi32.lib User32.lib Gdi32.lib Shell32.lib Comdlg32.lib Version.lib Mpr.lib Rasapi32.lib Winmm.lib Winspool.lib Vfw32.lib Secur32.lib Oleacc.lib Oledlg.lib Sensapi.lib"
+ IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
@@ -385,7 +379,7 @@ Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include;..\..\..\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TIPPER_EXPORTS;_UNICODE;UNICODE;MICROSOFT_LAYER_FOR_UNICODE=1"
+ PreprocessorDefinitions="_DEBUG;_USRDLL;TIPPER_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -408,8 +402,7 @@ <Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
- AdditionalDependencies="comctl32.lib wsock32.lib"
- GenerateManifest="false"
+ AdditionalDependencies="comctl32.lib"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
@@ -466,7 +459,7 @@ Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../include;..\..\..\include"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TIPPER_EXPORTS;_UNICODE;UNICODE;MICROSOFT_LAYER_FOR_UNICODE=1"
+ PreprocessorDefinitions="_DEBUG;_USRDLL;TIPPER_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -488,9 +481,9 @@ <Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
- AdditionalDependencies="comctl32.lib wsock32.lib"
+ AdditionalDependencies="comctl32.lib"
+ OutputFile="c:\miranda im\plugins\$(ProjectName).dll"
LinkIncremental="2"
- GenerateManifest="false"
GenerateDebugInformation="true"
SubSystem="2"
RandomizedBaseAddress="1"
@@ -550,7 +543,7 @@ FavorSizeOrSpeed="2"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="../../include;..\..\..\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TIPPER_EXPORTS;_UNICODE;UNICODE;MICROSOFT_LAYER_FOR_UNICODE=1"
+ PreprocessorDefinitions="NDEBUG;_USRDLL;TIPPER_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="2"
@@ -576,16 +569,14 @@ <Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
- AdditionalDependencies="comctl32.lib wsock32.lib"
- GenerateManifest="false"
- IgnoreDefaultLibraryNames="Kernel32.lib Advapi32.lib User32.lib Gdi32.lib Shell32.lib Comdlg32.lib Version.lib Mpr.lib Rasapi32.lib Winmm.lib Winspool.lib Vfw32.lib Secur32.lib Oleacc.lib Oledlg.lib Sensapi.lib"
+ AdditionalDependencies="comctl32.lib"
+ IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
ImportLibrary="$(IntDir)/$(TargetName).lib"
TargetMachine="1"
/>
@@ -642,7 +633,7 @@ FavorSizeOrSpeed="2"
WholeProgramOptimization="true"
AdditionalIncludeDirectories="../../include;..\..\..\include"
- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;TIPPER_EXPORTS;_UNICODE;UNICODE;MICROSOFT_LAYER_FOR_UNICODE=1"
+ PreprocessorDefinitions="NDEBUG;_USRDLL;TIPPER_EXPORTS"
StringPooling="true"
ExceptionHandling="0"
RuntimeLibrary="2"
@@ -668,8 +659,8 @@ <Tool
Name="VCLinkerTool"
IgnoreImportLibrary="true"
- AdditionalDependencies="comctl32.lib wsock32.lib"
- IgnoreDefaultLibraryNames="Kernel32.lib Advapi32.lib User32.lib Gdi32.lib Shell32.lib Comdlg32.lib Version.lib Mpr.lib Rasapi32.lib Winmm.lib Winspool.lib Vfw32.lib Secur32.lib Oleacc.lib Oledlg.lib Sensapi.lib"
+ AdditionalDependencies="comctl32.lib"
+ IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
GenerateMapFile="true"
SubSystem="2"
@@ -677,7 +668,6 @@ EnableCOMDATFolding="2"
LinkTimeCodeGeneration="1"
RandomizedBaseAddress="1"
- DataExecutionPrevention="0"
TargetMachine="17"
/>
<Tool
diff --git a/tipper/translations.cpp b/tipper/translations.cpp index 34232b0..8fae442 100644 --- a/tipper/translations.cpp +++ b/tipper/translations.cpp @@ -39,76 +39,31 @@ void AddTranslation(DBVTranslation *new_trans) { }
TCHAR *null_translation(HANDLE hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) {
- DBVARIANT dbv = {0};
+ DBVARIANT dbv;
+
buff[0] = 0;
- if(ServiceExists(MS_DB_CONTACT_GETSETTING_STR)) {
- if(DBGetContactSettingStringUtf(hContact, module_name, setting_name, &dbv))
- return 0;
- } else {
- if(DBGetContactSetting(hContact, module_name, setting_name, &dbv))
- return 0;
- }
- switch(dbv.type) {
- case DBVT_DELETED:
- DBFreeVariant(&dbv);
- return 0;
- case DBVT_BYTE:
- _itot(dbv.bVal, buff, 10);
- break;
- case DBVT_WORD:
- _ltot(dbv.wVal, buff, 10);
- break;
- case DBVT_DWORD:
- _ltot(dbv.dVal, buff, 10);
- break;
- case DBVT_ASCIIZ:
- a2t(dbv.pszVal, buff, bufflen);
- buff[bufflen - 1] = 0;
- break;
- case DBVT_UTF8:
- u2t(dbv.pszVal, buff, bufflen);
- buff[bufflen - 1] = 0;
- break;
- //case DBVT_WCHAR:
- //wcsncpy(buff, dbv.pwszVal, 1024);
- //buff[bufflen - 1] = 0;
- //break;
- case DBVT_BLOB:
- default:
- DBFreeVariant(&dbv);
- return 0;
-
+ if (DBGetContactSettingTString(hContact, module_name, setting_name, &dbv))
+ return 0;
- }
+ _tcsncpy(buff, dbv.ptszVal, bufflen);
+ buff[bufflen - 1] = 0;
+
DBFreeVariant(&dbv);
- if(_tcslen(buff) == 0)
- return 0;
- return buff;
+ return buff[0] ? buff : NULL;
}
TCHAR *timestamp_to_short_date(HANDLE hContact, const char *module_name, const char *setting_name, TCHAR *buff, int bufflen) {
DWORD ts = DBGetContactSettingDword(hContact, module_name, setting_name, 0);
if(ts == 0) return 0;
- if(unicode_system) {
- DBTIMETOSTRINGT dbt = {0};
- dbt.cbDest = bufflen;
- dbt.szDest = buff;
- dbt.szFormat = _T("d");
- CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt);
- } else {
- char buffA[1024];
- DBTIMETOSTRING dbt = {0};
- dbt.cbDest = sizeof(buffA);
- dbt.szDest = buffA;
- dbt.szFormat = "d";
- CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)ts, (LPARAM)&dbt);
- a2t(buffA, buff, bufflen);
- }
+ DBTIMETOSTRINGT dbt = {0};
+ dbt.cbDest = bufflen;
+ dbt.szDest = buff;
+ dbt.szFormat = _T("d");
+ CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt);
- buff[bufflen - 1] = 0;
return buff;
}
@@ -116,23 +71,12 @@ TCHAR *timestamp_to_long_date(HANDLE hContact, const char *module_name, const ch DWORD ts = DBGetContactSettingDword(hContact, module_name, setting_name, 0);
if(ts == 0) return 0;
- if(unicode_system) {
- DBTIMETOSTRINGT dbt = {0};
- dbt.cbDest = bufflen;
- dbt.szDest = buff;
- dbt.szFormat = _T("D");
- CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt);
- } else {
- char buffA[1024];
- DBTIMETOSTRING dbt = {0};
- dbt.cbDest = sizeof(buffA);
- dbt.szDest = buffA;
- dbt.szFormat = "D";
- CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)ts, (LPARAM)&dbt);
- a2t(buffA, buff, bufflen);
- }
+ DBTIMETOSTRINGT dbt = {0};
+ dbt.cbDest = bufflen;
+ dbt.szDest = buff;
+ dbt.szFormat = _T("D");
+ CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt);
- buff[bufflen - 1] = 0;
return buff;
}
@@ -140,23 +84,12 @@ TCHAR *timestamp_to_time(HANDLE hContact, const char *module_name, const char *s DWORD ts = DBGetContactSettingDword(hContact, module_name, setting_name, 0);
if(ts == 0) return 0;
- if(unicode_system) {
- DBTIMETOSTRINGT dbt = {0};
- dbt.cbDest = bufflen;
- dbt.szDest = buff;
- dbt.szFormat = _T("s");
- CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt);
- } else {
- char buffA[1024];
- DBTIMETOSTRING dbt = {0};
- dbt.cbDest = sizeof(buffA);
- dbt.szDest = buffA;
- dbt.szFormat = "s";
- CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)ts, (LPARAM)&dbt);
- a2t(buffA, buff, bufflen);
- }
+ DBTIMETOSTRINGT dbt = {0};
+ dbt.cbDest = bufflen;
+ dbt.szDest = buff;
+ dbt.szFormat = _T("s");
+ CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt);
- buff[bufflen - 1] = 0;
return buff;
}
@@ -164,21 +97,11 @@ TCHAR *timestamp_to_time_no_secs(HANDLE hContact, const char *module_name, const DWORD ts = DBGetContactSettingDword(hContact, module_name, setting_name, 0);
if(ts == 0) return 0;
- if(unicode_system) {
- DBTIMETOSTRINGT dbt = {0};
- dbt.cbDest = bufflen;
- dbt.szDest = buff;
- dbt.szFormat = _T("t");
- CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt);
- } else {
- char buffA[1024];
- DBTIMETOSTRING dbt = {0};
- dbt.cbDest = sizeof(buffA);
- dbt.szDest = buffA;
- dbt.szFormat = "t";
- CallService(MS_DB_TIME_TIMESTAMPTOSTRING, (WPARAM)ts, (LPARAM)&dbt);
- a2t(buffA, buff, bufflen);
- }
+ DBTIMETOSTRINGT dbt = {0};
+ dbt.cbDest = bufflen;
+ dbt.szDest = buff;
+ dbt.szFormat = _T("t");
+ CallService(MS_DB_TIME_TIMESTAMPTOSTRINGT, (WPARAM)ts, (LPARAM)&dbt);
return buff;
}
|