diff options
-rw-r--r-- | libs/mTextControl/src/FormattedTextDraw.cpp | 7 | ||||
-rw-r--r-- | plugins/NewStory/src/history_array.cpp | 14 | ||||
-rw-r--r-- | plugins/NewStory/src/history_array.h | 4 | ||||
-rw-r--r-- | plugins/NewStory/src/history_control.cpp | 6 |
4 files changed, 17 insertions, 14 deletions
diff --git a/libs/mTextControl/src/FormattedTextDraw.cpp b/libs/mTextControl/src/FormattedTextDraw.cpp index 16008cc7c3..e27739ac0a 100644 --- a/libs/mTextControl/src/FormattedTextDraw.cpp +++ b/libs/mTextControl/src/FormattedTextDraw.cpp @@ -296,8 +296,11 @@ BOOL CFormattedTextDraw::TxSetScrollPos(INT, INT, BOOL) return FALSE; } -void CFormattedTextDraw::TxInvalidateRect(LPCRECT, BOOL) -{} +void CFormattedTextDraw::TxInvalidateRect(LPCRECT, BOOL bRedraw) +{ + if (m_hwndParent) + ::InvalidateRect(m_hwndParent, NULL, bRedraw); +} void CFormattedTextDraw::TxViewChange(BOOL) {} diff --git a/plugins/NewStory/src/history_array.cpp b/plugins/NewStory/src/history_array.cpp index 20a9b903ae..2c4ce4a936 100644 --- a/plugins/NewStory/src/history_array.cpp +++ b/plugins/NewStory/src/history_array.cpp @@ -196,21 +196,21 @@ void ItemData::checkCreate(HWND hwnd) } } -bool ItemData::isLink(POINT pt, CMStringW *pwszUrl) const +bool ItemData::isLink(HWND hwnd, POINT pt, CMStringW *pwszUrl) const { int cp = MTextSendMessage(0, data, EM_CHARFROMPOS, 0, LPARAM(&pt)); if (cp == -1) return false; - if (!isLinkChar(cp)) + if (!isLinkChar(hwnd, cp)) return false; if (pwszUrl) { CHARRANGE sel = { cp, cp }; - while (isLinkChar(sel.cpMin-1)) + while (isLinkChar(hwnd, sel.cpMin-1)) sel.cpMin--; - while (isLinkChar(sel.cpMax)) + while (isLinkChar(hwnd, sel.cpMax)) sel.cpMax++; if (sel.cpMax > sel.cpMin) { @@ -229,18 +229,18 @@ bool ItemData::isLink(POINT pt, CMStringW *pwszUrl) const return true; } -bool ItemData::isLinkChar(int idx) const +bool ItemData::isLinkChar(HWND hwnd, int idx) const { if (idx < 0) return false; CHARRANGE sel = { idx, idx + 1 }; - MTextSendMessage(0, data, EM_EXSETSEL, 0, LPARAM(&sel)); + MTextSendMessage(hwnd, data, EM_EXSETSEL, 0, LPARAM(&sel)); CHARFORMAT2 cf = {}; cf.cbSize = sizeof(cf); cf.dwMask = CFM_LINK; - uint32_t res = MTextSendMessage(0, data, EM_GETCHARFORMAT, SCF_SELECTION, LPARAM(&cf)); + uint32_t res = MTextSendMessage(hwnd, data, EM_GETCHARFORMAT, SCF_SELECTION, LPARAM(&cf)); return ((res & CFM_LINK) && (cf.dwEffects & CFE_LINK)) || ((res & CFM_REVISED) && (cf.dwEffects & CFE_REVISED)); } diff --git a/plugins/NewStory/src/history_array.h b/plugins/NewStory/src/history_array.h index a893a634da..1bbc623a13 100644 --- a/plugins/NewStory/src/history_array.h +++ b/plugins/NewStory/src/history_array.h @@ -42,8 +42,8 @@ struct ItemData bool fetch(void); void fill(int tmpl); void load(bool bFullLoad = false); - bool isLink(POINT pt, CMStringW *url = nullptr) const; - bool isLinkChar(int idx) const; + bool isLink(HWND, POINT pt, CMStringW *url = nullptr) const; + bool isLinkChar(HWND, int idx) const; int getTemplate() const; int getCopyTemplate() const; diff --git a/plugins/NewStory/src/history_control.cpp b/plugins/NewStory/src/history_control.cpp index f6221fbbd8..a7cdcde421 100644 --- a/plugins/NewStory/src/history_control.cpp +++ b/plugins/NewStory/src/history_control.cpp @@ -559,7 +559,7 @@ void NewstoryListData::OpenFolder() int NewstoryListData::PaintItem(HDC hdc, ItemData *pItem, int top, int width, bool bDraw) { // remove any selections that might be created by the BBCodes parser - MTextSendMessage(0, pItem->data, EM_SETSEL, 0, 0); + MTextSendMessage(m_hwnd, pItem->data, EM_SETSEL, 0, 0); // LOGFONT lfText; COLORREF clText, clBack, clLine; @@ -1287,7 +1287,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM pt.y -= pItem->savedTop; CMStringW wszUrl; - if (pItem->isLink(pt, &wszUrl)) { + if (pItem->isLink(hwnd, pt, &wszUrl)) { Utils_OpenUrlW(wszUrl); return 0; } @@ -1339,7 +1339,7 @@ LRESULT CALLBACK NewstoryListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM MTextSendMessage(hwnd, pItem->data, msg, wParam, lParam); HCURSOR hOldCursor = GetCursor(); - HCURSOR hNewCursor = LoadCursor(0, (pItem->isLink(pt) || pItem->m_bOfflineFile) ? IDC_HAND : IDC_ARROW); + HCURSOR hNewCursor = LoadCursor(0, (pItem->isLink(hwnd, pt) || pItem->m_bOfflineFile) ? IDC_HAND : IDC_ARROW); if (hOldCursor != hNewCursor) SetCursor(hNewCursor); |