diff --git a/apps/graph/graph/banner_view.cpp b/apps/graph/graph/banner_view.cpp index a6390ff28..fa900c652 100644 --- a/apps/graph/graph/banner_view.cpp +++ b/apps/graph/graph/banner_view.cpp @@ -10,10 +10,10 @@ BannerView::BannerView( TextFieldDelegate * textFieldDelegate ) : Shared::XYBannerView(parentResponder, inputEventHandlerDelegate, textFieldDelegate), - m_derivativeView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle), - m_tangentEquationView(KDFont::SmallFont, I18n::Message::LinearRegressionFormula, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle), - m_aView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle), - m_bView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle), + m_derivativeView(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()), + m_tangentEquationView(Font(), I18n::Message::LinearRegressionFormula, 0.0f, 0.5f, TextColor(), BackgroundColor()), + m_aView(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()), + m_bView(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()), m_numberOfSubviews(Shared::XYBannerView::k_numberOfSubviews) { } diff --git a/apps/graph/graph/calculation_graph_controller.cpp b/apps/graph/graph/calculation_graph_controller.cpp index 77bb2c740..847bbc8b9 100644 --- a/apps/graph/graph/calculation_graph_controller.cpp +++ b/apps/graph/graph/calculation_graph_controller.cpp @@ -12,7 +12,7 @@ CalculationGraphController::CalculationGraphController(Responder * parentRespond m_bannerView(bannerView), m_graphRange(curveViewRange), m_record(), - m_defaultBannerView(KDFont::SmallFont, defaultMessage, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle), + m_defaultBannerView(BannerView::Font(), defaultMessage, 0.5f, 0.5f, BannerView::TextColor(), BannerView::BackgroundColor()), m_isActive(false) { } diff --git a/apps/regression/banner_view.cpp b/apps/regression/banner_view.cpp index e1f1135c8..640e782f5 100644 --- a/apps/regression/banner_view.cpp +++ b/apps/regression/banner_view.cpp @@ -3,22 +3,19 @@ namespace Regression { -constexpr KDColor BannerView::k_textColor; -constexpr KDColor BannerView::k_backgroundColor; - BannerView::BannerView( Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * textFieldDelegate ) : Shared::XYBannerView(parentResponder, inputEventHandlerDelegate, textFieldDelegate), - m_dotNameView(k_font, 0.0f, 0.5f, k_textColor, k_backgroundColor), - m_regressionTypeView(k_font, (I18n::Message)0, 0.0f, 0.5f, k_textColor,k_backgroundColor), - m_subText0(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor), - m_subText1(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor), - m_subText2(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor), - m_subText3(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor), - m_subText4(k_font, 0.5f, 0.5f, k_textColor, k_backgroundColor) + m_dotNameView(Font(), 0.0f, 0.5f, TextColor(), BackgroundColor()), + m_regressionTypeView(Font(), (I18n::Message)0, 0.0f, 0.5f, TextColor(), BackgroundColor()), + m_subText0(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()), + m_subText1(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()), + m_subText2(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()), + m_subText3(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()), + m_subText4(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()) { } diff --git a/apps/regression/banner_view.h b/apps/regression/banner_view.h index b6cf1292d..f539215ea 100644 --- a/apps/regression/banner_view.h +++ b/apps/regression/banner_view.h @@ -16,11 +16,7 @@ public: MessageTextView * regressionTypeView() { return &m_regressionTypeView; } BufferTextView * subTextAtIndex(int index); static constexpr int numberOfsubTexts() { return 5; } - const KDFont * font() const { return k_font; } private: - static constexpr const KDFont * k_font = KDFont::SmallFont; - static constexpr KDColor k_textColor = KDColorBlack; - static constexpr KDColor k_backgroundColor = Palette::GreyMiddle; static constexpr int k_numberOfSubviews = Shared::XYBannerView::k_numberOfSubviews + 7; int numberOfSubviews() const override { return k_numberOfSubviews; } View * subviewAtIndex(int index) override; diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index 46d6b5e1d..c785cbe36 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -175,7 +175,7 @@ void GraphController::reloadBannerView() { } if (!coefficientsAreDefined) { // Force the "Data not suitable" message to be on the next line - int numberOfCharToCompleteLine = maxInt(Ion::Display::Width/(m_bannerView.font()->glyphSize().width())- strlen(I18n::translate(formula)), 0); + int numberOfCharToCompleteLine = maxInt(Ion::Display::Width / BannerView::Font()->glyphSize().width() - strlen(I18n::translate(formula)), 0); numberOfChar = 0; for (int i = 0; i < numberOfCharToCompleteLine-1; i++) { buffer[numberOfChar++] = ' '; diff --git a/apps/shared/banner_view.cpp b/apps/shared/banner_view.cpp index 3ca4e8dd8..b99389d9d 100644 --- a/apps/shared/banner_view.cpp +++ b/apps/shared/banner_view.cpp @@ -4,15 +4,15 @@ namespace Shared { KDCoordinate BannerView::HeightGivenNumberOfLines(int linesCount) { - return LineSpacing + (KDFont::SmallFont->glyphSize().height() + LineSpacing) * linesCount; + return LineSpacing + (Font()->glyphSize().height() + LineSpacing) * linesCount; } void BannerView::drawRect(KDContext * ctx, KDRect rect) const { const KDCoordinate frameHeight = minimalSizeForOptimalDisplay().height(); - const KDCoordinate lineHeight = KDFont::SmallFont->glyphSize().height() + LineSpacing; + const KDCoordinate lineHeight = Font()->glyphSize().height() + LineSpacing; const KDCoordinate lineWidth = m_frame.width(); for (KDCoordinate y = 0; y < frameHeight; y += lineHeight) { - ctx->fillRect(KDRect(0, y, lineWidth, LineSpacing), Palette::GreyMiddle); + ctx->fillRect(KDRect(0, y, lineWidth, LineSpacing), BackgroundColor()); } } diff --git a/apps/shared/banner_view.h b/apps/shared/banner_view.h index eb33b6563..4bcf14f94 100644 --- a/apps/shared/banner_view.h +++ b/apps/shared/banner_view.h @@ -11,6 +11,9 @@ public: void drawRect(KDContext * ctx, KDRect rect) const override; KDSize minimalSizeForOptimalDisplay() const override; void reload() { layoutSubviews(); } + static constexpr const KDFont * Font() { return KDFont::SmallFont; } + static constexpr KDColor TextColor() { return KDColorBlack; } + static constexpr KDColor BackgroundColor() { return Palette::GreyMiddle; } private: static constexpr KDCoordinate LineSpacing = 2; int numberOfSubviews() const override = 0; diff --git a/apps/shared/xy_banner_view.cpp b/apps/shared/xy_banner_view.cpp index 39719f57d..02691fc3f 100644 --- a/apps/shared/xy_banner_view.cpp +++ b/apps/shared/xy_banner_view.cpp @@ -8,8 +8,8 @@ XYBannerView::XYBannerView( InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * textFieldDelegate ) : - m_abscissaView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle), - m_ordinateView(KDFont::SmallFont, 0.5f, 0.5f, KDColorBlack, Palette::GreyMiddle) + m_abscissaView(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()), + m_ordinateView(Font(), 0.5f, 0.5f, TextColor(), BackgroundColor()) { } diff --git a/apps/statistics/box_banner_view.cpp b/apps/statistics/box_banner_view.cpp index 0dc664892..ea09d22da 100644 --- a/apps/statistics/box_banner_view.cpp +++ b/apps/statistics/box_banner_view.cpp @@ -4,9 +4,9 @@ namespace Statistics { BoxBannerView::BoxBannerView() : - m_seriesName(KDFont::SmallFont, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle), - m_calculationName(KDFont::SmallFont, I18n::Message::Minimum, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle), - m_calculationValue(KDFont::SmallFont, 1.0f, 0.5f, KDColorBlack, Palette::GreyMiddle) + m_seriesName(Font(), 0.0f, 0.5f, TextColor(), BackgroundColor()), + m_calculationName(Font(), I18n::Message::Minimum, 0.0f, 0.5f, TextColor(), BackgroundColor()), + m_calculationValue(Font(), 1.0f, 0.5f, TextColor(), BackgroundColor()) { } diff --git a/apps/statistics/histogram_banner_view.cpp b/apps/statistics/histogram_banner_view.cpp index 6609d8e09..f4575c6f2 100644 --- a/apps/statistics/histogram_banner_view.cpp +++ b/apps/statistics/histogram_banner_view.cpp @@ -5,12 +5,12 @@ namespace Statistics { HistogramBannerView::HistogramBannerView() : - m_intervalLegendView(KDFont::SmallFont, I18n::Message::Interval, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle), - m_intervalView(KDFont::SmallFont, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle), - m_sizeLegendView(KDFont::SmallFont, I18n::Message::Size, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle), - m_sizeView(KDFont::SmallFont, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle), - m_frequencyLegendView(KDFont::SmallFont, I18n::Message::Frequency, 1.0f, 0.5f, KDColorBlack, Palette::GreyMiddle), - m_frequencyView(KDFont::SmallFont, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle) + m_intervalLegendView(Font(), I18n::Message::Interval, 0.0f, 0.5f, TextColor(), BackgroundColor()), + m_intervalView(Font(), 0.0f, 0.5f, TextColor(), BackgroundColor()), + m_sizeLegendView(Font(), I18n::Message::Size, 0.0f, 0.5f, TextColor(), BackgroundColor()), + m_sizeView(Font(), 0.0f, 0.5f, TextColor(), BackgroundColor()), + m_frequencyLegendView(Font(), I18n::Message::Frequency, 1.0f, 0.5f, TextColor(), BackgroundColor()), + m_frequencyView(Font(), 0.0f, 0.5f, TextColor(), BackgroundColor()) { }