From 8307d69d0dbc7090956ea044eee19b4644104363 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 20 Dec 2013 22:55:34 +0000 Subject: - mathMod support removed; - Unicode message log window procedure; - Unicode urls git-svn-id: http://svn.miranda-ng.org/main/trunk@7309 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TabSRMM/src/chat/chat.h | 2 +- plugins/TabSRMM/src/chat/log.cpp | 70 ++++++++++------------------------- plugins/TabSRMM/src/chat/options.cpp | 1 - plugins/TabSRMM/src/chat/services.cpp | 2 - plugins/TabSRMM/src/chat/window.cpp | 29 ++------------- 5 files changed, 23 insertions(+), 81 deletions(-) (limited to 'plugins/TabSRMM/src/chat') diff --git a/plugins/TabSRMM/src/chat/chat.h b/plugins/TabSRMM/src/chat/chat.h index ad371a10f0..5ca2414e07 100644 --- a/plugins/TabSRMM/src/chat/chat.h +++ b/plugins/TabSRMM/src/chat/chat.h @@ -274,7 +274,7 @@ struct TMUCSettings bool bLogClassicIndicators, bAlternativeSorting, bAnnoyingHighlight, bCreateWindowOnHighlight; bool bLogSymbols, bClassicIndicators, bClickableNicks, bColorizeNicks, bColorizeNicksInLog; - bool bScaleIcons, bUseDividers, bDividersUsePopupConfig, bMathMod; + bool bScaleIcons, bUseDividers, bDividersUsePopupConfig; HANDLE hGroup; CMUCHighlight* Highlight; diff --git a/plugins/TabSRMM/src/chat/log.cpp b/plugins/TabSRMM/src/chat/log.cpp index 14b9236cd0..0c8906516e 100644 --- a/plugins/TabSRMM/src/chat/log.cpp +++ b/plugins/TabSRMM/src/chat/log.cpp @@ -954,20 +954,16 @@ static DWORD CALLBACK Log_StreamCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedraw, bool bPhaseTwo) { - EDITSTREAM stream; - LOGSTREAMDATA streamData; CHARRANGE oldsel, sel, newsel; POINT point = {0}; - SCROLLINFO scroll; - WPARAM wp; - HWND hwndRich; - TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); + TWindowData *dat = (TWindowData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA); if (hwndDlg == 0 || lin == 0 || si == 0 || dat == 0) return; - hwndRich = GetDlgItem(hwndDlg, IDC_CHAT_LOG); - ZeroMemory(&streamData, sizeof(LOGSTREAMDATA)); + HWND hwndRich = GetDlgItem(hwndDlg, IDC_CHAT_LOG); + + LOGSTREAMDATA streamData = { 0 }; streamData.hwnd = hwndRich; streamData.si = si; streamData.lin = lin; @@ -979,9 +975,11 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr if (bRedraw || si->iType != GCW_CHATROOM || !si->bFilterEnabled || (si->iLogFilterFlags&lin->iType) != 0) { bool bFlag = false, fDoReplace; - ZeroMemory(&stream, sizeof(stream)); + EDITSTREAM stream = { 0 }; stream.pfnCallback = Log_StreamCallback; stream.dwCookie = (DWORD_PTR) & streamData; + + SCROLLINFO scroll = { 0 }; scroll.cbSize = sizeof(SCROLLINFO); scroll.fMask = SIF_RANGE | SIF_POS | SIF_PAGE; GetScrollInfo(GetDlgItem(hwndDlg, IDC_CHAT_LOG), SB_VERT, &scroll); @@ -1001,7 +999,7 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr bRedraw = TRUE; // should the event(s) be appended to the current log - wp = bRedraw ? SF_RTF : SFF_SELECTION | SF_RTF; + WPARAM wp = bRedraw ? SF_RTF : SFF_SELECTION | SF_RTF; //get the number of pixels per logical inch if (bRedraw) { @@ -1023,54 +1021,27 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr //SendMessage(hwndRich, EM_EXGETSEL, 0, (LPARAM)&newsel); /* - * for new added events, only replace in message or action events. - * no need to replace smileys or math formulas elsewhere - */ - + * for new added events, only replace in message or action events. + * no need to replace smileys or math formulas elsewhere + */ fDoReplace = (bRedraw || (lin->ptszText && (lin->iType == GC_EVENT_MESSAGE || lin->iType == GC_EVENT_ACTION))); - - /* - * use mathmod to replace formulas - */ - if (g_Settings.bMathMod && fDoReplace) { - TMathRicheditInfo mathReplaceInfo; - CHARRANGE mathNewSel; - mathNewSel.cpMin = sel.cpMin; - - if (mathNewSel.cpMin < 0) - mathNewSel.cpMin = 0; - - mathNewSel.cpMax = -1; - - mathReplaceInfo.hwndRichEditControl = hwndRich; - - if (!bRedraw) - mathReplaceInfo.sel = &mathNewSel; - else - mathReplaceInfo.sel = 0; - - mathReplaceInfo.disableredraw = TRUE; - CallService(MATH_RTF_REPLACE_FORMULAE, 0, (LPARAM)&mathReplaceInfo); - bFlag = TRUE; - } - /* * replace marked nicknames with hyperlinks to make the nicks * clickable */ - if (g_Settings.bClickableNicks) { - CHARFORMAT2 cf2; FINDTEXTEX fi, fi2; + CHARFORMAT2 cf2; ZeroMemory(&cf2, sizeof(CHARFORMAT2)); + cf2.cbSize = sizeof(cf2); + fi2.lpstrText = _T("#++~~"); fi.chrg.cpMin = bRedraw ? 0 : sel.cpMin; fi.chrg.cpMax = -1; fi.lpstrText = _T("~~++#"); - cf2.cbSize = sizeof(cf2); while (SendMessage(hwndRich, EM_FINDTEXTEX, FR_DOWN, (LPARAM)&fi) > -1) { fi2.chrg.cpMin = fi.chrgText.cpMin; @@ -1097,10 +1068,9 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr SendMessage(hwndRich, EM_SETSEL, -1, -1); } - /* - * run smileyadd - */ + * run smileyadd + */ if (PluginConfig.g_SmileyAddAvail && fDoReplace) { newsel.cpMax = -1; newsel.cpMin = sel.cpMin; @@ -1117,11 +1087,9 @@ void Log_StreamInEvent(HWND hwndDlg, LOGINFO* lin, SESSION_INFO *si, bool bRedr } /* - * trim the message log to the number of most recent events - * this uses hidden marks in the rich text to find the events which should be deleted - */ - - + * trim the message log to the number of most recent events + * this uses hidden marks in the rich text to find the events which should be deleted + */ if (si->wasTrimmed) { TCHAR szPattern[50]; FINDTEXTEX fi; diff --git a/plugins/TabSRMM/src/chat/options.cpp b/plugins/TabSRMM/src/chat/options.cpp index 7648b6fa63..e1122a9483 100644 --- a/plugins/TabSRMM/src/chat/options.cpp +++ b/plugins/TabSRMM/src/chat/options.cpp @@ -1257,7 +1257,6 @@ void LoadGlobalSettings(void) g_Settings.bScaleIcons = M.GetBool("Chat", "ScaleIcons", true); g_Settings.bUseDividers = M.GetBool("Chat", "UseDividers", true); g_Settings.bDividersUsePopupConfig = M.GetBool("Chat", "DividersUsePopupConfig", true); - g_Settings.bMathMod = ServiceExists(MATH_RTF_REPLACE_FORMULAE) && M.GetBool("Chat", "MathModSupport", false); g_Settings.bDoubleClick4Privat = M.GetBool("Chat", "DoubleClick4Privat", false); g_Settings.bShowContactStatus = M.GetBool("Chat", "ShowContactStatus", true); diff --git a/plugins/TabSRMM/src/chat/services.cpp b/plugins/TabSRMM/src/chat/services.cpp index 5ce0ab9f9e..23914251de 100644 --- a/plugins/TabSRMM/src/chat/services.cpp +++ b/plugins/TabSRMM/src/chat/services.cpp @@ -62,8 +62,6 @@ int Chat_ModulesLoaded(WPARAM wParam, LPARAM lParam) hLeaveMenuItem = Menu_AddContactMenuItem(&mi); CList_SetAllOffline(TRUE, NULL); - - g_Settings.bMathMod = ServiceExists(MATH_RTF_REPLACE_FORMULAE) && M.GetByte("Chat", "MathModSupport", 0); return 0; } diff --git a/plugins/TabSRMM/src/chat/window.cpp b/plugins/TabSRMM/src/chat/window.cpp index 1ac9ed8ecc..86c725e219 100644 --- a/plugins/TabSRMM/src/chat/window.cpp +++ b/plugins/TabSRMM/src/chat/window.cpp @@ -206,7 +206,7 @@ static BOOL CheckCustomLink(HWND hwndDlg, POINT* ptClient, UINT uMsg, WPARAM wPa return bIsCustomLink; } -static bool IsStringValidLink(TCHAR* pszText) +bool IsStringValidLink(TCHAR* pszText) { if (pszText == NULL) return false; @@ -312,11 +312,6 @@ static void Chat_UpdateWindowState(TWindowData *dat, UINT msg) UpdateTrayMenuState(dat, FALSE); DM_SetDBButtonStates(hwndDlg, dat); - if (g_Settings.bMathMod) { - CallService(MTH_Set_ToolboxEditHwnd, 0, (LPARAM)GetDlgItem(hwndDlg, IDC_CHAT_MESSAGE)); - MTH_updateMathWindow(dat); - } - if (dat->dwFlagsEx & MWF_EX_DELAYEDSPLITTER) { dat->dwFlagsEx &= ~MWF_EX_DELAYEDSPLITTER; ShowWindow(dat->pContainer->hwnd, SW_RESTORE); @@ -735,24 +730,9 @@ static LRESULT CALLBACK MessageSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, BOOL isShift, isAlt, isCtrl; KbdState(mwdat, isShift, isCtrl, isAlt); - if (PluginConfig.g_bSoundOnTyping && !isAlt &&!isCtrl&&!(mwdat->pContainer->dwFlags&CNT_NOSOUND)&&wParam!=VK_ESCAPE&&!(wParam==VK_TAB&&PluginConfig.m_AllowTab)) + if (PluginConfig.g_bSoundOnTyping && !isAlt &&!isCtrl&&!(mwdat->pContainer->dwFlags&CNT_NOSOUND) && wParam != VK_ESCAPE&&!(wParam == VK_TAB&&PluginConfig.m_AllowTab)) SkinPlaySound("SoundOnTyping"); - if (wParam == 0x0d && isCtrl && PluginConfig.m_MathModAvail) { - TCHAR toInsert[100]; - BYTE keyState[256]; - size_t i; - size_t iLen = lstrlen(PluginConfig.m_MathModStartDelimiter); - ZeroMemory(keyState, 256); - _tcsncpy(toInsert, PluginConfig.m_MathModStartDelimiter, 30); - _tcsncat(toInsert, PluginConfig.m_MathModStartDelimiter, 30); - SendMessage(hwnd, EM_REPLACESEL, TRUE, (LPARAM)toInsert); - SetKeyboardState(keyState); - for (i=0; i < iLen; i++) - SendMessage(hwnd, WM_KEYDOWN, mwdat->dwFlags & MWF_LOG_RTL ? VK_RIGHT : VK_LEFT, 0); - return 0; - } - if (isCtrl && !isAlt && !isShift) { MODULEINFO *mi = MM_FindModule(Parentsi->pszModule); @@ -2886,7 +2866,7 @@ LABEL_SHOWWINDOW: tr2.chrg.cpMax = chr.cpMax + 1; /* if there is no space after selection, or there is nothing after selection at all... */ - if (! SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2) || ! _istspace(*tr2.lpstrText)) { + if (!SendDlgItemMessage(hwndDlg, IDC_CHAT_MESSAGE, EM_GETTEXTRANGE, 0, (LPARAM)&tr2) || !_istspace(*tr2.lpstrText)) { tszAppeal[st++] = _T(' '); tszAppeal[st++] = _T('\0'); } @@ -3044,9 +3024,6 @@ LABEL_SHOWWINDOW: break; case IDC_CHAT_MESSAGE: - if (g_Settings.bMathMod) - MTH_updateMathWindow(dat); - if (HIWORD(wParam) == EN_CHANGE) { if (dat->pContainer->hwndActive == hwndDlg) UpdateReadChars(dat); -- cgit v1.2.3