diff options
author | George Hazan <ghazan@miranda.im> | 2020-08-16 18:19:00 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-08-16 18:19:00 +0300 |
commit | cbae3129961119ea4415ec2643bb62f04be47dcf (patch) | |
tree | e96bdbbe0247f814898b13d494d8a1d5351ce4e0 /libs | |
parent | d11b65ef96075a0da05d88913c6bcea619a4c2f9 (diff) |
fixes #2538 (NewStory: add stickers support to message log and history)
Diffstat (limited to 'libs')
-rw-r--r-- | libs/mTextControl/src/services.cpp | 28 | ||||
-rw-r--r-- | libs/mTextControl/src/textcontrol.cpp | 2 | ||||
-rw-r--r-- | libs/mTextControl/src/textusers.cpp | 2 |
3 files changed, 11 insertions, 21 deletions
diff --git a/libs/mTextControl/src/services.cpp b/libs/mTextControl/src/services.cpp index c457ba3156..048194f067 100644 --- a/libs/mTextControl/src/services.cpp +++ b/libs/mTextControl/src/services.cpp @@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA struct TextObject { DWORD options; + const char *szProto; IFormattedTextDraw *ftd; TextObject() : options(0), ftd(nullptr) {} ~TextObject() { if (ftd) delete ftd; } @@ -45,44 +46,33 @@ void MText_InitFormatting1(TextObject *text) bbCodeParse(text->ftd); // smilies - // HWND hwnd = (HWND)CallServiceSync(MS_TEXT_CREATEPROXY, (WPARAM)text, 0); HWND hwnd = CreateProxyWindow(text->ftd->getTextService()); - SMADD_RICHEDIT3 sm = { 0 }; + + SMADD_RICHEDIT3 sm = {}; sm.cbSize = sizeof(sm); sm.hwndRichEditControl = hwnd; sm.rangeToReplace = nullptr; - sm.Protocolname = nullptr; + sm.Protocolname = text->szProto; sm.flags = SAFLRE_INSERTEMF; - CallService(MS_SMILEYADD_REPLACESMILEYS, RGB(0xff, 0xff, 0xff), (LPARAM)&sm); - DestroyWindow(hwnd); + CallService(MS_SMILEYADD_REPLACESMILEYS, 0, (LPARAM)&sm); - // text->ftd->getTextService()->TxSendMessage(EM_SETSEL, 0, -1, &lResult); - /* - // rtl stuff - PARAFORMAT2 pf2; - pf2.cbSize = sizeof(pf2); - pf2.dwMask = PFM_ALIGNMENT|PFM_RTLPARA; - pf2.wEffects = PFE_RTLPARA; - pf2.wAlignment = PFA_RIGHT; - text->ftd->getTextService()->TxSendMessage(EM_SETSEL, 0, -1, &lResult); - text->ftd->getTextService()->TxSendMessage(EM_SETPARAFORMAT, 0, (LPARAM)&pf2, &lResult); - text->ftd->getTextService()->TxSendMessage(EM_SETSEL, 0, 0, &lResult); - */ + DestroyWindow(hwnd); } ///////////////////////////////////////////////////////////////////////////////////////// // allocate text object (unicode) -MTEXTCONTROL_DLL(HANDLE) MTextCreateW(HANDLE userHandle, WCHAR *text) +MTEXTCONTROL_DLL(HANDLE) MTextCreateW(HANDLE userHandle, const char *szProto, const wchar_t *text) { TextObject *result = new TextObject; + result->szProto = szProto; result->options = TextUserGetOptions(userHandle); result->ftd = new CFormattedTextDraw; result->ftd->Create(); InitRichEdit(result->ftd->getTextService()); MText_InitFormatting0(result->ftd, result->options); - result->ftd->putTextW(text); + result->ftd->putTextW((WCHAR*)text); MText_InitFormatting1(result); return (HANDLE)result; diff --git a/libs/mTextControl/src/textcontrol.cpp b/libs/mTextControl/src/textcontrol.cpp index c62148269b..d58fd0e1c1 100644 --- a/libs/mTextControl/src/textcontrol.cpp +++ b/libs/mTextControl/src/textcontrol.cpp @@ -76,7 +76,7 @@ LRESULT CALLBACK MTextControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM int textLength = GetWindowTextLength(hwnd); data->text = new wchar_t[textLength + 1]; GetWindowText(hwnd, data->text, textLength + 1); - data->mtext = MTextCreateW(data->htu, data->text); + data->mtext = MTextCreateW(data->htu, 0, data->text); MTextSetParent(data->mtext, hwnd); diff --git a/libs/mTextControl/src/textusers.cpp b/libs/mTextControl/src/textusers.cpp index 11be479126..6463d96b9d 100644 --- a/libs/mTextControl/src/textusers.cpp +++ b/libs/mTextControl/src/textusers.cpp @@ -30,7 +30,7 @@ MTEXTCONTROL_DLL(HANDLE) MTextRegister(const char *userTitle, DWORD options) textUserNew->name = new char[mir_strlen(userTitle) + 1]; mir_strcpy(textUserNew->name, userTitle); textUserNew->options = - (db_get_dw(0, MODULENAME, userTitle, options)&MTEXT_FANCY_MASK) | (textUserNew->options&MTEXT_SYSTEM_MASK); + (db_get_dw(0, MODULENAME, userTitle, options) & MTEXT_FANCY_MASK) | (textUserNew->options & MTEXT_SYSTEM_MASK); db_set_dw(0, MODULENAME, userTitle, textUserNew->options); textUserNew->prev = textUserLast; textUserNew->next = nullptr; |