From 169913b80008dbba99bc7f3779a82a5e701274c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Wed, 17 Jan 2018 14:13:51 +0100 Subject: [PATCH] [apps/calculation] Fix background redraw bug. The margins around the textfield did not redraw themselves properly after dismissing a toolbox for instance. The textfield now takes the full height of edition zone. Change-Id: I0794b8273a880a2dc921c5f492eb0f41aef7fe97 --- apps/calculation/edit_expression_controller.cpp | 8 ++++---- apps/calculation/edit_expression_controller.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/calculation/edit_expression_controller.cpp b/apps/calculation/edit_expression_controller.cpp index 2a3a9ee27..d1fefa9af 100644 --- a/apps/calculation/edit_expression_controller.cpp +++ b/apps/calculation/edit_expression_controller.cpp @@ -39,7 +39,7 @@ void EditExpressionController::ContentView::layoutSubviews() { KDRect mainViewFrame(0, 0, bounds().width(), bounds().height() - inputViewFrameHeight-k_separatorThickness); m_mainView->setFrame(mainViewFrame); if (editionIsInTextField()) { - KDRect inputViewFrame(k_leftMargin, bounds().height() - inputViewFrameHeight + k_verticalMargin, bounds().width()-k_leftMargin, k_textFieldHeight - k_verticalMargin); + KDRect inputViewFrame(k_leftMargin, bounds().height() - inputViewFrameHeight, bounds().width()-k_leftMargin, k_textFieldHeight); m_textField.setFrame(inputViewFrame); m_editableExpressionView.setFrame(KDRectZero); return; @@ -62,7 +62,7 @@ void EditExpressionController::ContentView::drawRect(KDContext * ctx, KDRect rec ctx->fillRect(KDRect(0, bounds().height() -inputViewFrameHeight, k_leftMargin, inputViewFrameHeight), m_textField.backgroundColor()); if (!editionIsInTextField()) { // Color the upper margin - ctx->fillRect(KDRect(0, bounds().height() -inputViewFrameHeight, bounds().width(), k_verticalMargin), m_textField.backgroundColor()); + ctx->fillRect(KDRect(0, bounds().height() -inputViewFrameHeight, bounds().width(), k_verticalEditableExpressionViewMargin), m_textField.backgroundColor()); } } @@ -71,11 +71,11 @@ bool EditExpressionController::ContentView::editionIsInTextField() const { } KDCoordinate EditExpressionController::ContentView::inputViewHeight() const { - return k_verticalMargin + (editionIsInTextField() ? k_textFieldHeight : editableExpressionViewHeight()); + return editionIsInTextField() ? k_textFieldHeight : k_verticalEditableExpressionViewMargin + editableExpressionViewHeight(); } KDCoordinate EditExpressionController::ContentView::editableExpressionViewHeight() const { - return KDCoordinate(min(0.6*Ion::Display::Height, max(k_textFieldHeight, m_editableExpressionView.minimalSizeForOptimalDisplay().height()+k_verticalMargin))); + return KDCoordinate(min(0.6*Ion::Display::Height, max(k_textFieldHeight, m_editableExpressionView.minimalSizeForOptimalDisplay().height()+k_verticalEditableExpressionViewMargin))); } EditExpressionController::EditExpressionController(Responder * parentResponder, HistoryController * historyController, CalculationStore * calculationStore) : diff --git a/apps/calculation/edit_expression_controller.h b/apps/calculation/edit_expression_controller.h index 54d0512da..9c3d3d4aa 100644 --- a/apps/calculation/edit_expression_controller.h +++ b/apps/calculation/edit_expression_controller.h @@ -48,9 +48,9 @@ private: bool editionIsInTextField() const; static constexpr int k_bufferLength = TextField::maxBufferSize(); private: - static constexpr KDCoordinate k_textFieldHeight = 32; + static constexpr KDCoordinate k_textFieldHeight = 37; static constexpr KDCoordinate k_leftMargin = 5; - static constexpr KDCoordinate k_verticalMargin = 5; + static constexpr KDCoordinate k_verticalEditableExpressionViewMargin = 5; constexpr static int k_separatorThickness = 1; KDCoordinate inputViewHeight() const; KDCoordinate editableExpressionViewHeight() const;