diff options
author | George Hazan <ghazan@miranda.im> | 2018-06-20 22:16:03 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-06-20 22:16:03 +0300 |
commit | 669b8ef306cb953e131065dc2fe512d03186cfba (patch) | |
tree | 62a67363d3d9b74fc7d130faf1d43364c1f087d6 | |
parent | 3885b24833bd32b282ac11749422ea241d551c0d (diff) |
tabSRMM: obsolete locale support code removed, because it doesn't work at all
-rw-r--r-- | plugins/TabSRMM/src/chat_window.cpp | 20 | ||||
-rw-r--r-- | plugins/TabSRMM/src/generic_msghandlers.cpp | 58 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.cpp | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/globals.h | 1 | ||||
-rw-r--r-- | plugins/TabSRMM/src/hotkeyhandler.cpp | 31 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdialog.cpp | 22 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 71 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.cpp | 12 | ||||
-rw-r--r-- | plugins/TabSRMM/src/msgs.h | 4 | ||||
-rw-r--r-- | plugins/TabSRMM/src/translator.cpp | 1 |
10 files changed, 4 insertions, 217 deletions
diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index 6fdf4e0cd4..912b40b00d 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -204,12 +204,6 @@ void CChatRoomDlg::UpdateWindowState(UINT msg) if (m_dwFlags & MWF_NEEDCHECKSIZE) PostMessage(m_hwnd, DM_SAVESIZE, 0, 0); - if (PluginConfig.m_bAutoLocaleSupport) { - if (hkl == nullptr) - DM_LoadLocale(); - else - SendMessage(m_hwnd, DM_SETLOCALE, 0, 0); - } SetFocus(m_message.GetHwnd()); m_dwLastActivity = GetTickCount(); m_pContainer->dwLastActivity = m_dwLastActivity; @@ -1400,14 +1394,6 @@ LRESULT CChatRoomDlg::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) RefreshButtonStatus(); break; - case WM_INPUTLANGCHANGE: - if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == m_message.GetHwnd() && IsActive()) { - DM_SaveLocale(wParam, lParam); - m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD); - return 1; - } - break; - case WM_ERASEBKGND: return !CSkin::m_skinEnabled; } @@ -2339,12 +2325,6 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) pt.x = pt.y = 0; m_log.SendMsg(EM_SETSCROLLPOS, 0, (LPARAM)&pt); - if (PluginConfig.m_bAutoLocaleSupport) { - if (hkl == nullptr) - DM_LoadLocale(); - else - PostMessage(m_hwnd, DM_SETLOCALE, 0, 0); - } } else { Resize(); diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index b3f471ca0d..fb456ab4f4 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -710,46 +710,6 @@ void CTabBaseDlg::DM_ScrollToBottom(WPARAM wParam, LPARAM lParam) InvalidateRect(m_log.GetHwnd(), nullptr, FALSE); } -static void LoadKLThread(LPVOID _param) -{ - Thread_SetName("TabSRMM: LoadKLThread"); - - DBVARIANT dbv; - if (!db_get_ws((UINT_PTR)_param, SRMSGMOD_T, "locale", &dbv)) { - HKL hkl = LoadKeyboardLayout(dbv.ptszVal, 0); - PostMessage(PluginConfig.g_hwndHotkeyHandler, DM_SETLOCALE, (WPARAM)_param, (LPARAM)hkl); - db_free(&dbv); - } -} - -void CTabBaseDlg::DM_LoadLocale() -{ - if (!PluginConfig.m_bAutoLocaleSupport) - return; - - if (m_dwFlags & MWF_WASBACKGROUNDCREATE) - return; - - DBVARIANT dbv; - if (!db_get_ws(m_hContact, SRMSGMOD_T, "locale", &dbv)) - db_free(&dbv); - else { - wchar_t szKLName[KL_NAMELENGTH + 1]; - if (!PluginConfig.m_bDontUseDefaultKbd) { - wchar_t szBuf[20]; - GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ILANGUAGE, szBuf, 20); - mir_snwprintf(szKLName, L"0000%s", szBuf); - db_set_ws(m_hContact, SRMSGMOD_T, "locale", szKLName); - } - else { - GetKeyboardLayoutName(szKLName); - db_set_ws(m_hContact, SRMSGMOD_T, "locale", szKLName); - } - } - - mir_forkthread(LoadKLThread, (void*)m_hContact); -} - void CTabBaseDlg::DM_RecalcPictureSize() { HBITMAP hbm = ((m_pPanel.isActive()) && m_pContainer->avatarMode != 3) ? m_hOwnPic : (m_ace ? m_ace->hbmPic : PluginConfig.g_hbmUnknown); @@ -797,24 +757,6 @@ void CTabBaseDlg::DM_UpdateLastMessage() const } ///////////////////////////////////////////////////////////////////////////////////////// -// save current keyboard layout for the given contact - -void CTabBaseDlg::DM_SaveLocale(WPARAM, LPARAM lParam) -{ - if (PluginConfig.m_bAutoLocaleSupport && m_hContact && m_pContainer->m_hwndActive == m_hwnd) { - wchar_t szKLName[KL_NAMELENGTH + 1]; - if ((HKL)lParam != m_hkl) { - m_hkl = (HKL)lParam; - ActivateKeyboardLayout(m_hkl, 0); - GetKeyboardLayoutName(szKLName); - db_set_ws(m_hContact, SRMSGMOD_T, "locale", szKLName); - GetLocaleID(szKLName); - UpdateReadChars(); - } - } -} - -///////////////////////////////////////////////////////////////////////////////////////// // create embedded contact list control HWND CTabBaseDlg::DM_CreateClist() diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 544fc9cc98..705f9b48c4 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -139,7 +139,6 @@ void CGlobals::reloadSettings(bool fReloadSkins) m_bSendOnShiftEnter = M.GetBool("sendonshiftenter", false);
m_bSendOnEnter = M.GetBool(SRMSGSET_SENDONENTER, SRMSGDEFSET_SENDONENTER);
m_bSendOnDblEnter = M.GetBool("SendOnDblEnter", false);
- m_bAutoLocaleSupport = M.GetBool("al", false);
m_bAutoSwitchTabs = M.GetBool("autoswitchtabs", true);
m_iTabNameLimit = db_get_w(0, SRMSGMOD_T, "cut_at", 15);
m_bCutContactNameOnTabs = M.GetBool("cuttitle", false);
diff --git a/plugins/TabSRMM/src/globals.h b/plugins/TabSRMM/src/globals.h index 1d8a9deba6..c3a0ce1217 100644 --- a/plugins/TabSRMM/src/globals.h +++ b/plugins/TabSRMM/src/globals.h @@ -85,7 +85,6 @@ public: bool m_bSendOnShiftEnter;
bool m_bSendOnEnter;
bool m_bSendOnDblEnter;
- bool m_bAutoLocaleSupport;
bool m_bAutoSwitchTabs;
bool m_bCutContactNameOnTabs;
bool m_bHideOnClose;
diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index 21421b3f19..7ed36a54f1 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -384,35 +384,10 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP db_event_markRead(wParam, lParam);
return 0;
- case DM_SETLOCALE:
- {
- HKL hkl = (HKL)lParam;
- MCONTACT hContact = wParam;
-
- HWND hWnd = Srmm_FindWindow(hContact);
- if (hWnd) {
- CSrmmWindow *dat = (CSrmmWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA);
- if (dat) {
- if (hkl) {
- dat->m_hkl = hkl;
- PostMessage(dat->GetHwnd(), DM_SETLOCALE, 0, 0);
- }
-
- DBVARIANT dbv;
- if (0 == db_get_ws(hContact, SRMSGMOD_T, "locale", &dbv)) {
- dat->GetLocaleID(dbv.ptszVal);
- db_free(&dbv);
- dat->UpdateReadChars();
- }
- }
- }
- }
- return 0;
-
- // react to changes in the desktop composition state
- // (enable/disable DWM, change to a non-aero visual style
- // or classic Windows theme
case WM_DWMCOMPOSITIONCHANGED:
+ // react to changes in the desktop composition state
+ // (enable/disable DWM, change to a non-aero visual style
+ // or classic Windows theme
SendMessage(hwndDlg, WM_THEMECHANGED, 0, 0);
{
bool bNewAero = M.getAeroState(); // refresh dwm state
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 8711846b61..e30515353e 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -290,13 +290,6 @@ void CSrmmWindow::MsgWindowUpdateState(UINT msg) if (m_dwFlags & MWF_NEEDCHECKSIZE)
PostMessage(m_hwnd, DM_SAVESIZE, 0, 0);
- if (PluginConfig.m_bAutoLocaleSupport) {
- if (m_hkl == nullptr)
- DM_LoadLocale();
- else
- SendMessage(m_hwnd, DM_SETLOCALE, 0, 0);
- }
-
m_pContainer->hIconTaskbarOverlay = nullptr;
m_pContainer->UpdateTitle(m_hContact);
@@ -2119,14 +2112,6 @@ LRESULT CSrmmWindow::WndProc_Message(UINT msg, WPARAM wParam, LPARAM lParam) }
break;
- case WM_INPUTLANGCHANGE:
- if (PluginConfig.m_bAutoLocaleSupport && GetFocus() == m_message.GetHwnd() && IsActive()) {
- DM_SaveLocale(wParam, lParam);
- m_message.SendMsg(EM_SETLANGOPTIONS, 0, (LPARAM)m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
- return 1;
- }
- break;
-
case WM_ERASEBKGND:
return(CSkin::m_skinEnabled ? 0 : 1);
@@ -2686,12 +2671,7 @@ INT_PTR CSrmmWindow::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) m_dwFlags &= ~MWF_WASBACKGROUNDCREATE;
Resize();
PostMessage(m_hwnd, DM_UPDATEPICLAYOUT, 0, 0);
- if (PluginConfig.m_bAutoLocaleSupport) {
- if (m_hkl == nullptr)
- DM_LoadLocale();
- else
- PostMessage(m_hwnd, DM_SETLOCALE, 0, 0);
- }
+
if (m_hwndIEView != nullptr)
SetFocus(m_message.GetHwnd());
if (m_pContainer->dwFlags & CNT_SIDEBAR)
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index e5c2cd2186..756ac3209d 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -1237,77 +1237,6 @@ void CTabBaseDlg::GetSendFormat() m_SendFormat = PluginConfig.m_SendFormat ? 1 : 0;
}
-/////////////////////////////////////////////////////////////////////////////////////////
-// get user - readable locale information for the currently selected
-// keyboard layout.
-//
-// GetLocaleInfo() should no longer be used on Vista and later
-
-void CTabBaseDlg::GetLocaleID(const wchar_t *szKLName)
-{
- wchar_t szLI[256], *stopped = nullptr;
- WORD wCtype2[3];
- BOOL fLocaleNotSet;
- BYTE szTest[4] = { 0xe4, 0xf6, 0xfc, 0 };
-
- szLI[0] = szLI[1] = 0;
-
- PARAFORMAT2 pf2;
- memset(&pf2, 0, sizeof(PARAFORMAT2));
- USHORT langID = (USHORT)wcstol(szKLName, &stopped, 16);
- m_lcid = MAKELCID(langID, 0);
- /*
- * Vista+: read ISO locale names from the registry
- */
- if (PluginConfig.m_bIsVista) {
- HKEY hKey = nullptr;
- wchar_t szKey[20];
- DWORD dwLID = wcstoul(szKLName, &stopped, 16);
-
- mir_snwprintf(szKey, L"%04.04x", LOWORD(dwLID));
- if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_CLASSES_ROOT, L"MIME\\Database\\Rfc1766", 0, KEY_READ, &hKey)) {
- DWORD dwLength = 255;
- if (ERROR_SUCCESS == RegQueryValueEx(hKey, szKey, nullptr, nullptr, (unsigned char *)szLI, &dwLength)) {
- wchar_t* p;
-
- szLI[255] = 0;
- if ((p = wcschr(szLI, ';')) != nullptr)
- *p = 0;
- }
- RegCloseKey(hKey);
- }
- szLI[0] = towupper(szLI[0]);
- szLI[1] = towupper(szLI[1]);
- }
- else {
- GetLocaleInfo(m_lcid, LOCALE_SISO639LANGNAME, szLI, 10);
- wcsupr(szLI);
- }
- fLocaleNotSet = (m_lcID[0] == 0 && m_lcID[1] == 0);
- mir_snwprintf(m_lcID, szLI);
- GetStringTypeA(m_lcid, CT_CTYPE2, (char*)szTest, 3, wCtype2);
- pf2.cbSize = sizeof(pf2);
- pf2.dwMask = PFM_RTLPARA;
- m_message.SendMsg(EM_GETPARAFORMAT, 0, (LPARAM)&pf2);
- if (FindRTLLocale() && fLocaleNotSet) {
- if (wCtype2[0] == C2_RIGHTTOLEFT || wCtype2[1] == C2_RIGHTTOLEFT || wCtype2[2] == C2_RIGHTTOLEFT) {
- memset(&pf2, 0, sizeof(pf2));
- pf2.dwMask = PFM_RTLPARA;
- pf2.cbSize = sizeof(pf2);
- pf2.wEffects = PFE_RTLPARA;
- m_message.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- }
- else {
- memset(&pf2, 0, sizeof(pf2));
- pf2.dwMask = PFM_RTLPARA;
- pf2.cbSize = sizeof(pf2);
- pf2.wEffects = 0;
- m_message.SendMsg(EM_SETPARAFORMAT, 0, (LPARAM)&pf2);
- }
- m_message.SendMsg(EM_SETLANGOPTIONS, 0, m_message.SendMsg(EM_GETLANGOPTIONS, 0, 0) & ~IMF_AUTOKEYBOARD);
- }
-}
-
void CSrmmWindow::LoadContactAvatar()
{
m_ace = Utils::loadAvatarFromAVS(m_bIsMeta ? db_mc_getSrmmSub(m_hContact) : m_hContact);
diff --git a/plugins/TabSRMM/src/msgs.cpp b/plugins/TabSRMM/src/msgs.cpp index ac2a69d626..2e7bdbdd95 100644 --- a/plugins/TabSRMM/src/msgs.cpp +++ b/plugins/TabSRMM/src/msgs.cpp @@ -157,18 +157,6 @@ INT_PTR CTabBaseDlg::DlgProc(UINT msg, WPARAM wParam, LPARAM lParam) ActivateExistingTab(m_pContainer, m_hwnd);
return 0;
- case DM_SETLOCALE:
- if (m_dwFlags & MWF_WASBACKGROUNDCREATE)
- break;
- if (PluginConfig.m_bAutoLocaleSupport && IsActive()) {
- if (lParam)
- m_hkl = (HKL)lParam;
-
- if (m_hkl)
- ActivateKeyboardLayout(m_hkl, 0);
- }
- return 0;
-
case DM_QUERYCONTAINER: // container API support functions
if (lParam)
*(TContainerData**)lParam = m_pContainer;
diff --git a/plugins/TabSRMM/src/msgs.h b/plugins/TabSRMM/src/msgs.h index 5d2d65eeb4..b212ae4e81 100644 --- a/plugins/TabSRMM/src/msgs.h +++ b/plugins/TabSRMM/src/msgs.h @@ -393,10 +393,8 @@ public: void DM_EventAdded(WPARAM wParam, LPARAM lParam);
void DM_InitRichEdit();
void DM_InitTip();
- void DM_LoadLocale();
void DM_NotifyTyping(int mode);
void DM_RecalcPictureSize();
- void DM_SaveLocale(WPARAM wParam, LPARAM lParam);
void DM_SaveLogAsRTF() const;
void DM_ScrollToBottom(WPARAM wParam, LPARAM lParam);
void DM_Typing(bool fForceOff);
@@ -433,7 +431,6 @@ public: bool GetAvatarVisibility();
void GetClientIcon();
LONG GetDefaultMinimumInputHeight() const;
- void GetLocaleID(const wchar_t *szKLName);
HICON GetMyContactIcon(LPCSTR szSetting);
void GetMYUIN();
void GetMyNick();
@@ -756,7 +753,6 @@ struct TIconDescW #define DM_SELECTTAB (TM_USER+23)
#define DM_CLOSETABATMOUSE (TM_USER+24)
#define DM_STATUSICONCHANGE (TM_USER+25)
-#define DM_SETLOCALE (TM_USER+26)
#define DM_QUERYLASTUNREAD (TM_USER+28)
#define DM_QUERYPENDING (TM_USER+29)
#define DM_UPDATEPICLAYOUT (TM_USER+30)
diff --git a/plugins/TabSRMM/src/translator.cpp b/plugins/TabSRMM/src/translator.cpp index f52eddd944..d5cb2d58fc 100644 --- a/plugins/TabSRMM/src/translator.cpp +++ b/plugins/TabSRMM/src/translator.cpp @@ -168,7 +168,6 @@ TOptionListItem m_lvItemsTab[] = { 0, LPGENW("New windows are minimized (the option above MUST be active)"), 1, LOI_TYPE_SETTING, (UINT_PTR)"autocontainer", 1 },
{ 0, LPGENW("Activate a minimized window when a new tab is created inside it"), 0, LOI_TYPE_SETTING, (UINT_PTR)"cpopup", 1 },
{ 0, LPGENW("Automatically switch existing tabs in minimized windows on incoming messages (ignored when using Aero Peek task bar features)"), 1, LOI_TYPE_SETTING, (UINT_PTR)"autoswitchtabs", 1 },
- { 0, LPGENW("Remember and set keyboard layout per contact"), 1, LOI_TYPE_SETTING, (UINT_PTR)"al", 2 },
{ 0, LPGENW("Close button only hides message windows"), 0, LOI_TYPE_SETTING, (UINT_PTR)"hideonclose", 2 },
{ 0, LPGENW("Allow TAB key in typing area (this will disable focus selection by TAB key)"), 0, LOI_TYPE_SETTING, (UINT_PTR)"tabmode", 2 },
{ 0, LPGENW("Add offline contacts to multisend list"), 0, LOI_TYPE_SETTING, (UINT_PTR) "AllowOfflineMultisend", 2 },
|