summaryrefslogtreecommitdiff
path: root/plugins/NewStory/src/history_array.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-05-10 12:39:41 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-05-10 12:39:47 +0300
commit17895ec37e6e958d9dec963484091f38a3329443 (patch)
tree5f21c1014674f807fea54f802293db26654a3001 /plugins/NewStory/src/history_array.cpp
parent0ef19712e4a5130e58f3931f19090ca8cfe6cf3a (diff)
mTextControl related code cleaning
Diffstat (limited to 'plugins/NewStory/src/history_array.cpp')
-rw-r--r--plugins/NewStory/src/history_array.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp
index c8c5fc44a4..df39a0ef0f 100644
--- a/plugins/NewStory/src/history_array.cpp
+++ b/plugins/NewStory/src/history_array.cpp
@@ -1,5 +1,10 @@
#include "stdafx.h"
+extern HANDLE htuLog;
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// Filters
+
bool Filter::check(ItemData *item)
{
if (!item) return false;
@@ -41,6 +46,30 @@ bool Filter::check(ItemData *item)
/////////////////////////////////////////////////////////////////////////////////////////
// Event
+void ItemData::checkCreate(HWND hwnd)
+{
+ if (data == nullptr) {
+ data = MTextCreateW(htuLog, ptrW(TplFormatString(getTemplate(), hContact, this)));
+ MTextSetParent(data, hwnd);
+ }
+}
+
+bool ItemData::isLink(POINT pt) const
+{
+ int cp = MTextSendMessage(0, data, EM_CHARFROMPOS, 0, LPARAM(&pt));
+ if (cp == -1)
+ return false;
+
+ CHARRANGE cr = { cp, cp + 1 };
+ MTextSendMessage(0, data, EM_EXSETSEL, 0, LPARAM(&cr));
+
+ CHARFORMAT2 cf = {};
+ cf.cbSize = sizeof(cf);
+ cf.dwMask = CFM_LINK;
+ DWORD res = MTextSendMessage(0, data, EM_GETCHARFORMAT, SCF_SELECTION, LPARAM(&cf));
+ return ((res & CFM_LINK) && (cf.dwEffects & CFE_LINK)) || ((res & CFM_REVISED) && (cf.dwEffects & CFE_REVISED));
+}
+
void ItemData::load(bool bFullLoad)
{
if (!bFullLoad || bLoaded)
@@ -107,6 +136,20 @@ int ItemData::getTemplate() const
}
}
+int ItemData::getCopyTemplate() const
+{
+ switch (dbe.eventType) {
+ case EVENTTYPE_MESSAGE: return TPL_COPY_MESSAGE;
+ case EVENTTYPE_FILE: return TPL_COPY_FILE;
+ case EVENTTYPE_STATUSCHANGE: return TPL_COPY_SIGN;
+ case EVENTTYPE_AUTHREQUEST: return TPL_COPY_AUTH;
+ case EVENTTYPE_ADDED: return TPL_COPY_ADDED;
+ case EVENTTYPE_JABBER_PRESENCE: return TPL_COPY_PRESENCE;
+ default:
+ return TPL_COPY_OTHER;
+ }
+}
+
void ItemData::getFontColor(int &fontId, int &colorId) const
{
switch (dbe.eventType) {