diff options
-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 | ||||
-rw-r--r-- | plugins/ExternalAPI/m_text.h | 2 | ||||
-rw-r--r-- | plugins/NewStory/src/history_array.cpp | 2 | ||||
-rw-r--r-- | plugins/Popup/src/popup_wnd2.cpp | 5 |
6 files changed, 16 insertions, 25 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; diff --git a/plugins/ExternalAPI/m_text.h b/plugins/ExternalAPI/m_text.h index 5e10383bb5..0780b58bd1 100644 --- a/plugins/ExternalAPI/m_text.h +++ b/plugins/ExternalAPI/m_text.h @@ -47,7 +47,7 @@ enum MTEXTCONTROL_DLL(HANDLE) MTextRegister(const char *userTitle, DWORD options);
// 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);
// allocate text object (advanced)
MTEXTCONTROL_DLL(HANDLE) MTextCreateEx(HANDLE userHandle, void *text, DWORD flags);
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 33724bdff5..ecfc72caa0 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -49,7 +49,7 @@ bool Filter::check(ItemData *item) void ItemData::checkCreate(HWND hwnd) { if (data == nullptr) { - data = MTextCreateW(htuLog, ptrW(TplFormatString(getTemplate(), hContact, this))); + data = MTextCreateW(htuLog, Proto_GetBaseAccountName(hContact), ptrW(TplFormatString(getTemplate(), hContact, this))); MTextSetParent(data, hwnd); } } diff --git a/plugins/Popup/src/popup_wnd2.cpp b/plugins/Popup/src/popup_wnd2.cpp index 3c0d1a96c3..cdc4a76c02 100644 --- a/plugins/Popup/src/popup_wnd2.cpp +++ b/plugins/Popup/src/popup_wnd2.cpp @@ -740,9 +740,10 @@ void PopupWnd2::buildMText() m_mtText = m_mtTitle = nullptr;
if (m_lptzText && m_lptzTitle) {
+ auto *szProto = Proto_GetBaseAccountName(m_hContact);
m_textType = TT_MTEXT;
- m_mtText = MTextCreateW(htuText, m_lptzText);
- m_mtTitle = MTextCreateW(htuTitle, m_lptzTitle);
+ m_mtText = MTextCreateW(htuText, szProto, m_lptzText);
+ m_mtTitle = MTextCreateW(htuTitle, szProto, m_lptzTitle);
}
}
|