2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Selection of text in attachments: captions, web page previews.

Text/HistoryItem/HistoryMedia::getState() unified.
Text::getStateElided added. Tested with web page previews only.
This commit is contained in:
John Preston
2016-04-13 21:29:32 +03:00
parent a033e31743
commit c4a7d48d96
19 changed files with 815 additions and 674 deletions

View File

@@ -1781,13 +1781,14 @@ bool MediaView::updateOverState(OverState newState) {
void MediaView::updateOver(QPoint pos) {
ClickHandlerPtr lnk;
ClickHandlerHost *lnkhost = nullptr;
bool inText;
if (_saveMsgStarted && _saveMsg.contains(pos)) {
_saveMsgText.getState(lnk, inText, pos.x() - _saveMsg.x() - st::medviewSaveMsgPadding.left(), pos.y() - _saveMsg.y() - st::medviewSaveMsgPadding.top(), _saveMsg.width() - st::medviewSaveMsgPadding.left() - st::medviewSaveMsgPadding.right());
auto textState = _saveMsgText.getState(pos.x() - _saveMsg.x() - st::medviewSaveMsgPadding.left(), pos.y() - _saveMsg.y() - st::medviewSaveMsgPadding.top(), _saveMsg.width() - st::medviewSaveMsgPadding.left() - st::medviewSaveMsgPadding.right());
lnk = textState.link;
lnkhost = this;
} else if (_captionRect.contains(pos)) {
_caption.getState(lnk, inText, pos.x() - _captionRect.x(), pos.y() - _captionRect.y(), _captionRect.width());
auto textState = _caption.getState(pos.x() - _captionRect.x(), pos.y() - _captionRect.y(), _captionRect.width());
lnk = textState.link;
lnkhost = this;
}