diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index 60a544708..dca4e0af0 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1622,8 +1622,8 @@ void Message::paintText( .position = trect.topLeft(), .availableWidth = trect.width(), .palette = &stm->textPalette, - .pre = stm->preBlockCache.get(), - .blockquote = stm->blockquoteBlockCache.get(), + .pre = stm->preCache.get(), + .blockquote = stm->blockquoteCache.get(), .colors = context.st->highlightColors(), .spoiler = Ui::Text::DefaultSpoilerCache(), .now = context.now, diff --git a/Telegram/SourceFiles/history/view/media/history_view_document.cpp b/Telegram/SourceFiles/history/view/media/history_view_document.cpp index 82c6af3d1..c8e25a551 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_document.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_document.cpp @@ -748,8 +748,8 @@ void Document::draw( .position = { st::msgPadding.left(), captiontop }, .availableWidth = captionw, .palette = &stm->textPalette, - .pre = stm->preBlockCache.get(), - .blockquote = stm->blockquoteBlockCache.get(), + .pre = stm->preCache.get(), + .blockquote = stm->blockquoteCache.get(), .colors = context.st->highlightColors(), .spoiler = Ui::Text::DefaultSpoilerCache(), .now = context.now, diff --git a/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp b/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp index fe9287df5..f34ca7574 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_extended_preview.cpp @@ -235,8 +235,8 @@ void ExtendedPreview::draw(Painter &p, const PaintContext &context) const { painty + painth + st::mediaCaptionSkip), .availableWidth = captionw, .palette = &stm->textPalette, - .pre = stm->preBlockCache.get(), - .blockquote = stm->blockquoteBlockCache.get(), + .pre = stm->preCache.get(), + .blockquote = stm->blockquoteCache.get(), .colors = context.st->highlightColors(), .spoiler = Ui::Text::DefaultSpoilerCache(), .now = context.now, diff --git a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp index 8debdff7e..52008c66f 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_gif.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_gif.cpp @@ -709,8 +709,8 @@ void Gif::draw(Painter &p, const PaintContext &context) const { .position = QPoint(st::msgPadding.left(), top), .availableWidth = captionw, .palette = &stm->textPalette, - .pre = stm->preBlockCache.get(), - .blockquote = stm->blockquoteBlockCache.get(), + .pre = stm->preCache.get(), + .blockquote = stm->blockquoteCache.get(), .colors = context.st->highlightColors(), .spoiler = Ui::Text::DefaultSpoilerCache(), .now = context.now, diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp index 38708df44..2333e334d 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media_grouped.cpp @@ -367,8 +367,8 @@ void GroupedMedia::draw(Painter &p, const PaintContext &context) const { captiony), .availableWidth = captionw, .palette = &stm->textPalette, - .pre = stm->preBlockCache.get(), - .blockquote = stm->blockquoteBlockCache.get(), + .pre = stm->preCache.get(), + .blockquote = stm->blockquoteCache.get(), .colors = context.st->highlightColors(), .spoiler = Ui::Text::DefaultSpoilerCache(), .now = context.now, diff --git a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp index 25c61b890..8e0763e39 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp @@ -405,8 +405,8 @@ void Photo::draw(Painter &p, const PaintContext &context) const { .position = QPoint(st::msgPadding.left(), top), .availableWidth = captionw, .palette = &stm->textPalette, - .pre = stm->preBlockCache.get(), - .blockquote = stm->blockquoteBlockCache.get(), + .pre = stm->preCache.get(), + .blockquote = stm->blockquoteCache.get(), .colors = context.st->highlightColors(), .spoiler = Ui::Text::DefaultSpoilerCache(), .now = context.now, diff --git a/Telegram/SourceFiles/settings/settings_scale_preview.cpp b/Telegram/SourceFiles/settings/settings_scale_preview.cpp index c3cd775a1..6da0a861e 100644 --- a/Telegram/SourceFiles/settings/settings_scale_preview.cpp +++ b/Telegram/SourceFiles/settings/settings_scale_preview.cpp @@ -78,8 +78,8 @@ private: [[nodiscard]] style::font scaled( const style::font &value, int size) const; - [[nodiscard]] style::ParagraphStyle scaled( - const style::ParagraphStyle &value) const; + [[nodiscard]] style::QuoteStyle scaled( + const style::QuoteStyle &value) const; [[nodiscard]] style::TextStyle scaled( const style::TextStyle &value, int fontSize) const; @@ -327,8 +327,7 @@ style::font Preview::scaled(const style::font &font, int size) const { return style::font(scaled(size), font->flags(), font->family()); } -style::ParagraphStyle Preview::scaled( - const style::ParagraphStyle &value) const { +style::QuoteStyle Preview::scaled(const style::QuoteStyle &value) const { return { .padding = scaled(value.padding), .verticalSkip = scaled(value.verticalSkip), diff --git a/Telegram/SourceFiles/ui/chat/chat.style b/Telegram/SourceFiles/ui/chat/chat.style index 16be12f27..5c126895d 100644 --- a/Telegram/SourceFiles/ui/chat/chat.style +++ b/Telegram/SourceFiles/ui/chat/chat.style @@ -40,19 +40,19 @@ msgDateDelta: point(2px, 5px); msgDateImgDelta: 4px; msgDateImgPadding: point(8px, 2px); -messageParagraphStyle: ParagraphStyle(defaultParagraphStyle) { +messageQuoteStyle: QuoteStyle(defaultQuoteStyle) { padding: margins(10px, 2px, 4px, 2px); verticalSkip: 4px; outline: 3px; radius: 5px; } messageTextStyle: TextStyle(defaultTextStyle) { - blockquote: ParagraphStyle(messageParagraphStyle) { + blockquote: QuoteStyle(messageQuoteStyle) { padding: margins(10px, 2px, 20px, 2px); icon: icon{{ "chat/mini_quote", windowFg }}; iconPosition: point(4px, 2px); } - pre: ParagraphStyle(messageParagraphStyle) { + pre: QuoteStyle(messageQuoteStyle) { header: 20px; headerPosition: point(10px, 2px); scrollable: true; diff --git a/Telegram/SourceFiles/ui/chat/chat_style.cpp b/Telegram/SourceFiles/ui/chat/chat_style.cpp index c5d3bafdb..a2604b247 100644 --- a/Telegram/SourceFiles/ui/chat/chat_style.cpp +++ b/Telegram/SourceFiles/ui/chat/chat_style.cpp @@ -30,12 +30,12 @@ void EnsureCorners( } void EnsureBlockquoteCache( - std::unique_ptr &cache, + std::unique_ptr &cache, const style::color &color) { if (cache) { return; } - cache = std::make_unique(); + cache = std::make_unique(); cache->bg = color->c; cache->bg.setAlphaF(0.12); cache->outline = color->c; @@ -44,13 +44,13 @@ void EnsureBlockquoteCache( } void EnsurePreCache( - std::unique_ptr &cache, + std::unique_ptr &cache, const style::color &color, Fn()> bgOverride) { if (cache) { return; } - cache = std::make_unique(); + cache = std::make_unique(); const auto bg = bgOverride(); cache->bg = bg.value_or(color->c); if (!bg) { @@ -521,8 +521,8 @@ void ChatStyle::assignPalette(not_null palette) { for (auto &style : _messageStyles) { style.msgBgCornersSmall = {}; style.msgBgCornersLarge = {}; - style.blockquoteBlockCache = nullptr; - style.preBlockCache = nullptr; + style.blockquoteCache = nullptr; + style.preCache = nullptr; } for (auto &style : _imageStyles) { style.msgDateImgBgCorners = {}; @@ -578,7 +578,7 @@ const MessageStyle &ChatStyle::messageStyle(bool outbg, bool selected) const { result.msgBg, &result.msgShadow); EnsureBlockquoteCache( - result.blockquoteBlockCache, + result.blockquoteCache, result.msgReplyBarColor); const auto preBgOverride = [&] { @@ -589,7 +589,7 @@ const MessageStyle &ChatStyle::messageStyle(bool outbg, bool selected) const { return dark ? QColor(0, 0, 0, 192) : std::optional(); }; EnsurePreCache( - result.preBlockCache, + result.preCache, (selected ? result.textPalette.selectMonoFg : result.textPalette.monoFg), diff --git a/Telegram/SourceFiles/ui/chat/chat_style.h b/Telegram/SourceFiles/ui/chat/chat_style.h index 3d20e7961..dda612b66 100644 --- a/Telegram/SourceFiles/ui/chat/chat_style.h +++ b/Telegram/SourceFiles/ui/chat/chat_style.h @@ -76,8 +76,8 @@ struct MessageStyle { style::icon historyPollChoiceRight = { Qt::Uninitialized }; style::icon historyTranscribeIcon = { Qt::Uninitialized }; style::icon historyTranscribeHide = { Qt::Uninitialized }; - std::unique_ptr blockquoteBlockCache; - std::unique_ptr preBlockCache; + std::unique_ptr blockquoteCache; + std::unique_ptr preCache; }; diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 46465fc5c..9eb9fcf04 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 46465fc5ce14c4ca356870f0a8d51eb0285112a9 +Subproject commit 9eb9fcf043276bb3a73f1fc25531e4f4862d6fc9