diff --git a/apps/probability/calculation_cell.cpp b/apps/probability/calculation_cell.cpp index 71b7f8f03..8c3d3f638 100644 --- a/apps/probability/calculation_cell.cpp +++ b/apps/probability/calculation_cell.cpp @@ -30,14 +30,14 @@ void CalculationCell::setHighlighted(bool highlight) { KDSize CalculationCell::minimalSizeForOptimalDisplay() const { KDSize textSize = m_text.minimalSizeForOptimalDisplay(); - return KDSize(2*k_margin+textSize.width()+calculationCellWidth()+ResponderImageCell::k_outline, KDText::charSize().height()); + return KDSize(2*k_margin+textSize.width()+calculationCellWidth()+2*ResponderImageCell::k_outline, KDText::charSize().height()); } void CalculationCell::drawRect(KDContext * ctx, KDRect rect) const { ctx->fillRect(bounds(), KDColorWhite); if (m_isResponder) { KDSize textSize = m_text.minimalSizeForOptimalDisplay(); - ctx->strokeRect(KDRect(2*k_margin+textSize.width()-ResponderImageCell::k_outline, ResponderImageCell::k_margin, calculationCellWidth()+2*ResponderImageCell::k_outline, ImageCell::k_height+2*ResponderImageCell::k_outline), Palette::GreyMiddle); + ctx->strokeRect(KDRect(2*k_margin+textSize.width(), 0, calculationCellWidth()+2*ResponderImageCell::k_outline, ImageCell::k_height+2*ResponderImageCell::k_outline), Palette::GreyMiddle); } } @@ -64,7 +64,7 @@ View * CalculationCell::subviewAtIndex(int index) { void CalculationCell::layoutSubviews() { KDSize textSize = m_text.minimalSizeForOptimalDisplay(); m_text.setFrame(KDRect(k_margin, 0, textSize.width(), bounds().height())); - m_calculation.setFrame(KDRect(2*k_margin+textSize.width(), ResponderImageCell::k_totalMargin, calculationCellWidth(), ImageCell::k_height)); + m_calculation.setFrame(KDRect(2*k_margin+textSize.width()+ResponderImageCell::k_outline, ResponderImageCell::k_outline, calculationCellWidth(), ImageCell::k_height)); } KDCoordinate CalculationCell::calculationCellWidth() const { diff --git a/apps/probability/calculation_cell.h b/apps/probability/calculation_cell.h index 37343380f..fbb8e00bc 100644 --- a/apps/probability/calculation_cell.h +++ b/apps/probability/calculation_cell.h @@ -17,8 +17,8 @@ public: MessageTextView * messageTextView(); private: constexpr static KDCoordinate k_margin = 5; - constexpr static KDCoordinate k_minTextFieldWidth = 4*KDText::charSize().width(); - constexpr static KDCoordinate k_maxTextFieldWidth = 10*KDText::charSize().width(); + constexpr static KDCoordinate k_minTextFieldWidth = 4*KDText::charSize().width()+TextCursorView::k_width; + constexpr static KDCoordinate k_maxTextFieldWidth = 14*KDText::charSize().width()+TextCursorView::k_width; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; void layoutSubviews() override; diff --git a/escher/include/escher/text_cursor_view.h b/escher/include/escher/text_cursor_view.h index 2ae5605b5..a950c0ec4 100644 --- a/escher/include/escher/text_cursor_view.h +++ b/escher/include/escher/text_cursor_view.h @@ -8,6 +8,7 @@ public: using View::View; void drawRect(KDContext * ctx, KDRect rect) const override; KDSize minimalSizeForOptimalDisplay() const override; + constexpr static KDCoordinate k_width = 1; }; #endif diff --git a/escher/src/text_cursor_view.cpp b/escher/src/text_cursor_view.cpp index ba136c17d..6ef9a6ebe 100644 --- a/escher/src/text_cursor_view.cpp +++ b/escher/src/text_cursor_view.cpp @@ -6,6 +6,6 @@ void TextCursorView::drawRect(KDContext * ctx, KDRect rect) const { } KDSize TextCursorView::minimalSizeForOptimalDisplay() const { - return KDSize(1, 0); + return KDSize(k_width, 0); }