From fc02c04506fee6ae6412cff63a6b7536da0a7c00 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Fri, 18 May 2012 18:02:47 +0000 Subject: tipper my patch git-svn-id: http://svn.miranda-ng.org/main/trunk@50 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TipperYM/common.h | 2 +- plugins/TipperYM/options.cpp | 25 ++--- plugins/TipperYM/options.h | 6 +- plugins/TipperYM/popwin.cpp | 47 ++++----- plugins/TipperYM/skin_parser.cpp | 204 +++++++++++++++++++-------------------- plugins/TipperYM/skin_parser.h | 2 +- plugins/TipperYM/str_utils.cpp | 8 +- plugins/TipperYM/str_utils.h | 2 +- plugins/TipperYM/tipper.cpp | 32 +++--- 9 files changed, 159 insertions(+), 169 deletions(-) (limited to 'plugins') diff --git a/plugins/TipperYM/common.h b/plugins/TipperYM/common.h index 930fe28d3c..90482fbac1 100644 --- a/plugins/TipperYM/common.h +++ b/plugins/TipperYM/common.h @@ -99,7 +99,7 @@ Boston, MA 02111-1307, USA. #define MODULE "Tipper" #define MODULE_ITEMS "Tipper_Items" -#define DEFAULT_SKIN_FOLDER "skins\\Tipper" +#define DEFAULT_SKIN_FOLDER "Skins\\Tipper" extern HMODULE hInst; extern PLUGINLINK *pluginLink; diff --git a/plugins/TipperYM/options.cpp b/plugins/TipperYM/options.cpp index 5c6e8e049e..597f0eb76b 100644 --- a/plugins/TipperYM/options.cpp +++ b/plugins/TipperYM/options.cpp @@ -336,9 +336,9 @@ void LoadObsoleteSkinSetting() mir_snprintf(setting, 128, "SPaintMode%d", i); opt.transfMode[i] = (TransformationMode)DBGetContactSettingByte(0, MODULE, setting, 0); mir_snprintf(setting, 128, "SImgFile%d", i); - if (!DBGetContactSettingString(NULL, MODULE, setting, &dbv)) + if (!DBGetContactSettingTString(NULL, MODULE, setting, &dbv)) { - opt.szImgFile[i] = mir_strdup(dbv.pszVal); + opt.szImgFile[i] = mir_tstrdup(dbv.ptszVal); DBFreeVariant(&dbv); } @@ -564,9 +564,9 @@ void LoadOptions() } else if (opt.skinMode == SM_IMAGE) { - if (!DBGetContactSettingString(NULL, MODULE, "SkinName", &dbv)) + if (!DBGetContactSettingTString(NULL, MODULE, "SkinName", &dbv)) { - strcpy(opt.szSkinName, dbv.pszVal); + _tcscpy(opt.szSkinName, dbv.ptszVal); DBFreeVariant(&dbv); } } @@ -1998,11 +1998,7 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l { TCHAR swzSkinName[256]; if (ListBox_GetText(hwndList, iSel, swzSkinName) > 0) - { - char *skin = mir_t2a(swzSkinName); - ParseSkinFile(skin, false, true); - mir_free(skin); - } + ParseSkinFile(swzSkinName, false, true); EnableControls(hwndDlg, TRUE); if (opt.iEnableColoring != -1) CheckDlgButton(hwndDlg, IDC_CHK_ENABLECOLORING, opt.iEnableColoring ? 1 : 0); @@ -2031,11 +2027,9 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l } else if (iSel != LB_ERR) { - TCHAR swzSkinName[256]; - if (ListBox_GetText(GetDlgItem(hwndDlg, IDC_LB_SKINS), iSel, swzSkinName) > 0) + if (ListBox_GetText(GetDlgItem(hwndDlg, IDC_LB_SKINS), iSel, opt.szSkinName) > 0) { opt.skinMode = SM_IMAGE; - t2a(swzSkinName, opt.szSkinName, sizeof(opt.szSkinName)); ParseSkinFile(opt.szSkinName, false, false); ReloadFont(0, 0); SaveOptions(); @@ -2043,7 +2037,7 @@ INT_PTR CALLBACK DlgProcOptsSkin(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l } DBWriteContactSettingByte(0, MODULE, "SkinEngine", opt.skinMode); - DBWriteContactSettingString(0, MODULE, "SkinName", opt.szSkinName); + DBWriteContactSettingTString(0, MODULE, "SkinName", opt.szSkinName); DestroySkinBitmap(); SetDlgItemInt(hwndDlg, IDC_ED_TRANS, opt.iOpacity, FALSE); @@ -2439,9 +2433,8 @@ int OptInit(WPARAM wParam, LPARAM lParam) CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp ); odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN); - odp.ptszTab = LPGENT("Tooltip skin"); - odp.ptszTitle = LPGENT("Tooltips"); - odp.ptszGroup = LPGENT("Customize"); + odp.ptszTab = LPGENT("Tooltips"); + odp.ptszGroup = LPGENT("Skins"); odp.nIDBottomSimpleControl = 0; odp.pfnDlgProc = DlgProcOptsSkin; CallService( MS_OPT_ADDPAGE, wParam,( LPARAM )&odp ); diff --git a/plugins/TipperYM/options.h b/plugins/TipperYM/options.h index 4866b09a8b..52411110fb 100644 --- a/plugins/TipperYM/options.h +++ b/plugins/TipperYM/options.h @@ -145,9 +145,9 @@ typedef struct { // tooltip skin SkinMode skinMode; - char szSkinName[256]; - char szPreviewFile[1024]; - char *szImgFile[SKIN_ITEMS_COUNT]; + TCHAR szSkinName[256]; + TCHAR szPreviewFile[1024]; + TCHAR *szImgFile[SKIN_ITEMS_COUNT]; MARGINS margins[SKIN_ITEMS_COUNT]; TransformationMode transfMode[SKIN_ITEMS_COUNT]; PopupShowEffect showEffect; diff --git a/plugins/TipperYM/popwin.cpp b/plugins/TipperYM/popwin.cpp index 30976d1125..ce98801312 100644 --- a/plugins/TipperYM/popwin.cpp +++ b/plugins/TipperYM/popwin.cpp @@ -55,8 +55,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa memset(pwd, 0, sizeof(PopupWindowData)); pwd->clcit = *(CLCINFOTIPEX *)cs->lpCreateParams; pwd->iIconIndex = -1; - pwd->hpenBorder = opt.bBorder ? (HPEN)CreatePen(PS_SOLID, 1, opt.colBorder) : (HPEN)CreatePen(PS_SOLID, 1, opt.colBg); - pwd->hpenDivider = (HPEN)CreatePen(PS_SOLID, 1, opt.colDivider); + pwd->hpenBorder = CreatePen(PS_SOLID, 1, opt.bBorder ? opt.colBorder : opt.colBg); + pwd->hpenDivider = CreatePen(PS_SOLID, 1, opt.colDivider); pwd->iTrans = (int)(opt.iOpacity / 100.0 * 255); // load icons order @@ -95,7 +95,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (pwd->bIsIconVisible[0]) { WORD status = CallProtoService(pwd->clcit.szProto, PS_GETSTATUS, 0, 0); - pwd->extraIcons[0].hIcon = (HICON)LoadSkinnedProtoIcon(pwd->clcit.szProto, status); + pwd->extraIcons[0].hIcon = LoadSkinnedProtoIcon(pwd->clcit.szProto, status); pwd->extraIcons[0].bDestroy = false; } @@ -136,12 +136,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa // protocol status WORD wStatus = (WORD)CallProtoService(pwd->clcit.szProto, PS_GETSTATUS, 0, 0); - char *szStatus = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wStatus,0); - if (szStatus) + TCHAR *swzText = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR); + if (swzText) { - TCHAR *swzText = mir_a2t(szStatus); AddRow(pwd, TranslateT("Status:"), swzText, NULL, false, false, false); - mir_free(swzText); } if (wStatus >= ID_STATUS_ONLINE && wStatus <= ID_STATUS_OUTTOLUNCH) @@ -778,19 +776,17 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa SetTextColor(hdc, opt.colValue); if (bUseRect) { - if (pwd->rows[i].bValueNewline) - tr.left = r.left + opt.iPadding + pwd->iIndent; - else - tr.left = r.left + opt.iPadding + pwd->iIndent + pwd->iLabelWidth + opt.iValueIndent; + tr.left = r.left + opt.iPadding + pwd->iIndent; + if (!pwd->rows[i].bValueNewline) + tr.left += pwd->iLabelWidth + opt.iValueIndent; tr.right = r.right - opt.iPadding; } else { - if (pwd->rows[i].bValueNewline) - tr.left = r2.left + opt.iPadding + pwd->iIndent; - else - tr.left = r2.left + opt.iPadding + pwd->iIndent + pwd->iLabelWidth + opt.iValueIndent; + tr.left = r2.left + opt.iPadding + pwd->iIndent; + if (!pwd->rows[i].bValueNewline) + tr.left += pwd->iLabelWidth + opt.iValueIndent; tr.right = r2.right - opt.iPadding; } @@ -846,9 +842,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa { if (LOWORD(lParam) == MOD_CONTROL && HIWORD(lParam) == 0x43) // CTRL+C { - HICON hIcon; ICONINFO iconInfo; - HBITMAP hbmpAllItems, hbmpItem; if (pwd->iRowCount == 0) return 0; @@ -857,7 +851,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa HMENU hMenu = CreatePopupMenu(); if (!hMenu) return 0; - hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ITEM_ALL), IMAGE_ICON, 0, 0, LR_LOADTRANSPARENT); + HICON hIcon = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ITEM_ALL), IMAGE_ICON, 0, 0, LR_LOADTRANSPARENT); if (!hIcon) { DestroyMenu(hMenu); @@ -865,14 +859,15 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } GetIconInfo(hIcon, &iconInfo); - hbmpAllItems = iconInfo.hbmColor; + HBITMAP hbmpAllItems = iconInfo.hbmColor; DestroyIcon(hIcon); - AppendMenu(hMenu, MF_STRING, COPYMENU_ALLITEMS_LABELS, TranslateT("Copy all items with labels")); - AppendMenu(hMenu, MF_STRING, COPYMENU_ALLITEMS, TranslateT("Copy all items")); + AppendMenu(hMenu, MF_STRING, COPYMENU_ALLITEMS_LABELS, LPGENT("Copy all items with labels")); + AppendMenu(hMenu, MF_STRING, COPYMENU_ALLITEMS, LPGENT("Copy all items")); if (pwd->clcit.szProto || pwd->hContact) - AppendMenu(hMenu, MF_STRING, COPYMENU_AVATAR, TranslateT("Copy avatar")); + AppendMenu(hMenu, MF_STRING, COPYMENU_AVATAR, LPGENT("Copy avatar")); AppendMenu(hMenu, MF_SEPARATOR, 2000, 0); + TranslateMenu(hMenu); SetMenuItemBitmaps(hMenu, COPYMENU_ALLITEMS_LABELS, MF_BYCOMMAND, hbmpAllItems, hbmpAllItems); SetMenuItemBitmaps(hMenu, COPYMENU_ALLITEMS, MF_BYCOMMAND, hbmpAllItems, hbmpAllItems); @@ -887,7 +882,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa } GetIconInfo(hIcon, &iconInfo); - hbmpItem = iconInfo.hbmColor; + HBITMAP hbmpItem = iconInfo.hbmColor; DestroyIcon(hIcon); for (int i = 0; i < pwd->iRowCount; i++) @@ -1806,12 +1801,10 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa if (dwItems & TRAYTIP_STATUS) { - char *szStatus = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)wStatus, (LPARAM)0); - if (szStatus) + TCHAR *swzText = (TCHAR *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, wStatus, GSMDF_TCHAR); + if (swzText) { - TCHAR *swzText = mir_a2t(szStatus); AddRow(pwd, TranslateT("Status:"), swzText, NULL, false, false, false); - mir_free(swzText); } } diff --git a/plugins/TipperYM/skin_parser.cpp b/plugins/TipperYM/skin_parser.cpp index 4f586eef2d..3c851e0039 100644 --- a/plugins/TipperYM/skin_parser.cpp +++ b/plugins/TipperYM/skin_parser.cpp @@ -22,7 +22,7 @@ Boston, MA 02111-1307, USA. #include "options.h" #include "str_utils.h" -extern char SKIN_FOLDER[256]; +extern TCHAR SKIN_FOLDER[256]; int RefreshSkinList(HWND hwndDlg) { @@ -30,9 +30,9 @@ int RefreshSkinList(HWND hwndDlg) ListBox_ResetContent(hwndSkins); ListBox_AddString(hwndSkins, TranslateT("# Solid color fill")); - char szDirSave[1024]; - GetCurrentDirectoryA(1024, szDirSave); - SetCurrentDirectoryA(SKIN_FOLDER); + TCHAR szDirSave[1024]; + GetCurrentDirectory(1024, szDirSave); + SetCurrentDirectory(SKIN_FOLDER); WIN32_FIND_DATA ffd; HANDLE hFind = FindFirstFile(_T("*.*"), &ffd); @@ -55,16 +55,14 @@ int RefreshSkinList(HWND hwndDlg) } FindClose(hFind); - SetCurrentDirectoryA(szDirSave); + SetCurrentDirectory(szDirSave); - TCHAR swzSkinName[256]; - a2t(opt.szSkinName, swzSkinName, 256); - return ListBox_SelectString(GetDlgItem(hwndDlg, IDC_LB_SKINS), -1, swzSkinName); + return ListBox_SelectString(GetDlgItem(hwndDlg, IDC_LB_SKINS), -1, opt.szSkinName); } -bool FileExists(char *filename) +bool FileExists(TCHAR *filename) { - HANDLE hFile = CreateFileA(filename, 0, 0, 0, OPEN_EXISTING, 0, 0); + HANDLE hFile = CreateFile(filename, 0, 0, 0, OPEN_EXISTING, 0, 0); if (hFile != INVALID_HANDLE_VALUE) { CloseHandle(hFile); @@ -74,14 +72,14 @@ bool FileExists(char *filename) return false; } -void ParseAboutPart(FILE *fp, char *buff, char *szSkinName) +void ParseAboutPart(FILE *fp, TCHAR *buff, TCHAR *szSkinName) { myfgets(buff, 1024, fp); while (buff[0] != '[') { if (buff[0] != ';') { - char *pch = strchr(buff, '='); + TCHAR *pch = _tcschr(buff, '='); if (pch++) { while (pch && (*pch == ' ' || *pch == '\t')) @@ -89,14 +87,14 @@ void ParseAboutPart(FILE *fp, char *buff, char *szSkinName) if (pch) { - if (strstr(buff, "author")) + if (_tcsstr(buff, _T("author"))) {} - else if (strstr(buff, "preview")) + else if (_tcsstr(buff, _T("preview"))) { - char szImgPath[1024]; - mir_snprintf(szImgPath, SIZEOF(szImgPath), "%s\\%s\\%s", SKIN_FOLDER, szSkinName, pch); + TCHAR szImgPath[1024]; + mir_sntprintf(szImgPath, SIZEOF(szImgPath), _T("%s\\%s\\%s"), SKIN_FOLDER, szSkinName, pch); if (FileExists(szImgPath)) - strcpy(opt.szPreviewFile, szImgPath); + _tcscpy(opt.szPreviewFile, szImgPath); } } } @@ -107,7 +105,7 @@ void ParseAboutPart(FILE *fp, char *buff, char *szSkinName) } } -void ParseImagePart(FILE *fp, char *buff, int iPart) +void ParseImagePart(FILE *fp, TCHAR *buff, int iPart) { opt.szImgFile[iPart] = NULL; opt.transfMode[iPart] = TM_NONE; @@ -121,7 +119,7 @@ void ParseImagePart(FILE *fp, char *buff, int iPart) { if (buff[0] != ';') { - char *pch = strchr(buff, '='); + TCHAR *pch = _tcschr(buff, '='); if (pch++) { while (pch && (*pch == ' ' || *pch == '\t')) @@ -129,41 +127,41 @@ void ParseImagePart(FILE *fp, char *buff, int iPart) if (pch) { - if (strstr(buff, "image")) + if (_tcsstr(buff, _T("image"))) { - char szImgPath[1024]; - mir_snprintf(szImgPath, SIZEOF(szImgPath), "%s\\%s\\%s", SKIN_FOLDER, opt.szSkinName, pch); - opt.szImgFile[iPart] = mir_strdup(szImgPath); + TCHAR szImgPath[1024]; + mir_sntprintf(szImgPath, SIZEOF(szImgPath), _T("%s\\%s\\%s"), SKIN_FOLDER, opt.szSkinName, pch); + opt.szImgFile[iPart] = mir_tstrdup(szImgPath); } - else if (strstr(buff, "tm")) + else if (_tcsstr(buff, _T("tm"))) { - if (!lstrcmpiA(pch, "TM_NONE")) + if (!lstrcmpi(pch, _T("TM_NONE"))) opt.transfMode[iPart] = TM_NONE; - else if (!lstrcmpiA(pch, "TM_CENTRE")) + else if (!lstrcmpi(pch, _T("TM_CENTRE"))) opt.transfMode[iPart] = TM_CENTRE; - else if (!lstrcmpiA(pch, "TM_STRECH_ALL")) + else if (!lstrcmpi(pch, _T("TM_STRECH_ALL"))) opt.transfMode[iPart] = TM_STRECH_ALL; - else if (!lstrcmpiA(pch, "TM_STRECH_HORIZONTAL")) + else if (!lstrcmpi(pch, _T("TM_STRECH_HORIZONTAL"))) opt.transfMode[iPart] = TM_STRECH_HORIZONTAL; - else if (!lstrcmpiA(pch, "TM_STRECH_VERTICAL")) + else if (!lstrcmpi(pch, _T("TM_STRECH_VERTICAL"))) opt.transfMode[iPart] = TM_STRECH_VERTICAL; - else if (!lstrcmpiA(pch, "TM_TILE_ALL")) + else if (!lstrcmpi(pch, _T("TM_TILE_ALL"))) opt.transfMode[iPart] = TM_TILE_ALL; - else if (!lstrcmpiA(pch, "TM_TILE_HORIZONTAL")) + else if (!lstrcmpi(pch, _T("TM_TILE_HORIZONTAL"))) opt.transfMode[iPart] = TM_TILE_HORIZONTAL; - else if (!lstrcmpiA(pch, "TM_TILE_VERTICAL")) + else if (!lstrcmpi(pch, _T("TM_TILE_VERTICAL"))) opt.transfMode[iPart] = TM_TILE_VERTICAL; else opt.transfMode[iPart] = TM_NONE; } - else if (strstr(buff, "left")) - opt.margins[iPart].left = atoi(pch); - else if (strstr(buff, "top")) - opt.margins[iPart].top = atoi(pch); - else if (strstr(buff, "right")) - opt.margins[iPart].right = atoi(pch); - else if (strstr(buff, "bottom")) - opt.margins[iPart].bottom = atoi(pch); + else if (_tcsstr(buff, _T("left"))) + opt.margins[iPart].left = _ttoi(pch); + else if (_tcsstr(buff, _T("top"))) + opt.margins[iPart].top = _ttoi(pch); + else if (_tcsstr(buff, _T("right"))) + opt.margins[iPart].right = _ttoi(pch); + else if (_tcsstr(buff, _T("bottom"))) + opt.margins[iPart].bottom = _ttoi(pch); } } } @@ -173,26 +171,26 @@ void ParseImagePart(FILE *fp, char *buff, int iPart) } } -char *GetSettingName(char *szValue, char *szPostfix, char *buff) +char *GetSettingName(TCHAR *szValue, char *szPostfix, char *buff) { buff[0] = 0; - if (strstr(szValue, "traytitle")) + if (_tcsstr(szValue, _T("traytitle"))) mir_snprintf(buff, 64, "FontTrayTitle%s", szPostfix); - else if (strstr(szValue, "title")) + else if (_tcsstr(szValue, _T("title"))) mir_snprintf(buff, 64, "FontFirst%s", szPostfix); - else if (strstr(szValue, "label")) + else if (_tcsstr(szValue, _T("label"))) mir_snprintf(buff, 64, "FontLabels%s", szPostfix); - else if (strstr(szValue, "value")) + else if (_tcsstr(szValue, _T("value"))) mir_snprintf(buff, 64, "FontValues%s", szPostfix); - else if (strstr(szValue, "divider")) + else if (_tcsstr(szValue, _T("divider"))) mir_snprintf(buff, 64, "Divider%s", szPostfix); if (buff[0]) return buff; else return NULL; } -void ParseFontPart(FILE *fp, char *buff) +void ParseFontPart(FILE *fp, TCHAR *buff) { char szSetting[64]; @@ -201,7 +199,7 @@ void ParseFontPart(FILE *fp, char *buff) { if (buff[0] != ';') { - char *pch = strchr(buff, '='); + TCHAR *pch = _tcschr(buff, '='); if (pch++) { while (pch && (*pch == ' ' || *pch == '\t')) @@ -209,57 +207,55 @@ void ParseFontPart(FILE *fp, char *buff) if (pch) { - if (strstr(buff, "face")) + if (_tcsstr(buff, _T("face"))) { if (GetSettingName(buff, "", szSetting)) { - if (strlen(pch) > 32) + if (_tcslen(pch) > 32) pch[32] = 0; - TCHAR *tmp = mir_a2t(pch); - DBWriteContactSettingTString(0, MODULE, szSetting, tmp); - mir_free(tmp); + DBWriteContactSettingTString(0, MODULE, szSetting, pch); } } - else if (strstr(buff, "color")) + else if (_tcsstr(buff, _T("color"))) { if (GetSettingName(buff, "Col", szSetting)) { - BYTE r = atoi(pch); - pch = strchr(pch, ' '); + BYTE r = _ttoi(pch); + pch = _tcschr(pch, ' '); if (++pch) { - BYTE g = atoi(pch); - pch = strchr(pch, ' '); + BYTE g = _ttoi(pch); + pch = _tcschr(pch, ' '); if (++pch) { - BYTE b = atoi(pch); + BYTE b = _ttoi(pch); COLORREF color = RGB(r, g ,b); DBWriteContactSettingDword(0, MODULE, szSetting, color); } } } } - else if (strstr(buff, "size")) + else if (_tcsstr(buff, _T("size"))) { if (GetSettingName(buff, "Size", szSetting)) { HDC hdc = GetDC(0); - int size = -MulDiv(atoi(pch), GetDeviceCaps(hdc, LOGPIXELSY), 72); + int size = -MulDiv(_ttoi(pch), GetDeviceCaps(hdc, LOGPIXELSY), 72); DBWriteContactSettingByte(0, MODULE, szSetting, (BYTE)size); ReleaseDC(0, hdc); } } - else if (strstr(buff, "effect")) + else if (_tcsstr(buff, _T("effect"))) { if (GetSettingName(buff, "Sty", szSetting)) { BYTE effect = 0; - if (strstr(pch, "font_bold")) + if (_tcsstr(pch, _T("font_bold"))) effect |= DBFONTF_BOLD; - if (strstr(pch, "font_italic")) + if (_tcsstr(pch, _T("font_italic"))) effect |= DBFONTF_ITALIC; - if (strstr(pch, "font_underline")) + if (_tcsstr(pch, _T("font_underline"))) effect |= DBFONTF_UNDERLINE; DBWriteContactSettingByte(0, MODULE, szSetting, effect); @@ -274,14 +270,14 @@ void ParseFontPart(FILE *fp, char *buff) } } -void ParseAppearancePart(FILE *fp, char *buff) +void ParseAppearancePart(FILE *fp, TCHAR *buff) { myfgets(buff, 1024, fp); while (buff[0] != '[') { if (buff[0] != ';') { - char *pch = strchr(buff, '='); + TCHAR *pch = _tcschr(buff, '='); if (pch++) { while (pch && (*pch == ' ' || *pch == '\t')) @@ -289,24 +285,24 @@ void ParseAppearancePart(FILE *fp, char *buff) if (pch) { - if (strstr(buff, "general-padding")) - opt.iPadding = atoi(pch); - else if (strstr(buff, "title-indent")) - opt.iTitleIndent = atoi(pch); - else if (strstr(buff, "text-indent")) - opt.iTextIndent = atoi(pch); - else if (strstr(buff, "value-indent")) - opt.iValueIndent = atoi(pch); - else if (strstr(buff, "text-padding")) - opt.iTextPadding = atoi(pch); - else if (strstr(buff, "outer-avatar-padding")) - opt.iOuterAvatarPadding = atoi(pch); - else if (strstr(buff, "inner-avatar-padding")) - opt.iInnerAvatarPadding = atoi(pch); - else if (strstr(buff, "sidebar-width")) - opt.iSidebarWidth = atoi(pch); - else if (strstr(buff, "opacity")) - opt.iOpacity = atoi(pch); + if (_tcsstr(buff, _T("general-padding"))) + opt.iPadding = _ttoi(pch); + else if (_tcsstr(buff, _T("title-indent"))) + opt.iTitleIndent = _ttoi(pch); + else if (_tcsstr(buff, _T("text-indent"))) + opt.iTextIndent = _ttoi(pch); + else if (_tcsstr(buff, _T("value-indent"))) + opt.iValueIndent = _ttoi(pch); + else if (_tcsstr(buff, _T("text-padding"))) + opt.iTextPadding = _ttoi(pch); + else if (_tcsstr(buff, _T("outer-avatar-padding"))) + opt.iOuterAvatarPadding = _ttoi(pch); + else if (_tcsstr(buff, _T("inner-avatar-padding"))) + opt.iInnerAvatarPadding = _ttoi(pch); + else if (_tcsstr(buff, _T("sidebar-width"))) + opt.iSidebarWidth = _ttoi(pch); + else if (_tcsstr(buff, _T("opacity"))) + opt.iOpacity = _ttoi(pch); } } } @@ -316,14 +312,14 @@ void ParseAppearancePart(FILE *fp, char *buff) } } -void ParseOtherPart(FILE *fp, char *buff) +void ParseOtherPart(FILE *fp, TCHAR *buff) { myfgets(buff, 1024, fp); while (buff[0] != '[') { if (buff[0] != ';') { - char *pch = strchr(buff, '='); + TCHAR *pch = _tcschr(buff, '='); if (pch++) { while (pch && (*pch == ' ' || *pch == '\t')) @@ -331,9 +327,9 @@ void ParseOtherPart(FILE *fp, char *buff) if (pch) { - if (strstr(buff, "enable-coloring")) + if (_tcsstr(buff, _T("enable-coloring"))) { - if (strstr(pch, "false")) + if (_tcsstr(pch, _T("false"))) opt.iEnableColoring = -1; } } @@ -345,9 +341,9 @@ void ParseOtherPart(FILE *fp, char *buff) } } -void ParseSkinFile(char *szSkinName, bool bStartup, bool bOnlyPreview) +void ParseSkinFile(TCHAR *szSkinName, bool bStartup, bool bOnlyPreview) { - char szDirSave[1024], buff[1024]; + TCHAR szDirSave[1024], buff[1024]; if (opt.skinMode == SM_OBSOLOTE && bStartup) return; @@ -355,15 +351,15 @@ void ParseSkinFile(char *szSkinName, bool bStartup, bool bOnlyPreview) if (!bStartup) opt.iEnableColoring = 0; opt.szPreviewFile[0] = 0; - GetCurrentDirectoryA(1024, szDirSave); - SetCurrentDirectoryA(SKIN_FOLDER); - SetCurrentDirectoryA(szSkinName); + GetCurrentDirectory(1024, szDirSave); + SetCurrentDirectory(SKIN_FOLDER); + SetCurrentDirectory(szSkinName); - WIN32_FIND_DATAA ffd; - HANDLE hFind = FindFirstFileA("*.tsf", &ffd); + WIN32_FIND_DATA ffd; + HANDLE hFind = FindFirstFile(_T("*.tsf"), &ffd); if (hFind != INVALID_HANDLE_VALUE) { - FILE *fp = fopen(ffd.cFileName, "r"); + FILE *fp = _tfopen(ffd.cFileName, _T("r")); if (fp) { myfgets(buff, 1024, fp); @@ -371,34 +367,34 @@ void ParseSkinFile(char *szSkinName, bool bStartup, bool bOnlyPreview) { if (buff[0] == '[') { - if (!strcmp("[about]", buff)) + if (!_tcscmp(_T("[about]"), buff)) { ParseAboutPart(fp, buff, szSkinName); continue; } - else if (!strcmp("[other]", buff)) + else if (!_tcscmp(_T("[other]"), buff)) { ParseOtherPart(fp, buff); continue; } else if (!bOnlyPreview) { - if (!strcmp("[background]", buff)) + if (!_tcscmp(_T("[background]"), buff)) { ParseImagePart(fp, buff, SKIN_ITEM_BG); continue; } - else if (!strcmp("[sidebar]", buff)) + else if (!_tcscmp(_T("[sidebar]"), buff)) { ParseImagePart(fp, buff, SKIN_ITEM_SIDEBAR); continue; } - else if (!bStartup && opt.bLoadFonts && !strcmp("[fonts]", buff)) + else if (!bStartup && opt.bLoadFonts && !_tcscmp(_T("[fonts]"), buff)) { ParseFontPart(fp, buff); continue; } - else if (!bStartup && opt.bLoadProportions && !strcmp("[appearance]", buff)) + else if (!bStartup && opt.bLoadProportions && !_tcscmp(_T("[appearance]"), buff)) { ParseAppearancePart(fp, buff); continue; @@ -417,5 +413,5 @@ void ParseSkinFile(char *szSkinName, bool bStartup, bool bOnlyPreview) } FindClose(hFind); - SetCurrentDirectoryA(szDirSave); + SetCurrentDirectory(szDirSave); } \ No newline at end of file diff --git a/plugins/TipperYM/skin_parser.h b/plugins/TipperYM/skin_parser.h index 35e5b552ab..ca83f47915 100644 --- a/plugins/TipperYM/skin_parser.h +++ b/plugins/TipperYM/skin_parser.h @@ -26,5 +26,5 @@ typedef enum { } SkinMode; int RefreshSkinList(HWND hwndDlg); -void ParseSkinFile(char *szSkinName, bool bStartup, bool bOnlyPreview); +void ParseSkinFile(TCHAR *szSkinName, bool bStartup, bool bOnlyPreview); #endif \ No newline at end of file diff --git a/plugins/TipperYM/str_utils.cpp b/plugins/TipperYM/str_utils.cpp index 62d877f7e2..0e9b67f73f 100644 --- a/plugins/TipperYM/str_utils.cpp +++ b/plugins/TipperYM/str_utils.cpp @@ -249,10 +249,10 @@ char *t2utf(const TCHAR *ts) #endif } -char *myfgets(char *Buf, int MaxCount, FILE *File) +TCHAR *myfgets(TCHAR *Buf, int MaxCount, FILE *File) { - fgets(Buf, MaxCount, File); - for (size_t i = strlen(Buf) - 1; i >= 0; i--) + _fgetts(Buf, MaxCount, File); + for (size_t i = _tcslen(Buf) - 1; i >= 0; i--) { if (Buf[i] == '\n' || Buf[i] == ' ') Buf[i] = 0; @@ -260,6 +260,6 @@ char *myfgets(char *Buf, int MaxCount, FILE *File) break; } - CharLowerA(Buf); + CharLower(Buf); return Buf; } \ No newline at end of file diff --git a/plugins/TipperYM/str_utils.h b/plugins/TipperYM/str_utils.h index deedcacfa1..26fbb613fa 100644 --- a/plugins/TipperYM/str_utils.h +++ b/plugins/TipperYM/str_utils.h @@ -60,7 +60,7 @@ char *t2utf(const TCHAR *ts); char *t2a(const TCHAR *ts); TCHAR *a2t(const char *as); -char *myfgets(char *Buf, int MaxCount, FILE *File); +TCHAR *myfgets(TCHAR *Buf, int MaxCount, FILE *File); #endif diff --git a/plugins/TipperYM/tipper.cpp b/plugins/TipperYM/tipper.cpp index 0c1f21f9bf..062b5c87c9 100644 --- a/plugins/TipperYM/tipper.cpp +++ b/plugins/TipperYM/tipper.cpp @@ -38,25 +38,31 @@ HFONT hFontTitle, hFontLabels, hFontValues, hFontTrayTitle; HANDLE hAvChangeEvent, hShowTipEvent, hHideTipEvent, hAckEvent, hFramesSBShow, hFramesSBHide; HANDLE hSettingChangedEvent, hEventDeleted; HANDLE hShowTipService, hShowTipWService, hHideTipService; +HANDLE hReloadFonts = NULL; HANDLE hFolderChanged, hSkinFolder; -char SKIN_FOLDER[256]; +TCHAR SKIN_FOLDER[256]; FI_INTERFACE *fii = NULL; MM_INTERFACE mmi; LIST_INTERFACE li; TIME_API tmi; +int hLangpack; PLUGININFOEX pluginInfoEx = { sizeof(PLUGININFOEX), -#ifdef _WIN64 - "Tipper YM x64", +#if defined (_UNICODE) + #if defined _WIN64 + "Tipper YM (Unicode x64)", + #else + "Tipper YM (Unicode)", + #endif #else "Tipper YM", #endif __VERSION_DWORD, - "Tool Tip notification windows", + "Tool Tip notification windows.", "Scott Ellis, yaho", "yaho@miranda-easy.net", "© 2005-2007 Scott Ellis, 2007-2011 Jan Holub", @@ -140,7 +146,7 @@ int EventDeleted(WPARAM wParam, LPARAM lParam) int ReloadSkinFolder(WPARAM wParam, LPARAM lParam) { - FoldersGetCustomPath(hSkinFolder, SKIN_FOLDER, sizeof(SKIN_FOLDER), DEFAULT_SKIN_FOLDER); + FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, SIZEOF(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER)); return 0; } @@ -256,12 +262,12 @@ void InitFonts() fontTrayTitle.deffontsettings.colour = RGB(0, 0, 0); fontTrayTitle.flags |= FIDF_DEFAULTVALID; - CallService(MS_FONT_REGISTERT, (WPARAM)&fontTitle, 0); - CallService(MS_FONT_REGISTERT, (WPARAM)&fontLabels, 0); - CallService(MS_FONT_REGISTERT, (WPARAM)&fontValues, 0); - CallService(MS_FONT_REGISTERT, (WPARAM)&fontTrayTitle, 0); + FontRegisterT(&fontTitle); + FontRegisterT(&fontLabels); + FontRegisterT(&fontValues); + FontRegisterT(&fontTrayTitle); - HookEvent(ME_FONT_RELOAD, ReloadFont); + hReloadFonts = HookEvent(ME_FONT_RELOAD, ReloadFont); } void InitUpdaterSupport() @@ -304,8 +310,8 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam) hFolderChanged = HookEvent(ME_FOLDERS_PATH_CHANGED, ReloadSkinFolder); - hSkinFolder = FoldersRegisterCustomPath(MODULE, "Tipper skins", MIRANDA_PATH "\\" DEFAULT_SKIN_FOLDER); - FoldersGetCustomPath(hSkinFolder, SKIN_FOLDER, sizeof(SKIN_FOLDER), DEFAULT_SKIN_FOLDER); + hSkinFolder = FoldersRegisterCustomPathT(MODULE, "Tipper skins", MIRANDA_PATHT _T("\\") _T(DEFAULT_SKIN_FOLDER)); + FoldersGetCustomPathT(hSkinFolder, SKIN_FOLDER, SIZEOF(SKIN_FOLDER), _T(DEFAULT_SKIN_FOLDER)); InitTipperSmileys(); LoadOptions(); @@ -360,6 +366,7 @@ extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) CallService(MS_IMG_GETINTERFACE, FI_IF_VERSION, (LPARAM)&fii); mir_getTMI(&tmi); + mir_getLP(&pluginInfoEx); if (ServiceExists(MS_LANGPACK_GETCODEPAGE)) iCodePage = CallService(MS_LANGPACK_GETCODEPAGE, 0, 0); @@ -390,6 +397,7 @@ extern "C" int __declspec(dllexport) Unload() UnhookEvent(hEventDeleted); UnhookEvent(hEventPreShutdown); UnhookEvent(hEventModulesLoaded); + UnhookEvent(hReloadFonts); DeinitOptions(); DeleteObject(hFontTitle); -- cgit v1.2.3