diff options
-rw-r--r-- | libs/mTextControl/src/FormattedTextDraw.cpp | 2 | ||||
-rw-r--r-- | libs/mTextControl/src/services.cpp | 16 | ||||
-rw-r--r-- | libs/mTextControl/src/textusers.cpp | 2 | ||||
-rw-r--r-- | plugins/ExternalAPI/m_text.h | 7 | ||||
-rw-r--r-- | plugins/NewStory/src/history_array.cpp | 17 | ||||
-rw-r--r-- | plugins/NewStory/src/history_array.h | 1 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 5 |
7 files changed, 36 insertions, 14 deletions
diff --git a/libs/mTextControl/src/FormattedTextDraw.cpp b/libs/mTextControl/src/FormattedTextDraw.cpp index db171f174e..8ae67f69a2 100644 --- a/libs/mTextControl/src/FormattedTextDraw.cpp +++ b/libs/mTextControl/src/FormattedTextDraw.cpp @@ -31,7 +31,7 @@ const IID IID_ITextDocument = { ///////////////////////////////////////////////////////////////////////////// // CallBack functions -uint32_t CALLBACK EditStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) +static DWORD CALLBACK EditStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb) { COOKIE *pCookie = (COOKIE *)dwCookie; if (pCookie->isUnicode) { diff --git a/libs/mTextControl/src/services.cpp b/libs/mTextControl/src/services.cpp index 397c6b37e5..b38ef88367 100644 --- a/libs/mTextControl/src/services.cpp +++ b/libs/mTextControl/src/services.cpp @@ -92,10 +92,18 @@ MTEXTCONTROL_DLL(TextObject *) MTextCreateEx(HANDLE userHandle, void *text, uint InitRichEdit(result->ftd->getTextService()); MText_InitFormatting0(result->ftd, result->options); - if (flags & MTEXT_FLG_WCHAR) - result->ftd->putTextW((wchar_t *)text); - else - result->ftd->putTextA((char *)text); + if (flags & MTEXT_FLG_RTF) { + if (flags & MTEXT_FLG_WCHAR) + result->ftd->putRTFTextW((wchar_t *)text); + else + result->ftd->putRTFTextA((char *)text); + } + else { + if (flags & MTEXT_FLG_WCHAR) + result->ftd->putTextW((wchar_t *)text); + else + result->ftd->putTextA((char *)text); + } MText_InitFormatting1(result); delete result; diff --git a/libs/mTextControl/src/textusers.cpp b/libs/mTextControl/src/textusers.cpp index aa276183ac..ced1b93866 100644 --- a/libs/mTextControl/src/textusers.cpp +++ b/libs/mTextControl/src/textusers.cpp @@ -24,7 +24,7 @@ HANDLE htuDefault = nullptr; static TextUser *textUserFirst = nullptr; static TextUser *textUserLast = nullptr; -MTEXTCONTROL_DLL(HANDLE) MTextRegister(const char *userTitle, DWORD options) +MTEXTCONTROL_DLL(HANDLE) MTextRegister(const char *userTitle, uint32_t options) { TextUser *textUserNew = new TextUser; textUserNew->name = new char[mir_strlen(userTitle) + 1]; diff --git a/plugins/ExternalAPI/m_text.h b/plugins/ExternalAPI/m_text.h index 2039de8ba1..1c231c2fd2 100644 --- a/plugins/ExternalAPI/m_text.h +++ b/plugins/ExternalAPI/m_text.h @@ -42,17 +42,18 @@ enum // text object flags
MTEXT_FLG_CHAR = 0x00000000,
MTEXT_FLG_WCHAR = 0x00000001,
- MTEXT_FLG_BIDI_RTL = 0x00000002
+ MTEXT_FLG_BIDI_RTL = 0x00000002,
+ MTEXT_FLG_RTF = 0x00000004,
};
// subscribe to MText services
-MTEXTCONTROL_DLL(HANDLE) MTextRegister(const char *userTitle, DWORD options);
+MTEXTCONTROL_DLL(HANDLE) MTextRegister(const char *userTitle, uint32_t options);
// allocate text object (unicode)
MTEXTCONTROL_DLL(HText) MTextCreateW(HANDLE userHandle, const char *szProto, const wchar_t *text);
// allocate text object (advanced)
-MTEXTCONTROL_DLL(HText) MTextCreateEx(HANDLE userHandle, void *text, DWORD flags);
+MTEXTCONTROL_DLL(HText) MTextCreateEx(HANDLE userHandle, void *text, uint32_t flags);
// destroys text object
MTEXTCONTROL_DLL(int) MTextDestroy(HText text);
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 51139dd075..0bcb7e8f9b 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -49,7 +49,10 @@ bool Filter::check(ItemData *item) void ItemData::checkCreate(HWND hwnd) { if (data == nullptr) { - data = MTextCreateW(htuLog, Proto_GetBaseAccountName(hContact), ptrW(TplFormatString(getTemplate(), hContact, this))); + if (bRtf) + data = MTextCreateEx(htuLog, this->wtext, MTEXT_FLG_WCHAR | MTEXT_FLG_RTF); + else + data = MTextCreateW(htuLog, Proto_GetBaseAccountName(hContact), ptrW(TplFormatString(getTemplate(), hContact, this))); MTextSetParent(data, hwnd); MTextActivate(data, true); } @@ -124,12 +127,18 @@ void ItemData::load(bool bFullLoad) break; case EVENTTYPE_FILE: - wchar_t buf[MAX_PATH]; - CallService(MS_FILE_GETRECEIVEDFILESFOLDERW, hContact, (LPARAM)buf); { + CMStringW wszFileName; DB::FILE_BLOB blob(dbe); + if (blob.isOffline()) { + wszFileName = Srmm_GetOfflineFileName(hContact); + } + else { + wchar_t buf[MAX_PATH]; + CallService(MS_FILE_GETRECEIVEDFILESFOLDERW, hContact, (LPARAM)buf); - CMStringW wszFileName(buf); + wszFileName = buf; + } wszFileName.Append(blob.getName()); // if a filename contains spaces, URL will be broken diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h index 1df5ee2c76..6401ff1644 100644 --- a/plugins/NewStory/src/history_array.h +++ b/plugins/NewStory/src/history_array.h @@ -8,6 +8,7 @@ struct ItemData bool bSelected; bool bLoaded; + bool bRtf; int savedTop; DB::EventInfo dbe; diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index bcb75402f8..e57b8ac52a 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -119,6 +119,9 @@ struct NewstoryListData : public MZeroedObject } ItemData *item = items[index]; + if (item->dbe.eventType != EVENTTYPE_MESSAGE) + return; + int fontid, colorid; item->getFontColor(fontid, colorid); @@ -946,7 +949,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM void InitNewstoryControl() { - htuLog = MTextRegister("Newstory", MTEXT_FANCY_DEFAULT | MTEXT_SYSTEM_HICONS); + htuLog = MTextRegister("Newstory", MTEXT_FANCY_DEFAULT | MTEXT_SYSTEM_HICONS | MTEXT_FANCY_SMILEYS); WNDCLASS wndclass = {}; wndclass.style = /*CS_HREDRAW | CS_VREDRAW | */CS_DBLCLKS | CS_GLOBALCLASS; |