From 8725517f626b8c7c43e3800ad7dcae99cec0649c Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 11 Apr 2013 13:17:15 +0000 Subject: Unicode, auto-translatable tooltips for Srmm icons git-svn-id: http://svn.miranda-ng.org/main/trunk@4423 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- include/m_message.h | 43 +++-- plugins/FavContacts/src/main.cpp | 2 +- plugins/FingerprintNG/src/fingerprint.cpp | 5 +- plugins/HistorySweeperLight/src/main.cpp | 14 +- plugins/MirOTR/MirOTR/src/svcs_srmm.cpp | 2 +- plugins/New_GPG/src/init.cpp | 4 +- plugins/NoHistory/src/dllmain.cpp | 4 +- plugins/Popup/src/srmm_menu.cpp | 8 +- plugins/Scriver/src/chat/clist.cpp | 2 +- plugins/SecureIM/src/svcs_srmm.cpp | 8 +- plugins/SpellChecker/src/spellchecker.cpp | 10 +- plugins/TabSRMM/src/controls.cpp | 6 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 248 ++++++++-------------------- plugins/TabSRMM/src/generic_msghandlers.h | 1 - plugins/TabSRMM/src/msglog.cpp | 4 +- protocols/JabberG/src/jabber_proto.cpp | 2 +- src/miranda32_10.vcxproj.filters | 6 +- src/miranda32_11.vcxproj.filters | 6 +- src/modules/srmm/statusicon.cpp | 26 ++- 19 files changed, 157 insertions(+), 244 deletions(-) diff --git a/include/m_message.h b/include/m_message.h index bb5495d813..9c9bca2549 100644 --- a/include/m_message.h +++ b/include/m_message.h @@ -71,16 +71,16 @@ typedef struct { HWND hwndLog; // log area window for the contact (or NULL if there is none) } MessageWindowEventData; -#define MS_MSG_GETWINDOWAPI "MessageAPI/WindowAPI" //wparam = 0 //lparam = 0 //Returns a dword with the current message api version //Current version is 0, 0, 0, 4 +#define MS_MSG_GETWINDOWAPI "MessageAPI/WindowAPI" -#define MS_MSG_GETWINDOWCLASS "MessageAPI/WindowClass" //wparam = (char*)szBuf //lparam = (int)cbSize size of buffer //Sets the window class name in wParam (ex. "SRMM" for srmm.dll) +#define MS_MSG_GETWINDOWCLASS "MessageAPI/WindowClass" typedef struct { int cbSize; @@ -102,18 +102,18 @@ typedef struct { void *local; // used to store pointer to custom data } MessageWindowData; -#define MS_MSG_GETWINDOWDATA "MessageAPI/GetWindowData" //wparam = (MessageWindowInputData*) //lparam = (MessageWindowData*) //returns 0 on success and returns non-zero (1) on error or if no window data exists for that hcontact +#define MS_MSG_GETWINDOWDATA "MessageAPI/GetWindowData" - -#define ME_MSG_WINDOWPOPUP "MessageAPI/WindowPopupRequested" // wParam = 0 // lParam = (MessageWindowPopupData *)&MessageWindowPopupData; // Fired to allow plugins to add items to the msg window popup menu // Always fired twice: once with MSG_WINDOWPOPUP_SHOWING and once with MSG_WINDOWPOPUP_SELECTED. // This is done to allow cleaning of resources. +#define ME_MSG_WINDOWPOPUP "MessageAPI/WindowPopupRequested" + #define MSG_WINDOWPOPUP_SHOWING 1 #define MSG_WINDOWPOPUP_SELECTED 2 @@ -131,28 +131,39 @@ typedef struct { int selection; // The menu control id or 0 if no one was selected } MessageWindowPopupData; -// status icons - HICONs will be automatically destroyed when removed or when miranda exits +// status icons #define MBF_DISABLED 0x01 #define MBF_HIDDEN 0x02 +#define MBF_UNICODE 0x04 + +#ifdef _UNICODE + #define MBF_TCHAR MBF_UNICODE +#else + #define MBF_TCHAR 0 +#endif typedef struct { - int cbSize; - char *szModule; // used in combo with the dwId below to create a unique identifier - DWORD dwId; - HICON hIcon, hIconDisabled; // hIconDisabled is optional - if null, will use hIcon in the disabled state - int flags; // bitwize OR of MBF_* flags above - char *szTooltip; + int cbSize; // must be equal to sizeof(StatusIconData) + char *szModule; // used in combo with the dwId below to create a unique identifier + DWORD dwId; // uniquely defines a button inside a module + HICON hIcon, hIconDisabled; // hIconDisabled is optional - if null, will use hIcon in the disabled state + int flags; // bitwize OR of MBF_* flags above + union { + char *szTooltip; // controlled by MBF_UNICODE + TCHAR *tszTooltip; + wchar_t *wszTooltip; + }; } StatusIconData; -#define MBCF_RIGHTBUTTON 0x01 // if this flag is specified, the click was a right button - otherwize it was a left click +#define MBCF_RIGHTBUTTON 0x01 // if this flag is specified, the click was a right button - otherwize it was a left click typedef struct { - int cbSize; - POINT clickLocation; // click location, in screen coordinates + int cbSize; + POINT clickLocation; // click location, in screen coordinates char *szModule; DWORD dwId; - int flags; // bitwize OR of MBCF_* flags above + int flags; // bitwize OR of MBCF_* flags above } StatusIconClickData; // wParam = (int)hLangpack diff --git a/plugins/FavContacts/src/main.cpp b/plugins/FavContacts/src/main.cpp index 6f8d797111..5c09f9363b 100644 --- a/plugins/FavContacts/src/main.cpp +++ b/plugins/FavContacts/src/main.cpp @@ -146,7 +146,7 @@ int ProcessModulesLoaded(WPARAM wParam, LPARAM lParam) StatusIconData sid = { sizeof(sid) }; sid.szModule = "FavContacts"; - sid.szTooltip = "Favourite Contacts"; + sid.szTooltip = LPGEN("Favourite Contacts"); sid.hIcon = Skin_GetIconByHandle(iconList[0].hIcolib); sid.hIconDisabled = Skin_GetIconByHandle(iconList[1].hIcolib); Srmm_AddIcon(&sid); diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp index 036c1eb7a2..7f2ef7631c 100644 --- a/plugins/FingerprintNG/src/fingerprint.cpp +++ b/plugins/FingerprintNG/src/fingerprint.cpp @@ -145,14 +145,15 @@ static void SetSrmmIcon(HANDLE hContact, LPTSTR ptszMirver) StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULENAME; sid.dwId = 1; - sid.szTooltip = LPGEN("Client icon"); + sid.flags = MBF_TCHAR; + sid.tszTooltip = ptszMirver; if ( lstrlen(ptszMirver)) sid.hIcon = sid.hIconDisabled = (HICON)ServiceGetClientIconW((WPARAM)ptszMirver, TRUE); else sid.flags |= MBF_HIDDEN; - CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid); + Srmm_ModifyIcon(hContact, &sid); } int __fastcall ApplyFingerprintImage(HANDLE hContact, LPTSTR szMirVer) diff --git a/plugins/HistorySweeperLight/src/main.cpp b/plugins/HistorySweeperLight/src/main.cpp index 43518e17b2..b3653d8a9a 100644 --- a/plugins/HistorySweeperLight/src/main.cpp +++ b/plugins/HistorySweeperLight/src/main.cpp @@ -82,32 +82,32 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam) sid.hIcon = LoadIconEx("actG"); if (sweep == 0) - sid.szTooltip = Translate("Keep all events"); + sid.szTooltip = LPGEN("Keep all events"); else if (sweep == 1) - sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]); + sid.szTooltip = (char*)time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]; else if (sweep == 2) - sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]); + sid.szTooltip = (char*)keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]; else if (sweep == 3) - sid.szTooltip = Translate("Delete all events"); + sid.szTooltip = LPGEN("Delete all events"); sid.flags = MBF_HIDDEN; Srmm_AddIcon(&sid); sid.dwId = 1; sid.hIcon = LoadIconEx("act1"); - sid.szTooltip = Translate(time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]); + sid.szTooltip = (char*)time_stamp_strings[db_get_b(NULL, ModuleName, "StartupShutdownOlder", 0)]; sid.flags = MBF_HIDDEN; Srmm_AddIcon(&sid); sid.dwId = 2; sid.hIcon = LoadIconEx("act2"); - sid.szTooltip = Translate(keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]); + sid.szTooltip = (char*)keep_strings[db_get_b(NULL, ModuleName, "StartupShutdownKeep", 0)]; sid.flags = MBF_HIDDEN; Srmm_AddIcon(&sid); sid.dwId = 3; sid.hIcon = LoadIconEx("actDel"); - sid.szTooltip = Translate("Delete all events"); + sid.szTooltip = LPGEN("Delete all events"); sid.flags = MBF_HIDDEN; Srmm_AddIcon(&sid); diff --git a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp index cb73e3a448..854619d689 100644 --- a/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp +++ b/plugins/MirOTR/MirOTR/src/svcs_srmm.cpp @@ -250,7 +250,7 @@ void InitSRMM() { sid.hIcon = hIconFinished; sid.hIconDisabled = hIconNotSecure; sid.flags = MBF_DISABLED | MBF_HIDDEN; - sid.szTooltip = Translate(LANG_OTR_TOOLTIP); + sid.szTooltip = LANG_OTR_TOOLTIP; Srmm_AddIcon(&sid); sid.dwId = 1; diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp index 01bf91848c..cff2d14573 100755 --- a/plugins/New_GPG/src/init.cpp +++ b/plugins/New_GPG/src/init.cpp @@ -132,12 +132,12 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam) sid.flags = MBF_HIDDEN; sid.dwId = 0x00000001; sid.hIcon = IconLibGetIcon("secured"); - sid.szTooltip = Translate("GPG Turn off encryption"); + sid.szTooltip = LPGEN("GPG Turn off encryption"); Srmm_AddIcon(&sid); sid.dwId = 0x00000002; sid.hIcon = IconLibGetIcon("unsecured"); - sid.szTooltip = Translate("GPG Turn on encryption"); + sid.szTooltip = LPGEN("GPG Turn on encryption"); Srmm_AddIcon(&sid); bMetaContacts = ServiceExists(MS_MC_GETMETACONTACT) != 0; diff --git a/plugins/NoHistory/src/dllmain.cpp b/plugins/NoHistory/src/dllmain.cpp index 0e7193c9b3..a579c599a2 100644 --- a/plugins/NoHistory/src/dllmain.cpp +++ b/plugins/NoHistory/src/dllmain.cpp @@ -243,12 +243,12 @@ void SrmmMenu_Load() sid.szModule = MODULE; sid.dwId = 0; - sid.szTooltip = Translate("History Enabled"); + sid.szTooltip = LPGEN("History Enabled"); sid.hIcon = sid.hIconDisabled = hIconKeep; Srmm_AddIcon(&sid); sid.dwId = 1; - sid.szTooltip = Translate("History Disabled"); + sid.szTooltip = LPGEN("History Disabled"); sid.hIcon = sid.hIconDisabled = hIconRemove; Srmm_AddIcon(&sid); diff --git a/plugins/Popup/src/srmm_menu.cpp b/plugins/Popup/src/srmm_menu.cpp index 06456618cc..e3c52ca69c 100644 --- a/plugins/Popup/src/srmm_menu.cpp +++ b/plugins/Popup/src/srmm_menu.cpp @@ -41,22 +41,22 @@ void SrmmMenu_Load() sid.szModule = MODULNAME; sid.dwId = 0; - sid.szTooltip = Translate("Popup Mode: Auto"); + sid.szTooltip = LPGEN("Popup Mode: Auto"); sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_ON,0); Srmm_AddIcon(&sid); sid.dwId = 1; - sid.szTooltip = Translate("Popup Mode: Favourite"); + sid.szTooltip = LPGEN("Popup Mode: Favourite"); sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FAV,0); Srmm_AddIcon(&sid); sid.dwId = 2; - sid.szTooltip = Translate("Popup Mode: Ignore fullscreen"); + sid.szTooltip = LPGEN("Popup Mode: Ignore fullscreen"); sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_FULLSCREEN,0); Srmm_AddIcon(&sid); sid.dwId = 3; - sid.szTooltip = Translate("Popup Mode: Block contact"); + sid.szTooltip = LPGEN("Popup Mode: Block contact"); sid.hIcon = sid.hIconDisabled = IcoLib_GetIcon(ICO_POPUP_OFF,0); Srmm_AddIcon(&sid); diff --git a/plugins/Scriver/src/chat/clist.cpp b/plugins/Scriver/src/chat/clist.cpp index 857380f87e..fe4bf64128 100644 --- a/plugins/Scriver/src/chat/clist.cpp +++ b/plugins/Scriver/src/chat/clist.cpp @@ -270,7 +270,7 @@ BOOL CList_AddEvent(HANDLE hContact, HICON Icon, HANDLE event, int type, TCHAR* cle.hIcon = Icon; cle.pszService = "GChat/DblClickEvent" ; cle.ptszTooltip = TranslateTS(szBuf); - if ( type ) { + if (type) { if (!CallService(MS_CLIST_GETEVENT, (WPARAM)hContact, 0)) CallService(MS_CLIST_ADDEVENT,(WPARAM) hContact,(LPARAM)&cle); } diff --git a/plugins/SecureIM/src/svcs_srmm.cpp b/plugins/SecureIM/src/svcs_srmm.cpp index 405206621a..6c05f77bca 100644 --- a/plugins/SecureIM/src/svcs_srmm.cpp +++ b/plugins/SecureIM/src/svcs_srmm.cpp @@ -40,26 +40,26 @@ void InitSRMMIcons() sid.dwId = MODE_NATIVE; sid.hIcon = mode2icon(MODE_NATIVE|SECURED,3); sid.hIconDisabled = mode2icon(MODE_NATIVE,3); - sid.szTooltip = Translate("SecureIM [Native]"); + sid.szTooltip = LPGEN("SecureIM [Native]"); Srmm_AddIcon(&sid); // PGP sid.dwId = MODE_PGP; sid.hIcon = mode2icon(MODE_PGP|SECURED,3); sid.hIconDisabled = mode2icon(MODE_PGP,3); - sid.szTooltip = Translate("SecureIM [PGP]"); + sid.szTooltip = LPGEN("SecureIM [PGP]"); Srmm_AddIcon(&sid); // GPG sid.dwId = MODE_GPG; sid.hIcon = mode2icon(MODE_GPG|SECURED,3); sid.hIconDisabled = mode2icon(MODE_GPG,3); - sid.szTooltip = Translate("SecureIM [GPG]"); + sid.szTooltip = LPGEN("SecureIM [GPG]"); Srmm_AddIcon(&sid); // RSAAES sid.dwId = MODE_RSAAES; sid.hIcon = mode2icon(MODE_RSAAES|SECURED,3); sid.hIconDisabled = mode2icon(MODE_RSAAES,3); - sid.szTooltip = Translate("SecureIM [RSA/AES]"); + sid.szTooltip = LPGEN("SecureIM [RSA/AES]"); Srmm_AddIcon(&sid); // hook the window events so that we can can change the status of the icon diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 4e4782d740..3a0d162706 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -208,15 +208,15 @@ static int ModulesLoaded(WPARAM wParam, LPARAM lParam) StatusIconData sid = { sizeof(sid) }; sid.szModule = MODULE_NAME; sid.hIconDisabled = Skin_GetIcon("spellchecker_disabled"); - sid.flags = MBF_HIDDEN; + sid.flags = MBF_TCHAR | MBF_HIDDEN; for (int i = 0; i < languages.getCount(); i++) { sid.dwId = i; - char tmp[128]; - mir_snprintf(tmp, SIZEOF(tmp), "%s - %S", - Translate("Spell Checker"), languages[i]->full_name); - sid.szTooltip = tmp; + TCHAR tmp[128]; + mir_sntprintf(tmp, SIZEOF(tmp), _T("%s - %S"), + TranslateT("Spell Checker"), languages[i]->full_name); + sid.tszTooltip = tmp; HICON hIcon = (opts.use_flags) ? Skin_GetIconByHandle(languages[i]->hIcolib) : Skin_GetIcon("spellchecker_enabled"); sid.hIcon = CopyIcon(hIcon); diff --git a/plugins/TabSRMM/src/controls.cpp b/plugins/TabSRMM/src/controls.cpp index 6f0d9141a1..436a56e14f 100644 --- a/plugins/TabSRMM/src/controls.cpp +++ b/plugins/TabSRMM/src/controls.cpp @@ -1011,11 +1011,11 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR int gap = 2; unsigned int iconNum = (pt.x - rc.left) / (PluginConfig.m_smcxicon + gap); - char *szModule = NULL, *szTooltip; + char *szModule = NULL; TCHAR *tszTooltip; int list_icons = 0; while (StatusIconData *sid = Srmm_GetNthIcon(dat->hContact, list_icons)) if (list_icons++ == iconNum) - szModule = sid->szModule, szTooltip = sid->szTooltip; + szModule = sid->szModule, tszTooltip = sid->tszTooltip; if ((int)iconNum == list_icons && pContainer) { TCHAR wBuf[512]; @@ -1043,7 +1043,7 @@ LONG_PTR CALLBACK StatusBarSubclassProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR tooltip_active = TRUE; } else if (szModule) { - CallService("mToolTip/ShowTip", (WPARAM)szTooltip, (LPARAM)&ti); + CallService(szTTService, (WPARAM)tszTooltip, (LPARAM)&ti); tooltip_active = TRUE; } } diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 67d47edc1b..c3ea6cb495 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -55,7 +55,8 @@ void TSAPI DM_SaveLogAsRTF(const TWindowData* dat) event.count = 0; event.codepage = 0; CallService(MS_IEVIEW_EVENT, 0, (LPARAM)&event); - } else if (dat) { + } + else if (dat) { TCHAR szInitialDir[MAX_PATH + 2]; mir_sntprintf(szFilter, SIZEOF(szFilter), _T("%s%c*.rtf%c%c"), TranslateT("Rich Edit file"), 0, 0, 0); @@ -876,112 +877,6 @@ void TSAPI DM_InitRichEdit(TWindowData *dat) } } -/* -* action and callback procedures for the stock button objects -*/ - -static void BTN_StockAction(ButtonItem *item, HWND hwndDlg, struct TWindowData *dat, HWND hwndBtn) -{ - POINT pt; - int iSelection; - - if (item->dwStockFlags & SBI_HANDLEBYCLIENT && IsWindow(hwndDlg) && dat) { - SendMessage(hwndDlg, WM_COMMAND, MAKELONG(item->uId, BN_CLICKED), (LPARAM)hwndBtn); - return; - } - - switch (item->uId) { - case IDC_SBAR_CANCEL: - PostMessage(hwndDlg, WM_COMMAND, MAKELONG(IDC_SAVE, BN_CLICKED), (LPARAM)hwndBtn); - break; - case IDC_SBAR_SLIST: - SendMessage(PluginConfig.g_hwndHotkeyHandler, DM_TRAYICONNOTIFY, 101, WM_LBUTTONUP); - break; - case IDC_SBAR_FAVORITES: - GetCursorPos(&pt); - iSelection = TrackPopupMenu(PluginConfig.g_hMenuFavorites, TPM_RETURNCMD, pt.x, pt.y, 0, PluginConfig.g_hwndHotkeyHandler, NULL); - HandleMenuEntryFromhContact(iSelection); - break; - - case IDC_SBAR_RECENT: - GetCursorPos(&pt); - iSelection = TrackPopupMenu(PluginConfig.g_hMenuRecent, TPM_RETURNCMD, pt.x, pt.y, 0, PluginConfig.g_hwndHotkeyHandler, NULL); - HandleMenuEntryFromhContact(iSelection); - break; - - case IDC_SBAR_USERPREFS: - { - HANDLE hContact = 0; - SendMessage(hwndDlg, DM_QUERYHCONTACT, 0, (LPARAM)&hContact); - if (hContact != 0) - CallService(MS_TABMSG_SETUSERPREFS, (WPARAM)hContact, 0); - } - break; - - case IDC_SBAR_TOGGLEFORMAT: - if (dat) { - if (IsDlgButtonChecked(hwndDlg, IDC_SBAR_TOGGLEFORMAT) == BST_UNCHECKED) { - dat->SendFormat = 0; - GetSendFormat(dat, 0); - } - else { - dat->SendFormat = SENDFORMAT_BBCODE; - GetSendFormat(dat, 0); - } - } - break; - } -} - -static void BTN_StockCallback(ButtonItem *item, HWND hwndDlg, struct TWindowData *dat, HWND hwndBtn) -{ -} - -/* -* predefined button objects for customizeable buttons -*/ - -static struct SIDEBARITEM sbarItems[] = { - 0, 0, 0, 0, 0, _T(""), NULL, NULL, _T("") -}; - -int TSAPI BTN_GetStockItem(ButtonItem *item, const TCHAR *szName) -{ - for (int i=0; sbarItems[i].uId; i++) { - if (!_tcsicmp(sbarItems[i].szName, szName)) { - item->uId = sbarItems[i].uId; - //item->dwFlags |= BUTTON_ISSIDEBAR; - //myGlobals.m_SideBarEnabled = TRUE; - if (item->dwFlags & BUTTON_ISSIDEBAR) { - if (sbarItems[i].dwFlags & SBI_TOP) - item->yOff = 0; - else if (sbarItems[i].dwFlags & SBI_BOTTOM) - item->yOff = -1; - } - item->dwStockFlags = sbarItems[i].dwFlags; - item->dwFlags = sbarItems[i].dwFlags & SBI_TOGGLE ? item->dwFlags | BUTTON_ISTOGGLE : item->dwFlags & ~BUTTON_ISTOGGLE; - item->pfnAction = sbarItems[i].pfnAction; - item->pfnCallback = sbarItems[i].pfnCallback; - lstrcpyn(item->szTip, sbarItems[i].tszTip, 256); - item->szTip[255] = 0; - if (sbarItems[i].hIcon) { - item->normalGlyphMetrics[0] = (LONG_PTR)sbarItems[i].hIcon; - item->dwFlags |= BUTTON_NORMALGLYPHISICON; - } - if (sbarItems[i].hIconPressed) { - item->pressedGlyphMetrics[0] = (LONG_PTR)sbarItems[i].hIconPressed; - item->dwFlags |= BUTTON_PRESSEDGLYPHISICON; - } - if (sbarItems[i].hIconHover) { - item->hoverGlyphMetrics[0] = (LONG_PTR)sbarItems[i].hIconHover; - item->dwFlags |= BUTTON_HOVERGLYPHISICON; - } - return 1; - } - } - return 0; -} - /* * set the states of defined database action buttons (only if button is a toggle) */ @@ -1089,15 +984,12 @@ void TSAPI DM_ScrollToBottom(TWindowData *dat, WPARAM wParam, LPARAM lParam) InvalidateRect(hwnd, NULL, FALSE); } -static void LoadKLThread(LPVOID vParam) +static void LoadKLThread(LPVOID _param) { - HANDLE hContact = reinterpret_cast(vParam); - DBVARIANT dbv = {0}; - - LRESULT res = M->GetTString(hContact, SRMSGMOD_T, "locale", &dbv); - if (res == 0) { + DBVARIANT dbv; + if (!M->GetTString(_param, SRMSGMOD_T, "locale", &dbv)) { HKL hkl = LoadKeyboardLayout(dbv.ptszVal, 0); - PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_SETLOCALE, (WPARAM)hContact, (LPARAM)hkl); + PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_SETLOCALE, (WPARAM)_param, (LPARAM)hkl); db_free(&dbv); } } @@ -1276,12 +1168,10 @@ HWND TSAPI DM_CreateClist(TWindowData *dat) LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, struct TWindowData *mwdat, WPARAM wParam, LPARAM lParam) { RECT rc, rc1; - POINT pt; - TCHITTESTINFO hti; - HWND hwndTab; UINT uID = mwdat->bType == SESSIONTYPE_IM ? IDC_LOG : IDC_CHAT_LOG; UINT uIDMsg = mwdat->bType == SESSIONTYPE_IM ? IDC_MESSAGE : IDC_CHAT_MESSAGE; + POINT pt; GetCursorPos(&pt); GetWindowRect(hwnd, &rc); if (PtInRect(&rc, pt)) @@ -1326,7 +1216,9 @@ LRESULT TSAPI DM_MouseWheelHandler(HWND hwnd, HWND hwndParent, struct TWindowDat else SendMessage(hwnd, WM_MOUSEWHEEL, wParam, lParam); return 0; } - hwndTab = GetDlgItem(mwdat->pContainer->hwnd, IDC_MSGTABS); + + HWND hwndTab = GetDlgItem(mwdat->pContainer->hwnd, IDC_MSGTABS); + TCHITTESTINFO hti; GetCursorPos(&hti.pt); ScreenToClient(hwndTab, &hti.pt); hti.flags = 0; @@ -1397,66 +1289,67 @@ void TSAPI DM_NotifyTyping(struct TWindowData *dat, int mode) const char* szProto = 0; HANDLE hContact = 0; - if (dat && dat->hContact) { - DeletePopupsForContact(dat->hContact, PU_REMOVE_ON_TYPE); + if (!dat || !dat->hContact) + return; + + DeletePopupsForContact(dat->hContact, PU_REMOVE_ON_TYPE); - if (dat->bIsMeta){ - szProto = dat->cache->getActiveProto(); - hContact = dat->cache->getActiveContact(); - } - else { - szProto = dat->szProto; - hContact = dat->hContact; - } + if (dat->bIsMeta){ + szProto = dat->cache->getActiveProto(); + hContact = dat->cache->getActiveContact(); + } + else { + szProto = dat->szProto; + hContact = dat->hContact; + } - /* - * editing user notes or preparing a message for queued delivery -> don't send MTN - */ - if (dat->fEditNotesActive || dat->sendMode & SMODE_SENDLATER) - return; + /* + * editing user notes or preparing a message for queued delivery -> don't send MTN + */ + if (dat->fEditNotesActive || dat->sendMode & SMODE_SENDLATER) + return; - /* - * allow supression of sending out TN for the contact (NOTE: for metacontacts, do NOT use the subcontact handle) - */ - if (!M->GetByte(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M->GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) - return; + /* + * allow supression of sending out TN for the contact (NOTE: for metacontacts, do NOT use the subcontact handle) + */ + if (!M->GetByte(dat->hContact, SRMSGMOD, SRMSGSET_TYPING, M->GetByte(SRMSGMOD, SRMSGSET_TYPINGNEW, SRMSGDEFSET_TYPINGNEW))) + return; - if (!dat->szProto) // should not, but who knows... - return; + if (!dat->szProto) // should not, but who knows... + return; - /* - * check status and capabilities of the protocol - */ - protoStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0); - protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0); - typeCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0); + /* + * check status and capabilities of the protocol + */ + protoStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0); + protoCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0); + typeCaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4, 0); - if (!(typeCaps & PF4_SUPPORTTYPING)) - return; - if (protoStatus < ID_STATUS_ONLINE) - return; + if (!(typeCaps & PF4_SUPPORTTYPING)) + return; + if (protoStatus < ID_STATUS_ONLINE) + return; - /* - * check visibility/invisibility lists to not "accidentially" send MTN to contacts who - * should not see them (privacy issue) - */ - if (protoCaps & PF1_VISLIST && db_get_w(hContact, szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE) - return; + /* + * check visibility/invisibility lists to not "accidentially" send MTN to contacts who + * should not see them (privacy issue) + */ + if (protoCaps & PF1_VISLIST && db_get_w(hContact, szProto, "ApparentMode", 0) == ID_STATUS_OFFLINE) + return; - if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(hContact, szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) - return; + if (protoCaps & PF1_INVISLIST && protoStatus == ID_STATUS_INVISIBLE && db_get_w(hContact, szProto, "ApparentMode", 0) != ID_STATUS_ONLINE) + return; - /* - * don't send to contacts which are not permanently added to the contact list, - * unless the option to ignore added status is set. - */ - if (M->GetByte(dat->hContact, "CList", "NotOnList", 0) - && !M->GetByte(SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) - return; - // End user check - dat->nTypeMode = mode; - CallService(MS_PROTO_SELFISTYPING, (WPARAM)hContact, dat->nTypeMode); - } + /* + * don't send to contacts which are not permanently added to the contact list, + * unless the option to ignore added status is set. + */ + if (M->GetByte(dat->hContact, "CList", "NotOnList", 0) + && !M->GetByte(SRMSGMOD, SRMSGSET_TYPINGUNKNOWN, SRMSGDEFSET_TYPINGUNKNOWN)) + return; + // End user check + dat->nTypeMode = mode; + CallService(MS_PROTO_SELFISTYPING, (WPARAM)hContact, dat->nTypeMode); } void TSAPI DM_OptionsApplied(TWindowData *dat, WPARAM wParam, LPARAM lParam) @@ -1464,7 +1357,7 @@ void TSAPI DM_OptionsApplied(TWindowData *dat, WPARAM wParam, LPARAM lParam) if (dat == 0) return; - HWND hwndDlg = dat->hwnd; + HWND hwndDlg = dat->hwnd; TContainerData *m_pContainer = dat->pContainer; dat->szMicroLf[0] = 0; @@ -1603,12 +1496,12 @@ void TSAPI DM_Typing(TWindowData *dat, bool fForceOff) */ int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam) { - RECT rcWin; - short newMessagePos; - LONG newPos; - TWindowData* srcDat = PluginConfig.lastSPlitterPos.pSrcDat; - TContainerData* srcCnt = PluginConfig.lastSPlitterPos.pSrcContainer; - bool fCntGlobal = (!dat->pContainer->settings->fPrivate ? true : false); + RECT rcWin; + short newMessagePos; + LONG newPos; + TWindowData *srcDat = PluginConfig.lastSPlitterPos.pSrcDat; + TContainerData *srcCnt = PluginConfig.lastSPlitterPos.pSrcContainer; + bool fCntGlobal = (!dat->pContainer->settings->fPrivate ? true : false); #if defined(__FEAT_EXP_AUTOSPLITTER) if (dat->fIsAutosizingInput) @@ -1670,8 +1563,7 @@ int TSAPI DM_SplitterGlobalEvent(TWindowData *dat, WPARAM wParam, LPARAM lParam) return 0; } } - else - newPos = wParam; + else newPos = wParam; newMessagePos = (short)rcWin.bottom - (short)newPos; diff --git a/plugins/TabSRMM/src/generic_msghandlers.h b/plugins/TabSRMM/src/generic_msghandlers.h index 6369ee947b..a1f25ad827 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.h +++ b/plugins/TabSRMM/src/generic_msghandlers.h @@ -31,7 +31,6 @@ */ void TSAPI DM_SetDBButtonStates(HWND hwndChild, struct TWindowData *dat); -int TSAPI BTN_GetStockItem (ButtonItem *item, const TCHAR *szName); HWND TSAPI DM_CreateClist(TWindowData *dat); void TSAPI DM_OptionsApplied(TWindowData *dat, WPARAM wParam, LPARAM lParam); diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 9fae10db4e..f8a35f26cd 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -40,7 +40,7 @@ struct TCpTable cpTable[] = { { 950, LPGENT("Traditional Chinese") }, { 1250, LPGENT("Central European") }, { 1251, LPGENT("Cyrillic") }, - { 20866,LPGENT("Cyrillic KOI8-R") }, + { 20866, LPGENT("Cyrillic KOI8-R") }, { 1252, LPGENT("Latin I") }, { 1253, LPGENT("Greek") }, { 1254, LPGENT("Turkish") }, @@ -71,7 +71,7 @@ static TCHAR *szYourName = NULL; static int logPixelSY; static TCHAR szToday[22], szYesterday[22]; -char rtfFontsGlobal[MSGDLGFONTCOUNT + 2][RTFCACHELINESIZE]; +char rtfFontsGlobal[MSGDLGFONTCOUNT + 2][RTFCACHELINESIZE]; char *rtfFonts; LOGFONTA logfonts[MSGDLGFONTCOUNT + 2]; diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp index b6aaf3e8f9..b4b1e2537f 100644 --- a/protocols/JabberG/src/jabber_proto.cpp +++ b/protocols/JabberG/src/jabber_proto.cpp @@ -299,7 +299,7 @@ int CJabberProto::OnModulesLoadedEx(WPARAM, LPARAM) sid.szModule = m_szModuleName; sid.hIcon = CopyIcon(hIcon); sid.flags = MBF_HIDDEN; - sid.szTooltip = Translate("Jabber Resource"); + sid.szTooltip = LPGEN("Jabber Resource"); Srmm_AddIcon(&sid); Skin_ReleaseIcon(hIcon); diff --git a/src/miranda32_10.vcxproj.filters b/src/miranda32_10.vcxproj.filters index fc15b485fc..9b737ea5d2 100644 --- a/src/miranda32_10.vcxproj.filters +++ b/src/miranda32_10.vcxproj.filters @@ -129,9 +129,6 @@ SDK - - SDK - SDK @@ -288,6 +285,9 @@ Modules\extraicons + + Modules\srmm + diff --git a/src/miranda32_11.vcxproj.filters b/src/miranda32_11.vcxproj.filters index 4ec98818a1..502fcd8c9d 100644 --- a/src/miranda32_11.vcxproj.filters +++ b/src/miranda32_11.vcxproj.filters @@ -129,9 +129,6 @@ SDK - - SDK - SDK @@ -288,6 +285,9 @@ Modules\extraicons + + Modules\srmm + diff --git a/src/modules/srmm/statusicon.cpp b/src/modules/srmm/statusicon.cpp index 554df1565c..448decdf1a 100644 --- a/src/modules/srmm/statusicon.cpp +++ b/src/modules/srmm/statusicon.cpp @@ -27,13 +27,13 @@ struct StatusIconChild : public MZeroedObject { ~StatusIconChild() { - mir_free(szTooltip); + mir_free(tszTooltip); } HANDLE hContact; - HICON hIcon, hIconDisabled; - int flags; - char *szTooltip; + HICON hIcon, hIconDisabled; + int flags; + TCHAR *tszTooltip; }; struct StatusIconMain : public MZeroedObject @@ -81,7 +81,10 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) if (hContact == NULL) { memcpy(&p->sid, sid, sizeof(p->sid)); replaceStr(p->sid.szModule, sid->szModule); - replaceStr(p->sid.szTooltip, sid->szTooltip); + + mir_free(p->sid.szTooltip); + p->sid.tszTooltip = (sid->flags & MBF_UNICODE) ? mir_u2t(sid->wszTooltip) : mir_a2t(sid->szTooltip); + NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p); return 0; } @@ -96,7 +99,10 @@ INT_PTR ModifyStatusIcon(WPARAM wParam, LPARAM lParam) pc->flags = sid->flags; pc->hIcon = sid->hIcon; pc->hIconDisabled = sid->hIconDisabled; - replaceStr(pc->szTooltip, sid->szTooltip); + + mir_free(pc->tszTooltip); + pc->tszTooltip = (sid->flags & MBF_UNICODE) ? mir_u2t(sid->wszTooltip) : mir_a2t(sid->szTooltip); + NotifyEventHooks(hHookIconsChanged, wParam, (LPARAM)p); return 0; } @@ -115,7 +121,10 @@ static INT_PTR AddStatusIcon(WPARAM wParam, LPARAM lParam) memcpy(&p->sid, sid, sizeof(p->sid)); p->hPangpack = (int)wParam; p->sid.szModule = mir_strdup(sid->szModule); - p->sid.szTooltip = mir_strdup(sid->szTooltip); + if (sid->flags & MBF_UNICODE) + p->sid.tszTooltip = mir_u2t(sid->wszTooltip); + else + p->sid.tszTooltip = mir_a2t(sid->szTooltip); arIcons.insert(p); NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p); @@ -156,9 +165,10 @@ static INT_PTR GetNthIcon(WPARAM wParam, LPARAM lParam) if (pc) { if (pc->hIcon) res.hIcon = pc->hIcon; if (pc->hIconDisabled) res.hIconDisabled = pc->hIconDisabled; - if (pc->szTooltip) res.szTooltip = pc->szTooltip; + if (pc->tszTooltip) res.tszTooltip = pc->tszTooltip; res.flags = pc->flags; } + res.tszTooltip = TranslateTH(p.hPangpack, res.tszTooltip); return (INT_PTR)&res; } nVis++; -- cgit v1.2.3