Fix bottom info display in media.

This commit is contained in:
John Preston 2024-06-03 15:03:41 +04:00
parent eafc01e02b
commit e8a929bdbd
5 changed files with 30 additions and 22 deletions

View File

@ -2451,7 +2451,11 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
const auto quoteOffset = selected.offset;
text.replace('&', u"&&"_q);
_menu->addAction(text, [=] {
if (canSendReply && !base::IsCtrlPressed()) {
const auto still = session->data().message(itemId);
const auto forceAnotherChat = base::IsCtrlPressed()
&& still
&& still->allowsForward();
if (canSendReply && !forceAnotherChat) {
_widget->replyToMessage({
.messageId = itemId,
.quote = quote,

View File

@ -331,9 +331,12 @@ RepliesWidget::RepliesWidget(
? Data::CanSendAnything(_topic)
: Data::CanSendAnything(_history->peer);
const auto &to = request.to;
if (_joinGroup || !canSendReply || request.forceAnotherChat) {
const auto still = _history->owner().message(to.messageId);
const auto allowInAnotherChat = still && still->allowsForward();
if (allowInAnotherChat
&& (_joinGroup || !canSendReply || request.forceAnotherChat)) {
Controls::ShowReplyToChatBox(controller->uiShow(), { to });
} else {
} else if (!_joinGroup && canSendReply) {
replyToMessage(to);
_composeControls->focus();
}

View File

@ -762,7 +762,8 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
fullRight = maxRight;
}
}
if (isRound || needInfoDisplay()) {
if (isRound
|| ((!bubble || isBubbleBottom()) && needInfoDisplay())) {
_parent->drawInfo(
p,
context,
@ -1117,7 +1118,9 @@ TextState Gif::textState(QPoint point, StateRequest request) const {
? _cancell
: _savel;
}
if (unwrapped || !bubble) {
const auto checkBottomInfo = !inWebPage
&& (unwrapped || !bubble || isBubbleBottom());
if (checkBottomInfo) {
auto fullRight = usex + paintx + usew;
auto fullBottom = painty + painth;
auto maxRight = _parent->width() - st::msgMargin.left();
@ -1136,19 +1139,17 @@ TextState Gif::textState(QPoint point, StateRequest request) const {
fullRight = maxRight;
}
}
if (!inWebPage) {
const auto bottomInfoResult = _parent->bottomInfoTextState(
fullRight,
fullBottom,
point,
(unwrapped
? InfoDisplayType::Background
: InfoDisplayType::Image));
if (bottomInfoResult.link
|| bottomInfoResult.cursor != CursorState::None
|| bottomInfoResult.customTooltip) {
return bottomInfoResult;
}
const auto bottomInfoResult = _parent->bottomInfoTextState(
fullRight,
fullBottom,
point,
(unwrapped
? InfoDisplayType::Background
: InfoDisplayType::Image));
if (bottomInfoResult.link
|| bottomInfoResult.cursor != CursorState::None
|| bottomInfoResult.customTooltip) {
return bottomInfoResult;
}
if (const auto size = bubble ? std::nullopt : _parent->rightActionSize()) {
const auto rightActionWidth = size->width();

View File

@ -396,7 +396,7 @@ void GroupedMedia::draw(Painter &p, const PaintContext &context) const {
}
// date
if (_parent->media() == this && isBubbleBottom()) {
if (_parent->media() == this && (!_parent->hasBubble() || isBubbleBottom())) {
auto fullRight = width();
auto fullBottom = height();
if (needInfoDisplay()) {
@ -455,7 +455,7 @@ PointState GroupedMedia::pointState(QPoint point) const {
TextState GroupedMedia::textState(QPoint point, StateRequest request) const {
const auto groupPadding = groupedPadding();
auto result = getPartState(point - QPoint(0, groupPadding.top()), request);
if (_parent->media() == this) {
if (_parent->media() == this && (!_parent->hasBubble() || isBubbleBottom())) {
auto fullRight = width();
auto fullBottom = height();
const auto bottomInfoResult = _parent->bottomInfoTextState(

View File

@ -364,7 +364,7 @@ void Photo::draw(Painter &p, const PaintContext &context) const {
}
// date
if (isBubbleBottom() && !inWebPage) {
if (!inWebPage && (!bubble || isBubbleBottom())) {
auto fullRight = paintx + paintw;
auto fullBottom = painty + painth;
if (needInfoDisplay()) {
@ -621,7 +621,7 @@ TextState Photo::textState(QPoint point, StateRequest request) const {
result.cursor = CursorState::Enlarge;
}
}
if (isBubbleBottom() && _parent->media() == this) {
if (_parent->media() == this && (!_parent->hasBubble() || isBubbleBottom())) {
auto fullRight = paintx + paintw;
auto fullBottom = painty + painth;
const auto bottomInfoResult = _parent->bottomInfoTextState(