diff --git a/apps/probability/calculation_controller.cpp b/apps/probability/calculation_controller.cpp index 385a645c8..ea4a6e5d0 100644 --- a/apps/probability/calculation_controller.cpp +++ b/apps/probability/calculation_controller.cpp @@ -47,7 +47,7 @@ View * CalculationController::ContentView::subviewAtIndex(int index) { void CalculationController::ContentView::layoutSubviews() { KDCoordinate titleHeight = KDText::charSize(KDText::FontSize::Small).height()+k_titleHeightMargin; m_titleView.setFrame(KDRect(0, 0, bounds().width(), titleHeight)); - KDCoordinate calculationHeight = ResponderImageCell::k_oneCellHeight; + KDCoordinate calculationHeight = ResponderImageCell::k_oneCellHeight+2*k_tableMargin; m_selectableTableView->setFrame(KDRect(0, titleHeight, bounds().width(), calculationHeight)); m_lawCurveView.setFrame(KDRect(0, titleHeight+calculationHeight, bounds().width(), bounds().height() - calculationHeight - titleHeight)); } @@ -55,7 +55,7 @@ void CalculationController::ContentView::layoutSubviews() { CalculationController::CalculationController(Responder * parentResponder, Law * law, Calculation * calculation) : ViewController(parentResponder), m_contentView(&m_selectableTableView, law, calculation), - m_selectableTableView(this, this, 0, 0, 0, 0, 0, 0, this, nullptr, false, true, KDColorWhite), + m_selectableTableView(this, this, 0, 0, k_tableMargin, k_tableMargin, k_tableMargin, k_tableMargin, this, nullptr, false, true, KDColorWhite), m_imageCell(&m_selectableTableView, law, calculation, this), m_draftTextBuffer{}, m_calculation(calculation), diff --git a/apps/probability/calculation_controller.h b/apps/probability/calculation_controller.h index a4d785847..4a92d3613 100644 --- a/apps/probability/calculation_controller.h +++ b/apps/probability/calculation_controller.h @@ -49,6 +49,7 @@ public: void setCalculationAccordingToIndex(int index, bool forceReinitialisation = false); private: constexpr static int k_numberOfCalculationCells = 3; + constexpr static KDCoordinate k_tableMargin = 3; Shared::TextFieldDelegateApp * textFieldDelegateApp() override; void updateTitle(); class ContentView : public View { diff --git a/apps/probability/responder_image_cell.cpp b/apps/probability/responder_image_cell.cpp index 5d84e50a0..a69274ee6 100644 --- a/apps/probability/responder_image_cell.cpp +++ b/apps/probability/responder_image_cell.cpp @@ -12,16 +12,16 @@ ResponderImageCell::ResponderImageCell(Responder * parentResponder, Law * law, C void ResponderImageCell::drawRect(KDContext * ctx, KDRect rect) const { ctx->fillRect(bounds(), KDColorWhite); - ctx->strokeRect(KDRect(k_margin, k_margin, ImageCell::k_width+2*k_outline, ImageCell::k_height+2*k_outline), Palette::GreyMiddle); + ctx->strokeRect(KDRect(0, 0, ImageCell::k_width+2*k_outline, ImageCell::k_height+2*k_outline), Palette::GreyMiddle); } KDSize ResponderImageCell::minimalSizeForOptimalDisplay() const { - return KDSize(2*k_totalMargin+ImageCell::k_width, 2*k_totalMargin*ImageCell::k_height); + return KDSize(2*k_outline+ImageCell::k_width, 2*k_outline*ImageCell::k_height); } bool ResponderImageCell::handleEvent(Ion::Events::Event event) { if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Down) { - KDPoint topLeftAngle = app()->modalView()->pointFromPointInView(this, KDPoint(k_totalMargin, k_totalMargin)); + KDPoint topLeftAngle = app()->modalView()->pointFromPointInView(this, KDPoint(k_outline, k_outline)); app()->displayModalViewController(&m_calculationTypeController, 0.0f, 0.0f, topLeftAngle.y(), topLeftAngle.x()); return true; } @@ -47,7 +47,7 @@ View * ResponderImageCell::subviewAtIndex(int index) { } void ResponderImageCell::layoutSubviews() { - m_imageCell.setFrame(KDRect(k_totalMargin, k_totalMargin, bounds().width()-2*k_totalMargin, bounds().height()-2*k_totalMargin)); + m_imageCell.setFrame(KDRect(k_outline, k_outline, bounds().width()-2*k_outline, bounds().height()-2*k_outline)); } } diff --git a/apps/probability/responder_image_cell.h b/apps/probability/responder_image_cell.h index 0d59ea6eb..40ca8bdbd 100644 --- a/apps/probability/responder_image_cell.h +++ b/apps/probability/responder_image_cell.h @@ -20,10 +20,8 @@ public: void setHighlighted(bool highlight) override; void setImage(const Image * image, const Image * focusedImage); constexpr static KDCoordinate k_outline = 1; - constexpr static KDCoordinate k_margin = 3; - constexpr static KDCoordinate k_totalMargin = k_outline+k_margin; - constexpr static KDCoordinate k_oneCellWidth = 2*k_totalMargin+ImageCell::k_width; - constexpr static KDCoordinate k_oneCellHeight = 2*k_totalMargin+ImageCell::k_height; + constexpr static KDCoordinate k_oneCellWidth = 2*k_outline+ImageCell::k_width; + constexpr static KDCoordinate k_oneCellHeight = 2*k_outline+ImageCell::k_height; private: int numberOfSubviews() const override; View * subviewAtIndex(int index) override;