diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 04827a885..66149efe6 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2531,4 +2531,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "ktg_message_id" = "Message ID: {id}"; "ktg_emoji_panel_hover" = "Emoji panel on hover"; +"ktg_settings_monospace_large_bubbles" = "Expand bubbles with monospace"; + // Keys finished diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 3589304b6..c1b97b0ad 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -546,6 +546,20 @@ HistoryWidget::HistoryWidget( }); }, lifetime()); + MonospaceLargeBubblesChanges( + ) | rpl::start_with_next([=] { + crl::on_main(this, [=] { + if (_history) { + _history->forceFullResize(); + if (_migrated) { + _migrated->forceFullResize(); + } + updateHistoryGeometry(); + update(); + } + }); + }, lifetime()); + HoverEmojiPanelChanges( ) | rpl::start_with_next([=] { crl::on_main(this, [=] { diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index e960a2c80..61478127f 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -1814,7 +1814,9 @@ QRect Message::countGeometry() const { } accumulate_min(contentWidth, maxWidth()); if (!AdaptiveBubbles()) { - accumulate_min(contentWidth, _bubbleWidthLimit); + if (MonospaceLargeBubbles()) { + accumulate_min(contentWidth, _bubbleWidthLimit); + } } if (mediaWidth < contentWidth) { const auto textualWidth = plainMaxWidth(); @@ -1859,7 +1861,9 @@ int Message::resizeContentGetHeight(int newWidth) { accumulate_min(contentWidth, maxWidth()); _bubbleWidthLimit = std::max(st::msgMaxWidth, monospaceMaxWidth()); if (!AdaptiveBubbles()) { - accumulate_min(contentWidth, _bubbleWidthLimit); + if (MonospaceLargeBubbles()) { + accumulate_min(contentWidth, _bubbleWidthLimit); + } } if (mediaDisplayed) { media->resizeGetHeight(contentWidth); diff --git a/Telegram/SourceFiles/kotato/json_settings.cpp b/Telegram/SourceFiles/kotato/json_settings.cpp index a7cf93995..42d410516 100644 --- a/Telegram/SourceFiles/kotato/json_settings.cpp +++ b/Telegram/SourceFiles/kotato/json_settings.cpp @@ -194,6 +194,7 @@ QByteArray GenerateSettingsJson(bool areDefault = false) { settings.insert(qsl("custom_app_icon"), cCustomAppIcon()); settings.insert(qsl("profile_top_mute"), cProfileTopBarNotifications()); settings.insert(qsl("hover_emoji_panel"), HoverEmojiPanel()); + settings.insert(qsl("monospace_large_bubbles"), MonospaceLargeBubbles()); settingsFonts.insert(qsl("use_system_font"), cUseSystemFont()); settingsFonts.insert(qsl("use_original_metrics"), cUseOriginalMetrics()); @@ -314,6 +315,16 @@ bool Manager::readCustomFile() { }); } + auto isMonospaceLargeBubblesSet = ReadBoolOption(settings, "monospace_large_bubbles", [&](auto v) { + SetMonospaceLargeBubbles(v); + }); + + if (!isMonospaceLargeBubblesSet) { + ReadBoolOption(settings, "monospace_large_bubbles", [&](auto v) { + SetMonospaceLargeBubbles(v); + }); + } + ReadBoolOption(settings, "big_emoji_outline", [&](auto v) { SetBigEmojiOutline(v); }); diff --git a/Telegram/SourceFiles/kotato/settings.cpp b/Telegram/SourceFiles/kotato/settings.cpp index ee863333c..fd54eafdc 100644 --- a/Telegram/SourceFiles/kotato/settings.cpp +++ b/Telegram/SourceFiles/kotato/settings.cpp @@ -64,6 +64,17 @@ rpl::producer AdaptiveBubblesChanges() { return gAdaptiveBubbles.changes(); } +rpl::variable gMonospaceLargeBubbles = false; +void SetMonospaceLargeBubbles(bool enabled) { + gMonospaceLargeBubbles = enabled; +} +bool MonospaceLargeBubbles() { + return gMonospaceLargeBubbles.current(); +} +rpl::producer MonospaceLargeBubblesChanges() { + return gMonospaceLargeBubbles.changes(); +} + bool gAlwaysShowScheduled = false; int gShowChatId = 0; diff --git a/Telegram/SourceFiles/kotato/settings.h b/Telegram/SourceFiles/kotato/settings.h index 9dce75c70..0011b8156 100644 --- a/Telegram/SourceFiles/kotato/settings.h +++ b/Telegram/SourceFiles/kotato/settings.h @@ -47,6 +47,10 @@ void SetAdaptiveBubbles(bool enabled); [[nodiscard]] bool AdaptiveBubbles(); [[nodiscard]] rpl::producer AdaptiveBubblesChanges(); +void SetMonospaceLargeBubbles(bool enabled); +[[nodiscard]] bool MonospaceLargeBubbles(); +[[nodiscard]] rpl::producer MonospaceLargeBubblesChanges(); + DeclareSetting(bool, AlwaysShowScheduled); DeclareSetting(int, ShowChatId); diff --git a/Telegram/SourceFiles/kotato/settings_menu.cpp b/Telegram/SourceFiles/kotato/settings_menu.cpp index 0f7fc4835..c70b29d8b 100644 --- a/Telegram/SourceFiles/kotato/settings_menu.cpp +++ b/Telegram/SourceFiles/kotato/settings_menu.cpp @@ -313,6 +313,7 @@ void SetupKotatoMessages(not_null container) { AddSkip(container); SettingsMenuSwitch(ktg_settings_adaptive_bubbles, AdaptiveBubbles); + SettingsMenuSwitch(ktg_settings_monospace_large_bubbles, MonospaceLargeBubbles); SettingsMenuSwitch(ktg_settings_emoji_outline, BigEmojiOutline); AddSkip(container);