From 39f494eaddef588d47072d64a5b205a3498bb626 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 24 Jul 2023 17:14:15 +0300 Subject: [PATCH] Removed display of right buttons in message field while editing message. --- .../SourceFiles/history/history_widget.cpp | 34 +++++++++++++------ .../view/controls/history_view_ttl_button.cpp | 8 +++++ .../view/controls/history_view_ttl_button.h | 2 ++ 3 files changed, 34 insertions(+), 10 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 25abe7428..321c1227c 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -2852,10 +2852,10 @@ void HistoryWidget::updateControlsVisibility() { _silent->setVisible(!_editMsgId); } if (_scheduled) { - _scheduled->show(); + _scheduled->setVisible(!_editMsgId); } if (_ttlInfo) { - _ttlInfo->show(); + _ttlInfo->setVisible(!_editMsgId); } if (_sendAs) { _sendAs->show(); @@ -5010,19 +5010,33 @@ void HistoryWidget::moveFieldControls() { } void HistoryWidget::updateFieldSize() { - auto kbShowShown = _history && !_kbShown && _keyboard->hasMarkup(); + const auto kbShowShown = _history && !_kbShown && _keyboard->hasMarkup(); auto fieldWidth = width() - _attachToggle->width() - st::historySendRight - _send->width() - _tabbedSelectorToggle->width(); - if (_botMenuButton) fieldWidth -= st::historyBotMenuSkip + _botMenuButton->width(); - if (_sendAs) fieldWidth -= _sendAs->width(); - if (kbShowShown) fieldWidth -= _botKeyboardShow->width(); - if (_cmdStartShown) fieldWidth -= _botCommandStart->width(); - if (_silent && !_silent->isHidden()) fieldWidth -= _silent->width(); - if (_scheduled) fieldWidth -= _scheduled->width(); - if (_ttlInfo) fieldWidth -= _ttlInfo->width(); + if (_botMenuButton) { + fieldWidth -= st::historyBotMenuSkip + _botMenuButton->width(); + } + if (_sendAs) { + fieldWidth -= _sendAs->width(); + } + if (kbShowShown) { + fieldWidth -= _botKeyboardShow->width(); + } + if (_cmdStartShown) { + fieldWidth -= _botCommandStart->width(); + } + if (_silent && _silent->isVisible()) { + fieldWidth -= _silent->width(); + } + if (_scheduled && _scheduled->isVisible()) { + fieldWidth -= _scheduled->width(); + } + if (_ttlInfo && _ttlInfo->isVisible()) { + fieldWidth -= _ttlInfo->width(); + } if (_fieldDisabled) { _fieldDisabled->resize(fieldWidth, fieldHeight()); diff --git a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp index 945253ec6..f7e15f5e5 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.cpp @@ -50,6 +50,14 @@ void TTLButton::hide() { _button.hide(); } +void TTLButton::setVisible(bool visible) { + _button.setVisible(visible); +} + +bool TTLButton::isVisible() const { + return _button.isVisible(); +} + void TTLButton::move(int x, int y) { _button.move(x, y); } diff --git a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.h b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.h index dbdc50a9f..16098aa6e 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.h +++ b/Telegram/SourceFiles/history/view/controls/history_view_ttl_button.h @@ -28,6 +28,8 @@ public: void show(); void hide(); + void setVisible(bool visible); + [[nodiscard]] bool isVisible() const; void move(int x, int y); [[nodiscard]] int width() const;