diff --git a/apps/apps_container.h b/apps/apps_container.h index f52d50b6c..1008bfa99 100644 --- a/apps/apps_container.h +++ b/apps/apps_container.h @@ -66,8 +66,8 @@ private: bool updateAlphaLock(); static I18n::Message k_promptMessages[]; - static KDColor k_promptFGColors[]; - static KDColor k_promptBGColors[]; + static KDColor const * k_promptFGColors[]; + static KDColor const * k_promptBGColors[]; static int k_promptNumberOfMessages; AppsWindow m_window; EmptyBatteryWindow m_emptyBatteryWindow; diff --git a/apps/apps_container_prompt_beta.cpp b/apps/apps_container_prompt_beta.cpp index 729062c6a..958d10db5 100644 --- a/apps/apps_container_prompt_beta.cpp +++ b/apps/apps_container_prompt_beta.cpp @@ -11,14 +11,14 @@ I18n::Message AppsContainer::k_promptMessages[] = { I18n::Message::BetaVersionMessage6}; KDColor AppsContainer::k_promptFGColors[] = { - KDColorBlack, - KDColorBlack, - KDColorBlack, - KDColorBlack, - KDColorWhite, - KDColorBlack, - KDColorBlack, - Palette::AccentText}; + &KDColorBlack, + &KDColorBlack, + &KDColorBlack, + &KDColorBlack, + &KDColorWhite, + &KDColorBlack, + &KDColorBlack, + *Palette::AccentText}; KDColor AppsContainer::k_promptBGColors[] = { KDColorWhite, diff --git a/apps/apps_container_prompt_none.cpp b/apps/apps_container_prompt_none.cpp index e750df2b6..bbc351de0 100644 --- a/apps/apps_container_prompt_none.cpp +++ b/apps/apps_container_prompt_none.cpp @@ -2,8 +2,8 @@ I18n::Message AppsContainer::k_promptMessages[] = {}; -KDColor AppsContainer::k_promptFGColors[] = {}; -KDColor AppsContainer::k_promptBGColors[] = {}; +KDColor const * AppsContainer::k_promptFGColors[] = {}; +KDColor const * AppsContainer::k_promptBGColors[] = {}; int AppsContainer::k_promptNumberOfMessages = 0; diff --git a/apps/apps_container_prompt_update.cpp b/apps/apps_container_prompt_update.cpp index 59c93f0f4..dbf73611a 100644 --- a/apps/apps_container_prompt_update.cpp +++ b/apps/apps_container_prompt_update.cpp @@ -8,15 +8,15 @@ I18n::Message AppsContainer::k_promptMessages[] = { I18n::Message::UpdateMessage3, I18n::Message::UpdateMessage4}; -KDColor AppsContainer::k_promptFGColors[] = { - KDColorBlack, - KDColorBlack, - KDColorBlack, - KDColorWhite, - KDColorBlack, - Palette::AccentText}; +KDColor const * AppsContainer::k_promptFGColors[] = { + &KDColorBlack, + &KDColorBlack, + &KDColorBlack, + &KDColorWhite, + &KDColorBlack, + *Palette::AccentText}; -KDColor AppsContainer::k_promptBGColors[] = { +KDColor const * AppsContainer::k_promptBGColors[] = { KDColorWhite, KDColorWhite, KDColorWhite, diff --git a/apps/battery_view.cpp b/apps/battery_view.cpp index 1026f496e..4a0792f57 100644 --- a/apps/battery_view.cpp +++ b/apps/battery_view.cpp @@ -60,43 +60,43 @@ void BatteryView::drawRect(KDContext * ctx, KDRect rect) const { *'content' depends on the charge */ // Draw the left part - ctx->fillRect(KDRect(0, 0, k_elementWidth, k_batteryHeight), Palette::Battery); + ctx->fillRect(KDRect(0, 0, k_elementWidth, k_batteryHeight), *Palette::Battery); // Draw the middle part constexpr KDCoordinate batteryInsideX = k_elementWidth+k_separatorThickness; constexpr KDCoordinate batteryInsideWidth = k_batteryWidth-3*k_elementWidth-2*k_separatorThickness; if (m_isCharging) { // Charging: Yellow background with flash - ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), Palette::BatteryInCharge); + ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), *Palette::BatteryInCharge); KDRect frame((k_batteryWidth-k_flashWidth)/2, 0, k_flashWidth, k_flashHeight); KDColor flashWorkingBuffer[BatteryView::k_flashHeight*BatteryView::k_flashWidth]; - ctx->blendRectWithMask(frame, Palette::Battery, (const uint8_t *)flashMask, flashWorkingBuffer); + ctx->blendRectWithMask(frame, *Palette::Battery, (const uint8_t *)flashMask, flashWorkingBuffer); } else if (m_chargeState == Ion::Battery::Charge::LOW) { assert(!m_isPlugged); // Low: Quite empty battery - ctx->fillRect(KDRect(batteryInsideX, 0, 2*k_elementWidth, k_batteryHeight), Palette::BatteryLow); - ctx->fillRect(KDRect(3*k_elementWidth+k_separatorThickness, 0, k_batteryWidth-5*k_elementWidth-2*k_separatorThickness, k_batteryHeight), KDColor::blend(Palette::Toolbar, Palette::Battery, 128)); + ctx->fillRect(KDRect(batteryInsideX, 0, 2*k_elementWidth, k_batteryHeight), *Palette::BatteryLow); + ctx->fillRect(KDRect(3*k_elementWidth+k_separatorThickness, 0, k_batteryWidth-5*k_elementWidth-2*k_separatorThickness, k_batteryHeight), KDColor::blend(*Palette::Toolbar, *Palette::Battery, 128)); } else if (m_chargeState == Ion::Battery::Charge::SOMEWHERE_INBETWEEN) { assert(!m_isPlugged); // Middle: Half full battery constexpr KDCoordinate middleChargeWidth = batteryInsideWidth/2; - ctx->fillRect(KDRect(batteryInsideX, 0, middleChargeWidth, k_batteryHeight), Palette::Battery); - ctx->fillRect(KDRect(batteryInsideX+middleChargeWidth, 0, middleChargeWidth, k_batteryHeight), KDColor::blend(Palette::Toolbar, Palette::Battery, 128)); + ctx->fillRect(KDRect(batteryInsideX, 0, middleChargeWidth, k_batteryHeight), *Palette::Battery); + ctx->fillRect(KDRect(batteryInsideX+middleChargeWidth, 0, middleChargeWidth, k_batteryHeight), KDColor::blend(*Palette::Toolbar, *Palette::Battery, 128)); } else { assert(m_chargeState == Ion::Battery::Charge::FULL); // Full but not plugged: Full battery - ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), Palette::Battery); + ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), *Palette::Battery); if (m_isPlugged) { // Plugged and full: Full battery with tick KDRect frame((k_batteryWidth-k_tickWidth)/2, (k_batteryHeight-k_tickHeight)/2, k_tickWidth, k_tickHeight); KDColor tickWorkingBuffer[BatteryView::k_tickHeight*BatteryView::k_tickWidth]; - ctx->blendRectWithMask(frame, Palette::Toolbar, (const uint8_t *)tickMask, tickWorkingBuffer); + ctx->blendRectWithMask(frame, *Palette::Toolbar, (const uint8_t *)tickMask, tickWorkingBuffer); } } // Draw the right part - ctx->fillRect(KDRect(k_batteryWidth-2*k_elementWidth, 0, k_elementWidth, k_batteryHeight), Palette::Battery); - ctx->fillRect(KDRect(k_batteryWidth-k_elementWidth, (k_batteryHeight-k_capHeight)/2, k_elementWidth, k_capHeight), Palette::Battery); + ctx->fillRect(KDRect(k_batteryWidth-2*k_elementWidth, 0, k_elementWidth, k_batteryHeight), *Palette::Battery); + ctx->fillRect(KDRect(k_batteryWidth-k_elementWidth, (k_batteryHeight-k_capHeight)/2, k_elementWidth, k_capHeight), *Palette::Battery); } KDSize BatteryView::minimalSizeForOptimalDisplay() const { diff --git a/apps/calculation/additional_outputs/complex_graph_cell.cpp b/apps/calculation/additional_outputs/complex_graph_cell.cpp index fe38bf910..b6d9350e3 100644 --- a/apps/calculation/additional_outputs/complex_graph_cell.cpp +++ b/apps/calculation/additional_outputs/complex_graph_cell.cpp @@ -13,7 +13,7 @@ ComplexGraphView::ComplexGraphView(ComplexModel * complexModel) : } void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(rect, Palette::BackgroundApps); + ctx->fillRect(rect, *Palette::BackgroundApps); // Draw grid, axes and graduations drawGrid(ctx, rect); @@ -26,7 +26,7 @@ void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const { assert(!std::isnan(real) && !std::isnan(imag) && !std::isinf(real) && !std::isinf(imag)); // Draw the segment from the origin to the dot (real, imag) - drawSegment(ctx, rect, 0.0f, 0.0f, m_complex->real(), m_complex->imag(), Palette::SecondaryText, false); + drawSegment(ctx, rect, 0.0f, 0.0f, m_complex->real(), m_complex->imag(), *Palette::SecondaryText, false); /* Draw the partial ellipse indicating the angle θ * - the ellipse parameters are a = |real|/5 and b = |imag|/5, @@ -59,27 +59,27 @@ void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const { float a = parameters.real(); float b = parameters.imag(); return Poincare::Coordinate2D(a*std::cos(t*th), b*std::sin(t*th)); - }, ¶meters, &th, false, Palette::SecondaryText, false); + }, ¶meters, &th, false, *Palette::SecondaryText, false); // Draw dashed segment to indicate real and imaginary - drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, real, 0.0f, imag, Palette::CalculationTrigoAndComplexForeground, 1, 3); - drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, imag, 0.0f, real, Palette::CalculationTrigoAndComplexForeground, 1, 3); + drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, real, 0.0f, imag, *Palette::CalculationTrigoAndComplexForeground, 1, 3); + drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, imag, 0.0f, real, *Palette::CalculationTrigoAndComplexForeground, 1, 3); // Draw complex position on the plan - drawDot(ctx, rect, real, imag, Palette::CalculationTrigoAndComplexForeground, Size::Large); + drawDot(ctx, rect, real, imag, *Palette::CalculationTrigoAndComplexForeground, Size::Large); // Draw labels // 're(z)' label - drawLabel(ctx, rect, real, 0.0f, "re(z)", Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, imag >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After); + drawLabel(ctx, rect, real, 0.0f, "re(z)", *Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, imag >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After); // 'im(z)' label - drawLabel(ctx, rect, 0.0f, imag, "im(z)", Palette::CalculationTrigoAndComplexForeground, real >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None); + drawLabel(ctx, rect, 0.0f, imag, "im(z)", *Palette::CalculationTrigoAndComplexForeground, real >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None); // '|z|' label, the relative horizontal position of this label depends on the quadrant CurveView::RelativePosition verticalPosition = real*imag < 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After; if (real == 0.0f) { // Edge case: pure imaginary verticalPosition = CurveView::RelativePosition::None; } - drawLabel(ctx, rect, real/2.0f, imag/2.0f, "|z|", Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, verticalPosition); + drawLabel(ctx, rect, real/2.0f, imag/2.0f, "|z|", *Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, verticalPosition); // 'arg(z)' label, the absolute and relative horizontal/vertical positions of this label depends on the quadrant CurveView::RelativePosition horizontalPosition = real >= 0.0f ? CurveView::RelativePosition::After : CurveView::RelativePosition::None; verticalPosition = imag >= 0.0f ? CurveView::RelativePosition::After : CurveView::RelativePosition::Before; @@ -88,7 +88,7 @@ void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const { * and for the left half plan, we position the label at the half angle. The * relative position is chosen accordingly. */ float anglePositionRatio = real >= 0.0f ? 0.0f : 0.5f; - drawLabel(ctx, rect, a*std::cos(anglePositionRatio*th), b*std::sin(anglePositionRatio*th), "arg(z)", Palette::CalculationTrigoAndComplexForeground, horizontalPosition, verticalPosition); + drawLabel(ctx, rect, a*std::cos(anglePositionRatio*th), b*std::sin(anglePositionRatio*th), "arg(z)", *Palette::CalculationTrigoAndComplexForeground, horizontalPosition, verticalPosition); } } diff --git a/apps/calculation/additional_outputs/expression_with_equal_sign_view.cpp b/apps/calculation/additional_outputs/expression_with_equal_sign_view.cpp index 2e480bb39..31105f311 100644 --- a/apps/calculation/additional_outputs/expression_with_equal_sign_view.cpp +++ b/apps/calculation/additional_outputs/expression_with_equal_sign_view.cpp @@ -15,7 +15,7 @@ void ExpressionWithEqualSignView::drawRect(KDContext * ctx, KDRect rect) const { // Do not color the whole background to avoid coloring behind the equal symbol KDSize expressionSize = ExpressionView::minimalSizeForOptimalDisplay(); ctx->fillRect(KDRect(0, 0, expressionSize), m_backgroundColor); - m_layout.draw(ctx, drawingOrigin(), m_textColor, m_backgroundColor, m_selectionStart, m_selectionEnd, Palette::Select); + m_layout.draw(ctx, drawingOrigin(), m_textColor, m_backgroundColor, m_selectionStart, m_selectionEnd, *Palette::Select); } View * ExpressionWithEqualSignView::subviewAtIndex(int index) { diff --git a/apps/calculation/additional_outputs/expression_with_equal_sign_view.h b/apps/calculation/additional_outputs/expression_with_equal_sign_view.h index 359fbe46b..045fc1dd5 100644 --- a/apps/calculation/additional_outputs/expression_with_equal_sign_view.h +++ b/apps/calculation/additional_outputs/expression_with_equal_sign_view.h @@ -11,7 +11,7 @@ namespace Calculation { class ExpressionWithEqualSignView : public ExpressionView { public: ExpressionWithEqualSignView() : - m_equalSign(KDFont::LargeFont, I18n::Message::Equal, 0.5f, 0.5f, Palette::PrimaryText) + m_equalSign(KDFont::LargeFont, I18n::Message::Equal, 0.5f, 0.5f, *Palette::PrimaryText) {} KDSize minimalSizeForOptimalDisplay() const override; void drawRect(KDContext * ctx, KDRect rect) const override; diff --git a/apps/calculation/additional_outputs/illustration_cell.cpp b/apps/calculation/additional_outputs/illustration_cell.cpp index 20249c7d8..287cbd594 100644 --- a/apps/calculation/additional_outputs/illustration_cell.cpp +++ b/apps/calculation/additional_outputs/illustration_cell.cpp @@ -10,7 +10,7 @@ void IllustrationCell::layoutSubviews(bool force) { } void IllustrationCell::drawRect(KDContext * ctx, KDRect rect) const { - drawBorderOfRect(ctx, bounds(), Palette::ListCellBorder); + drawBorderOfRect(ctx, bounds(), *Palette::ListCellBorder); } } diff --git a/apps/calculation/additional_outputs/list_controller.cpp b/apps/calculation/additional_outputs/list_controller.cpp index ea2b17d3c..9ee8e9f75 100644 --- a/apps/calculation/additional_outputs/list_controller.cpp +++ b/apps/calculation/additional_outputs/list_controller.cpp @@ -22,7 +22,7 @@ void ListController::InnerListController::didBecomeFirstResponder() { /* List Controller */ ListController::ListController(EditExpressionController * editExpressionController, SelectableTableViewDelegate * delegate) : - StackViewController(nullptr, &m_listController, Palette::ToolboxHeaderText, Palette::ToolboxHeaderBackground, Palette::ToolboxHeaderBorder), + StackViewController(nullptr, &m_listController, *Palette::ToolboxHeaderText, *Palette::ToolboxHeaderBackground, *Palette::ToolboxHeaderBorder), m_listController(this, delegate), m_editExpressionController(editExpressionController) { diff --git a/apps/calculation/additional_outputs/scrollable_three_expressions_cell.h b/apps/calculation/additional_outputs/scrollable_three_expressions_cell.h index 95ad64823..3edbe7737 100644 --- a/apps/calculation/additional_outputs/scrollable_three_expressions_cell.h +++ b/apps/calculation/additional_outputs/scrollable_three_expressions_cell.h @@ -17,7 +17,7 @@ public: static constexpr KDCoordinate k_margin = Metric::CommonSmallMargin; ScrollableThreeExpressionsView(Responder * parentResponder) : Shared::AbstractScrollableMultipleExpressionsView(parentResponder, &m_contentCell), m_contentCell() { setMargins(k_margin, k_margin, k_margin, k_margin); // Left Right margins are already added by TableCell - setBackgroundColor(Palette::BackgroundApps); + setBackgroundColor(*Palette::BackgroundApps); } void resetMemoization(); void setCalculation(Calculation * calculation, bool canChangeDisplayOutput); @@ -28,7 +28,7 @@ private: class ContentCell : public Shared::AbstractScrollableMultipleExpressionsView::ContentCell { public: ContentCell() : m_leftExpressionView() {} - KDColor backgroundColor() const override { return Palette::BackgroundApps; } + KDColor backgroundColor() const override { return *Palette::BackgroundApps; } void setEven(bool even) override { return; } ExpressionView * leftExpressionView() const override { return const_cast(&m_leftExpressionView); } private: diff --git a/apps/calculation/additional_outputs/trigonometry_graph_cell.cpp b/apps/calculation/additional_outputs/trigonometry_graph_cell.cpp index 636ce588a..0de426cc6 100644 --- a/apps/calculation/additional_outputs/trigonometry_graph_cell.cpp +++ b/apps/calculation/additional_outputs/trigonometry_graph_cell.cpp @@ -15,24 +15,24 @@ TrigonometryGraphView::TrigonometryGraphView(TrigonometryModel * model) : void TrigonometryGraphView::drawRect(KDContext * ctx, KDRect rect) const { float s = std::sin(m_model->angle()); float c = std::cos(m_model->angle()); - ctx->fillRect(rect, Palette::BackgroundApps); + ctx->fillRect(rect, *Palette::BackgroundApps); drawGrid(ctx, rect); drawAxes(ctx, rect); // Draw the circle drawCurve(ctx, rect, 0.0f, 2.0f*M_PI, M_PI/180.0f, [](float t, void * model, void * context) { return Poincare::Coordinate2D(std::cos(t), std::sin(t)); - }, nullptr, nullptr, true, Palette::SecondaryText, false); + }, nullptr, nullptr, true, *Palette::SecondaryText, false); // Draw dashed segment to indicate sine and cosine - drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, c, 0.0f, s, Palette::CalculationTrigoAndComplexForeground, 1, 3); - drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, s, 0.0f, c, Palette::CalculationTrigoAndComplexForeground, 1, 3); + drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, c, 0.0f, s, *Palette::CalculationTrigoAndComplexForeground, 1, 3); + drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, s, 0.0f, c, *Palette::CalculationTrigoAndComplexForeground, 1, 3); // Draw angle position on the circle - drawDot(ctx, rect, c, s, Palette::CalculationTrigoAndComplexForeground, Size::Large); + drawDot(ctx, rect, c, s, *Palette::CalculationTrigoAndComplexForeground, Size::Large); // Draw graduations drawLabelsAndGraduations(ctx, rect, Axis::Vertical, false, true); drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, true); // Draw labels - drawLabel(ctx, rect, 0.0f, s, "sin(θ)", Palette::CalculationTrigoAndComplexForeground, c >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None); - drawLabel(ctx, rect, c, 0.0f, "cos(θ)", Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, s >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After); + drawLabel(ctx, rect, 0.0f, s, "sin(θ)", *Palette::CalculationTrigoAndComplexForeground, c >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None); + drawLabel(ctx, rect, c, 0.0f, "cos(θ)", *Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, s >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After); } } diff --git a/apps/calculation/history_view_cell.cpp b/apps/calculation/history_view_cell.cpp index e30995750..d3db578a5 100644 --- a/apps/calculation/history_view_cell.cpp +++ b/apps/calculation/history_view_cell.cpp @@ -81,7 +81,7 @@ void HistoryViewCell::reloadSubviewHighlight() { m_ellipsis.setHighlighted(false); if (isHighlighted()) { if (m_dataSource->selectedSubviewType() == HistoryViewCellDataSource::SubviewType::Input) { - m_inputView.setExpressionBackgroundColor(Palette::Select); + m_inputView.setExpressionBackgroundColor(*Palette::Select); } else if (m_dataSource->selectedSubviewType() == HistoryViewCellDataSource::SubviewType::Output) { m_scrollableOutputView.evenOddCell()->setHighlighted(true); } else { diff --git a/apps/calculation/history_view_cell.h b/apps/calculation/history_view_cell.h index 38d7e22f1..419d48ee7 100644 --- a/apps/calculation/history_view_cell.h +++ b/apps/calculation/history_view_cell.h @@ -49,7 +49,7 @@ public: return this; } Poincare::Layout layout() const override; - KDColor backgroundColor() const override { return m_even ? Palette::CalculationBackgroundEven : Palette::CalculationBackgroundOdd; } + KDColor backgroundColor() const override { return m_even ? *Palette::CalculationBackgroundEven : *Palette::CalculationBackgroundOdd; } void resetMemoization(); void setCalculation(Calculation * calculation, bool expanded, bool canChangeDisplayOutput = false); int numberOfSubviews() const override { return 2 + displayedEllipsis(); } diff --git a/apps/code/console_controller.cpp b/apps/code/console_controller.cpp index c550d19f3..2d6dc4a5d 100644 --- a/apps/code/console_controller.cpp +++ b/apps/code/console_controller.cpp @@ -40,7 +40,7 @@ ConsoleController::ConsoleController(Responder * parentResponder, App * pythonDe #endif { m_selectableTableView.setMargins(0, Metric::CommonRightMargin, 0, Metric::TitleBarExternHorizontalMargin); - m_selectableTableView.setBackgroundColor(Palette::CodeBackground); + m_selectableTableView.setBackgroundColor(*Palette::CodeBackground); m_editCell.setPrompt(sStandardPromptText); for (int i = 0; i < k_numberOfLineCells; i++) { m_cells[i].setParentResponder(&m_selectableTableView); diff --git a/apps/code/console_line_cell.cpp b/apps/code/console_line_cell.cpp index 3cad12787..c7ef15977 100644 --- a/apps/code/console_line_cell.cpp +++ b/apps/code/console_line_cell.cpp @@ -18,8 +18,8 @@ void ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::setLine(Consol } void ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(bounds(), Palette::CodeBackground); - ctx->drawString(m_line->text(), KDPointZero, GlobalPreferences::sharedGlobalPreferences()->font(), textColor(m_line), isHighlighted()? Palette::Select : Palette::BackgroundApps); + ctx->fillRect(bounds(), *Palette::CodeBackground); + ctx->drawString(m_line->text(), KDPointZero, GlobalPreferences::sharedGlobalPreferences()->font(), textColor(m_line), isHighlighted()? *Palette::Select : *Palette::BackgroundApps); } KDSize ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::minimalSizeForOptimalDisplay() const { diff --git a/apps/code/console_line_cell.h b/apps/code/console_line_cell.h index b6c32d6d3..bb68d9d29 100644 --- a/apps/code/console_line_cell.h +++ b/apps/code/console_line_cell.h @@ -53,7 +53,7 @@ private: ConsoleLineView m_consoleLineView; }; static KDColor textColor(ConsoleLine * line) { - return line->isFromCurrentSession() ? Palette::CodeText : Palette::SecondaryText; + return line->isFromCurrentSession() ? *Palette::CodeText : *Palette::SecondaryText; } MessageTextView m_promptView; ScrollableConsoleLineView m_scrollableView; diff --git a/apps/code/editor_view.cpp b/apps/code/editor_view.cpp index ab327fb52..db5bff5cc 100644 --- a/apps/code/editor_view.cpp +++ b/apps/code/editor_view.cpp @@ -57,8 +57,8 @@ void EditorView::layoutSubviews(bool force) { /* EditorView::GutterView */ void EditorView::GutterView::drawRect(KDContext * ctx, KDRect rect) const { - KDColor textColor = Palette::PrimaryText; - KDColor backgroundColor = Palette::CodeGutterViewBackground; + KDColor textColor = *Palette::PrimaryText; + KDColor backgroundColor = *Palette::CodeGutterViewBackground; ctx->fillRect(rect, backgroundColor); diff --git a/apps/code/python_text_area.cpp b/apps/code/python_text_area.cpp index 480da7304..5df4bf8a5 100644 --- a/apps/code/python_text_area.cpp +++ b/apps/code/python_text_area.cpp @@ -14,22 +14,12 @@ extern "C" { namespace Code { -constexpr KDColor CommentColor = Palette::CodeComment; -constexpr KDColor NumberColor = Palette::CodeNumber; -constexpr KDColor KeywordColor = Palette::CodeKeyword; -// constexpr KDColor BuiltinColor = KDColor::RGB24(0x0086B3); -constexpr KDColor OperatorColor = Palette::CodeOperator; -constexpr KDColor StringColor = Palette::CodeString; -constexpr KDColor BackgroundColor = Palette::CodeBackground; -constexpr KDColor HighlightColor = Palette::CodeBackgroundSelected; -constexpr KDColor AutocompleteColor = KDColor::RGB24(0xC6C6C6); // TODO Palette change - static inline KDColor TokenColor(mp_token_kind_t tokenKind) { if (tokenKind == MP_TOKEN_STRING) { - return StringColor; + return *Palette::CodeString; } if (tokenKind == MP_TOKEN_INTEGER || tokenKind == MP_TOKEN_FLOAT_OR_IMAG) { - return NumberColor; + return *Palette::CodeNumber; } static_assert(MP_TOKEN_ELLIPSIS + 1 == MP_TOKEN_KW_FALSE && MP_TOKEN_KW_FALSE + 1 == MP_TOKEN_KW_NONE @@ -69,7 +59,7 @@ static inline KDColor TokenColor(mp_token_kind_t tokenKind) { && MP_TOKEN_KW_YIELD + 1 == MP_TOKEN_OP_TILDE, "MP_TOKEN order changed, so Code::PythonTextArea::TokenColor might need to change too."); if (tokenKind >= MP_TOKEN_KW_FALSE && tokenKind <= MP_TOKEN_KW_YIELD) { - return KeywordColor; + return *Palette::CodeKeyword; } static_assert(MP_TOKEN_OP_TILDE + 1 == MP_TOKEN_OP_LESS && MP_TOKEN_OP_LESS + 1 == MP_TOKEN_OP_MORE @@ -121,9 +111,9 @@ static inline KDColor TokenColor(mp_token_kind_t tokenKind) { || tokenKind == MP_TOKEN_DEL_EQUAL || tokenKind == MP_TOKEN_DEL_MINUS_MORE) { - return OperatorColor; + return *Palette::CodeOperator; } - return Palette::CodeText; + return *Palette::CodeText; } static inline size_t TokenLength(mp_lexer_t * lex, const char * tokenPosition) { @@ -216,7 +206,7 @@ void PythonTextArea::ContentView::unloadSyntaxHighlighter() { } void PythonTextArea::ContentView::clearRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(rect, BackgroundColor); + ctx->fillRect(rect, *Palette::CodeBackground); } #define LOG_DRAWING 0 @@ -246,11 +236,11 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char fromColumn, spacesStart, std::min(text + byteLength, firstNonSpace) - spacesStart, - StringColor, - BackgroundColor, + *Palette::CodeString, + *Palette::CodeBackground, selectionStart, selectionEnd, - HighlightColor); + *Palette::CodeBackgroundSelected); } if (UTF8Helper::CodePointIs(firstNonSpace, UCodePointNull)) { return; @@ -276,17 +266,17 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char UTF8Helper::GlyphOffsetAtCodePoint(text, tokenEnd), tokenEnd, std::min(text + byteLength, tokenFrom) - tokenEnd, - StringColor, - BackgroundColor, + *Palette::CodeString, + *Palette::CodeBackground, selectionStart, selectionEnd, - HighlightColor); + *Palette::CodeBackgroundSelected); } tokenLength = TokenLength(lex, tokenFrom); tokenEnd = tokenFrom + tokenLength; // If the token is being autocompleted, use DefaultColor - KDColor color = (tokenFrom <= autocompleteStart && autocompleteStart < tokenEnd) ? Palette::CodeText : TokenColor(lex->tok_kind); + KDColor color = (tokenFrom <= autocompleteStart && autocompleteStart < tokenEnd) ? *Palette::CodeText : TokenColor(lex->tok_kind); LOG_DRAW("Draw \"%.*s\" for token %d\n", tokenLength, tokenFrom, lex->tok_kind); drawStringAt(ctx, line, @@ -294,10 +284,10 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char tokenFrom, tokenLength, color, - BackgroundColor, + *Palette::CodeBackground, selectionStart, selectionEnd, - HighlightColor); + *Palette::CodeBackgroundSelected); mp_lexer_to_next(lex); LOG_DRAW("Pop token %d\n", lex->tok_kind); @@ -305,18 +295,18 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char tokenFrom += tokenLength; - // Even if the token is being autocompleted, use CommentColor + // Even if the token is being autocompleted, use *Palette::CodeComment if (tokenFrom < text + byteLength) { LOG_DRAW("Draw comment \"%.*s\" from %d\n", byteLength - (tokenFrom - text), firstNonSpace, tokenFrom); drawStringAt(ctx, line, UTF8Helper::GlyphOffsetAtCodePoint(text, tokenFrom), tokenFrom, text + byteLength - tokenFrom, - CommentColor, - BackgroundColor, + *Palette::CodeComment, + *Palette::CodeBackground, selectionStart, selectionEnd, - HighlightColor); + *Palette::CodeBackgroundSelected); } mp_lexer_free(lex); @@ -332,11 +322,11 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char UTF8Helper::GlyphOffsetAtCodePoint(text, autocompleteStart), autocompleteStart, std::min(text + byteLength, m_autocompletionEnd) - autocompleteStart, - AutocompleteColor, - BackgroundColor, + KDColor::RGB24(0xC6C6C6), + *Palette::CodeBackground, nullptr, nullptr, - HighlightColor); + *Palette::CodeBackgroundSelected); } } diff --git a/apps/code/sandbox_controller.cpp b/apps/code/sandbox_controller.cpp index 48d29f247..4fd43e25e 100644 --- a/apps/code/sandbox_controller.cpp +++ b/apps/code/sandbox_controller.cpp @@ -9,7 +9,7 @@ namespace Code { SandboxController::SandboxController(Responder * parentResponder) : ViewController(parentResponder), - m_solidColorView(Palette::CodeBackground) + m_solidColorView(*Palette::CodeBackground) { } diff --git a/apps/code/script_node_cell.cpp b/apps/code/script_node_cell.cpp index b51abdf86..7e8e1db14 100644 --- a/apps/code/script_node_cell.cpp +++ b/apps/code/script_node_cell.cpp @@ -8,12 +8,12 @@ constexpr char ScriptNodeCell::k_parentheses[]; constexpr char ScriptNodeCell::k_parenthesesWithEmpty[]; void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) const { - const KDColor backgroundColor = isHighlighted()? Palette::CodeBackgroundSelected : Palette::CodeBackground; + const KDColor backgroundColor = isHighlighted()? *Palette::CodeBackgroundSelected : *Palette::CodeBackground; // If it exists, draw the description name. const char * descriptionName = m_scriptNode->description(); if (descriptionName != nullptr) { - ctx->drawString(descriptionName, KDPoint(0, m_frame.height() - k_bottomMargin - k_font->glyphSize().height()), k_font, Palette::GrayDark, backgroundColor); + ctx->drawString(descriptionName, KDPoint(0, m_frame.height() - k_bottomMargin - k_font->glyphSize().height()), k_font, *Palette::GrayDark, backgroundColor); } // Draw the node name @@ -21,10 +21,10 @@ void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) cons const int nodeNameLength = m_scriptNode->nameLength(); KDSize nameSize = k_font->stringSize(nodeName, nodeNameLength); const KDCoordinate nodeNameY = k_topMargin; - ctx->drawString(nodeName, KDPoint(0, nodeNameY), k_font, Palette::PrimaryText, backgroundColor, nodeNameLength); + ctx->drawString(nodeName, KDPoint(0, nodeNameY), k_font, *Palette::PrimaryText, backgroundColor, nodeNameLength); // If it is needed, draw the parentheses if (m_scriptNode->type() == ScriptNode::Type::WithParentheses) { - ctx->drawString(ScriptNodeCell::k_parentheses, KDPoint(nameSize.width(), nodeNameY), k_font, Palette::PrimaryText, backgroundColor); + ctx->drawString(ScriptNodeCell::k_parentheses, KDPoint(nameSize.width(), nodeNameY), k_font, *Palette::PrimaryText, backgroundColor); } /* If it exists, draw the source name. If it did not fit, we would have put @@ -32,7 +32,7 @@ void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) cons const char * sourceName = m_scriptNode->nodeSourceName(); if (sourceName != nullptr) { KDSize sourceNameSize = k_font->stringSize(sourceName); - ctx->drawString(sourceName, KDPoint(m_frame.width() - sourceNameSize.width(), nodeNameY), k_font, Palette::CodeText, backgroundColor); + ctx->drawString(sourceName, KDPoint(m_frame.width() - sourceNameSize.width(), nodeNameY), k_font, *Palette::CodeText, backgroundColor); } } diff --git a/apps/code/script_parameter_controller.cpp b/apps/code/script_parameter_controller.cpp index 1390fcd99..2576db5ab 100644 --- a/apps/code/script_parameter_controller.cpp +++ b/apps/code/script_parameter_controller.cpp @@ -100,7 +100,7 @@ void ScriptParameterController::willDisplayCellForIndex(HighlightCell * cell, in MessageTableCellWithBuffer * myCell = (MessageTableCellWithBuffer *)cell; GetScriptSize(myCell); myCell->setAccessoryFont(KDFont::SmallFont); - myCell->setAccessoryTextColor(Palette::SecondaryText); + myCell->setAccessoryTextColor(*Palette::SecondaryText); } } diff --git a/apps/code/toolbox_ion_keys.cpp b/apps/code/toolbox_ion_keys.cpp index 1387f9bad..f1b083e6b 100644 --- a/apps/code/toolbox_ion_keys.cpp +++ b/apps/code/toolbox_ion_keys.cpp @@ -37,9 +37,9 @@ namespace Code { } void toolboxIonKeys::toolboxIonView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(rect, Palette::WallScreen); - ctx->strokeRect(rect, Palette::ListCellBorder); - ctx->drawString(I18n::translate(I18n::Message::PressAKey),KDPoint(rect.left()+80, rect.top()+20),KDFont::LargeFont,Palette::PrimaryText,Palette::WallScreen); + ctx->fillRect(rect, *Palette::WallScreen); + ctx->strokeRect(rect, *Palette::ListCellBorder); + ctx->drawString(I18n::translate(I18n::Message::PressAKey),KDPoint(rect.left()+80, rect.top()+20),KDFont::LargeFont,*Palette::PrimaryText,*Palette::WallScreen); } diff --git a/apps/code/variable_box_controller.cpp b/apps/code/variable_box_controller.cpp index 279c9c57c..f08bf4791 100644 --- a/apps/code/variable_box_controller.cpp +++ b/apps/code/variable_box_controller.cpp @@ -44,8 +44,8 @@ VariableBoxController::VariableBoxController(ScriptStore * scriptStore) : m_importedNodesCount(0) { for (int i = 0; i < k_scriptOriginsCount; i++) { - m_subtitleCells[i].setBackgroundColor(Palette::WallScreen); - m_subtitleCells[i].setTextColor(Palette::SecondaryText); + m_subtitleCells[i].setBackgroundColor(*Palette::WallScreen); + m_subtitleCells[i].setTextColor(*Palette::SecondaryText); } } diff --git a/apps/external/main_controller.cpp b/apps/external/main_controller.cpp index acf837441..4bc0dc30e 100644 --- a/apps/external/main_controller.cpp +++ b/apps/external/main_controller.cpp @@ -90,40 +90,40 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) { #if defined(DEVICE_N0100) && !defined(EXTERNAL_BUILTIN) if(index == 0){ myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible)); - myTextCell->setTextColor(Palette::Red); + myTextCell->setTextColor(*Palette::Red); } else { myTextCell->setText(I18n::translate(I18n::Message::WithN0100)); - myTextCell->setTextColor(Palette::Red); + myTextCell->setTextColor(*Palette::Red); } #else if(index == k_numberOfCells-1){ myTextCell->setText(I18n::translate(I18n::Message::URL)); - myTextCell->setTextColor(Palette::AccentText); + myTextCell->setTextColor(*Palette::AccentText); return; } if(index == k_numberOfCells-2){ myTextCell->setText(I18n::translate(I18n::Message::GetMoreAppsAt)); - myTextCell->setTextColor(Palette::AccentText); + myTextCell->setTextColor(*Palette::AccentText); return; } if(index == 0 && numberOfFiles() == 0){ myTextCell->setText(I18n::translate(I18n::Message::NoAppsInstalled)); - myTextCell->setTextColor(Palette::Red); + myTextCell->setTextColor(*Palette::Red); } if(numberOfFiles() > 0){ if(fileAtIndex(index, f)) { myTextCell->setText(f.name); - myTextCell->setTextColor(f.isExecutable ? Palette::PrimaryText : Palette::Palette::SecondaryText); + myTextCell->setTextColor(f.isExecutable ? *Palette::PrimaryText : *Palette::Palette::SecondaryText); } } #endif #else if(index == 0){ myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible)); - myTextCell->setTextColor(Palette::Red); + myTextCell->setTextColor(*Palette::Red); } else { myTextCell->setText(I18n::translate(I18n::Message::WithSimulator)); - myTextCell->setTextColor(Palette::Red); + myTextCell->setTextColor(*Palette::Red); } #endif } diff --git a/apps/external/pointer_text_table_cell.cpp b/apps/external/pointer_text_table_cell.cpp index 00967fafb..1deedae56 100644 --- a/apps/external/pointer_text_table_cell.cpp +++ b/apps/external/pointer_text_table_cell.cpp @@ -19,7 +19,7 @@ const char * PointerTextTableCell::text() const { void PointerTextTableCell::setHighlighted(bool highlight) { HighlightCell::setHighlighted(highlight); - KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_pointerTextView.setBackgroundColor(backgroundColor); } diff --git a/apps/graph/graph/graph_view.cpp b/apps/graph/graph/graph_view.cpp index 9d34bbf4d..24c1885c4 100644 --- a/apps/graph/graph/graph_view.cpp +++ b/apps/graph/graph/graph_view.cpp @@ -75,7 +75,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const { // To represent the tangent, we draw segment from and to abscissas at the extremity of the drawn rect float minAbscissa = pixelToFloat(Axis::Horizontal, rect.left()); float maxAbscissa = pixelToFloat(Axis::Horizontal, rect.right()); - drawSegment(ctx, rect, minAbscissa, tangentParameterA*minAbscissa+tangentParameterB, maxAbscissa, tangentParameterA*maxAbscissa+tangentParameterB, Palette::GraphTangent, false); + drawSegment(ctx, rect, minAbscissa, tangentParameterA*minAbscissa+tangentParameterB, maxAbscissa, tangentParameterA*maxAbscissa+tangentParameterB, *Palette::GraphTangent, false); } } else if (type == Shared::ContinuousFunction::PlotType::Polar) { // Polar diff --git a/apps/graph/list/list_controller.cpp b/apps/graph/list/list_controller.cpp index 78261ded5..5567cc761 100644 --- a/apps/graph/list/list_controller.cpp +++ b/apps/graph/list/list_controller.cpp @@ -167,7 +167,7 @@ void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) { // Set name and color if the name is not being edited ExpiringPointer function = modelStore()->modelForRecord(modelStore()->recordAtIndex(j)); setFunctionNameInTextField(function, titleCell->textField()); - KDColor functionNameColor = function->isActive() ? function->color() : Palette::SecondaryText; + KDColor functionNameColor = function->isActive() ? function->color() : *Palette::SecondaryText; titleCell->setColor(functionNameColor); } } @@ -178,7 +178,7 @@ void ListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int Shared::FunctionListController::willDisplayExpressionCellAtIndex(cell, j); FunctionExpressionCell * myCell = (FunctionExpressionCell *)cell; ExpiringPointer f = modelStore()->modelForRecord(modelStore()->recordAtIndex(j)); - KDColor textColor = f->isActive() ? Palette::PrimaryText : Palette::SecondaryText; + KDColor textColor = f->isActive() ? *Palette::PrimaryText : *Palette::SecondaryText; myCell->setTextColor(textColor); } diff --git a/apps/graph/list/text_field_with_max_length_and_extension.h b/apps/graph/list/text_field_with_max_length_and_extension.h index a5da2f1af..0c68449cf 100644 --- a/apps/graph/list/text_field_with_max_length_and_extension.h +++ b/apps/graph/list/text_field_with_max_length_and_extension.h @@ -17,8 +17,8 @@ public: const KDFont * size = KDFont::LargeFont, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, - KDColor textColor = Palette::PrimaryText, - KDColor backgroundColor = Palette::BackgroundHard) : + KDColor textColor = *Palette::PrimaryText, + KDColor backgroundColor = *Palette::BackgroundHard) : TextFieldWithExtension(extensionLength, parentResponder, textBuffer, textBufferSize, draftTextBufferSize, inputEventHandlerDelegate, delegate, size, horizontalAlignment, verticalAlignment, textColor, backgroundColor) {} void setDraftTextBufferSize(size_t size) { m_contentView.setDraftTextBufferSize(size); } }; diff --git a/apps/hardware_test/arrow_view.cpp b/apps/hardware_test/arrow_view.cpp index fbbb70339..1f14139b9 100644 --- a/apps/hardware_test/arrow_view.cpp +++ b/apps/hardware_test/arrow_view.cpp @@ -30,7 +30,7 @@ const uint8_t arrowDownMask[10][9] = { ArrowView::ArrowView() : m_directionIsUp(true), - m_color(Palette::PrimaryText) + m_color(*Palette::PrimaryText) { } @@ -50,7 +50,7 @@ void ArrowView::setColor(KDColor color) { void ArrowView::drawRect(KDContext * ctx, KDRect rect) const { KDColor arrowWorkingBuffer[10*9]; - ctx->fillRect(bounds(), Palette::BackgroundHard); + ctx->fillRect(bounds(), *Palette::BackgroundHard); KDCoordinate startLine = m_directionIsUp ? k_arrowHeight : 0; KDCoordinate startArrow = m_directionIsUp ? 0 : bounds().height()-k_arrowHeight; ctx->fillRect(KDRect((Ion::Display::Width-k_arrowThickness)/2, startLine, k_arrowThickness, bounds().height()-k_arrowHeight), m_color); diff --git a/apps/hardware_test/keyboard_view.cpp b/apps/hardware_test/keyboard_view.cpp index 9af6b9169..f7059537a 100644 --- a/apps/hardware_test/keyboard_view.cpp +++ b/apps/hardware_test/keyboard_view.cpp @@ -59,7 +59,7 @@ void KeyboardView::drawKey(int keyIndex, KDContext * ctx, KDRect rect) const { KDColor KeyboardView::keyColor(Ion::Keyboard::Key key) const { if (!m_keyboardModel.belongsToTestedKeysSubset(key)) { - return Palette::ListCellBorder; + return *Palette::ListCellBorder; } if (m_keyboardModel.testedKey() == key) { return KDColorBlue; diff --git a/apps/home/app_cell.cpp b/apps/home/app_cell.cpp index 777bc14f6..5a2563ab6 100644 --- a/apps/home/app_cell.cpp +++ b/apps/home/app_cell.cpp @@ -7,7 +7,7 @@ namespace Home { AppCell::AppCell() : HighlightCell(), - m_nameView(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::HomeCellText, Palette::HomeCellBackground), + m_nameView(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, *Palette::HomeCellText, *Palette::HomeCellBackground), m_backgroundView(nullptr), m_visible(true), m_external_app(false) { @@ -39,7 +39,7 @@ void AppCell::setExtAppDescriptor(const char* name, const uint8_t *icon, size_t m_iconView.setImage(icon, iconLength); m_iconView.setImage(nullptr); m_nameView.setText(name); - m_nameView.setTextColor(Palette::HomeCellTextExternal); + m_nameView.setTextColor(*Palette::HomeCellTextExternal); m_nameView.setMessage(I18n::Message::Default); layoutSubviews(); } @@ -49,7 +49,7 @@ void AppCell::setExtAppDescriptor(const char* name, const Image* icon) { m_iconView.setImage(icon); m_iconView.setImage(nullptr, 0); m_nameView.setText(name); - m_nameView.setTextColor(Palette::HomeCellTextExternal); + m_nameView.setTextColor(*Palette::HomeCellTextExternal); m_nameView.setMessage(I18n::Message::Default); layoutSubviews(); } @@ -59,7 +59,7 @@ void AppCell::setAppDescriptor(::App::Descriptor * descriptor) { m_iconView.setImage(descriptor->icon()); m_iconView.setImage(nullptr, 0); m_nameView.setMessage(descriptor->name()); - m_nameView.setTextColor(Palette::HomeCellText); + m_nameView.setTextColor(*Palette::HomeCellText); m_nameView.setText(nullptr); layoutSubviews(); } @@ -76,8 +76,8 @@ void AppCell::setBackgroundView(const BackgroundView * backgroundView) { } void AppCell::reloadCell() { - m_nameView.setTextColor(isHighlighted() ? (m_external_app ? Palette::HomeCellTextExternalActive : Palette::HomeCellTextActive) : (m_external_app ? Palette::HomeCellTextExternal : Palette::HomeCellText)); - m_nameView.setBackgroundColor(isHighlighted() ? Palette::HomeCellBackgroundActive : Palette::HomeCellBackground); + m_nameView.setTextColor(isHighlighted() ? (m_external_app ? *Palette::HomeCellTextExternalActive : *Palette::HomeCellTextActive) : (m_external_app ? *Palette::HomeCellTextExternal : *Palette::HomeCellText)); + m_nameView.setBackgroundColor(isHighlighted() ? *Palette::HomeCellBackgroundActive : *Palette::HomeCellBackground); } } diff --git a/apps/home/controller.cpp b/apps/home/controller.cpp index df725f10f..5152ac268 100644 --- a/apps/home/controller.cpp +++ b/apps/home/controller.cpp @@ -73,7 +73,7 @@ Controller::Controller(Responder * parentResponder, SelectableTableViewDataSourc m_cells[i].setBackgroundView(m_view.backgroundView()); } - m_view.backgroundView()->setDefaultColor(Palette::HomeBackground); + m_view.backgroundView()->setDefaultColor(*Palette::HomeBackground); #ifdef HOME_DISPLAY_EXTERNALS diff --git a/apps/lock_view.cpp b/apps/lock_view.cpp index 7f832da8c..da51a982d 100644 --- a/apps/lock_view.cpp +++ b/apps/lock_view.cpp @@ -15,7 +15,7 @@ const uint8_t lockMask[LockView::k_lockHeight][LockView::k_lockWidth] = { void LockView::drawRect(KDContext * ctx, KDRect rect) const { KDRect frame((bounds().width() - k_lockWidth)/2, (bounds().height()-k_lockHeight)/2, k_lockWidth, k_lockHeight); KDColor lockWorkingBuffer[LockView::k_lockHeight*LockView::k_lockWidth]; - ctx->blendRectWithMask(frame, Palette::ToolbarText, (const uint8_t *)lockMask, lockWorkingBuffer); + ctx->blendRectWithMask(frame, *Palette::ToolbarText, (const uint8_t *)lockMask, lockWorkingBuffer); } KDSize LockView::minimalSizeForOptimalDisplay() const { diff --git a/apps/math_variable_box_empty_controller.cpp b/apps/math_variable_box_empty_controller.cpp index 88a306fbc..07ff8c5a4 100644 --- a/apps/math_variable_box_empty_controller.cpp +++ b/apps/math_variable_box_empty_controller.cpp @@ -5,7 +5,7 @@ MathVariableBoxEmptyController::MathVariableBoxEmptyView::MathVariableBoxEmptyView() : ModalViewEmptyView(), - m_layoutExample(0.5f, 0.5f, Palette::PrimaryText, Palette::WallScreen) + m_layoutExample(0.5f, 0.5f, *Palette::PrimaryText, *Palette::WallScreen) { initMessageViews(); } diff --git a/apps/on_boarding/logo_view.cpp b/apps/on_boarding/logo_view.cpp index 2bc4867b9..7029a1872 100644 --- a/apps/on_boarding/logo_view.cpp +++ b/apps/on_boarding/logo_view.cpp @@ -11,7 +11,7 @@ LogoView::LogoView() : } void LogoView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(bounds(), Palette::BackgroundHard); + ctx->fillRect(bounds(), *Palette::BackgroundHard); } int LogoView::numberOfSubviews() const { diff --git a/apps/on_boarding/prompt_controller.cpp b/apps/on_boarding/prompt_controller.cpp index 773a77041..9cf786aa1 100644 --- a/apps/on_boarding/prompt_controller.cpp +++ b/apps/on_boarding/prompt_controller.cpp @@ -4,7 +4,7 @@ namespace OnBoarding { -PromptController::MessageViewWithSkip::MessageViewWithSkip(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages) : +PromptController::MessageViewWithSkip::MessageViewWithSkip(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages) : MessageView(messages, fgcolors, bgcolors, numberOfMessages), m_skipView(KDFont::SmallFont, I18n::Message::Skip, 1.0f, 0.5f), m_okView() @@ -42,7 +42,7 @@ void PromptController::MessageViewWithSkip::layoutSubviews(bool force) { m_okView.setFrame(KDRect(width - okSize.width()-k_okMargin, height-okSize.height()-k_okMargin, okSize), force); } -PromptController::PromptController(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages) : +PromptController::PromptController(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages) : ViewController(nullptr), m_messageViewWithSkip(messages, fgcolors, bgcolors, numberOfMessages) { diff --git a/apps/on_boarding/prompt_controller.h b/apps/on_boarding/prompt_controller.h index eb251868b..b1602bb6f 100644 --- a/apps/on_boarding/prompt_controller.h +++ b/apps/on_boarding/prompt_controller.h @@ -10,13 +10,13 @@ namespace OnBoarding { class PromptController : public ViewController { public: - PromptController(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages); + PromptController(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages); View * view() override { return &m_messageViewWithSkip; } bool handleEvent(Ion::Events::Event event) override; private: class MessageViewWithSkip : public MessageView { public: - MessageViewWithSkip(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages); + MessageViewWithSkip(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages); protected: int numberOfSubviews() const override; View * subviewAtIndex(int index) override; diff --git a/apps/probability/app.cpp b/apps/probability/app.cpp index 56fe17b42..43d27940f 100644 --- a/apps/probability/app.cpp +++ b/apps/probability/app.cpp @@ -85,11 +85,11 @@ App::App(Snapshot * snapshot) : { switch (snapshot->activePage()) { case Snapshot::Page::Parameters: - m_stackViewController.push(&m_parametersController, Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder); + m_stackViewController.push(&m_parametersController, *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder); break; case Snapshot::Page::Calculations: - m_stackViewController.push(&m_parametersController, Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder); - m_stackViewController.push(&m_calculationController, Palette::BannerSecondText, Palette::BannerSecondBackground, Palette::BannerSecondBorder); + m_stackViewController.push(&m_parametersController, *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder); + m_stackViewController.push(&m_calculationController, *Palette::BannerSecondText, *Palette::BannerSecondBackground, *Palette::BannerSecondBorder); default: break; } diff --git a/apps/probability/calculation_cell.cpp b/apps/probability/calculation_cell.cpp index 3c2b3dc36..2b079e48c 100644 --- a/apps/probability/calculation_cell.cpp +++ b/apps/probability/calculation_cell.cpp @@ -38,10 +38,10 @@ KDSize CalculationCell::minimalSizeForOptimalDisplay() const { } void CalculationCell::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(bounds(), Palette::BackgroundHard); + ctx->fillRect(bounds(), *Palette::BackgroundHard); if (m_isResponder) { KDSize textSize = m_text.minimalSizeForOptimalDisplay(); - ctx->strokeRect(KDRect(2*k_margin+textSize.width(), 0, calculationCellWidth()+2*ResponderImageCell::k_outline, ImageCell::k_height+2*ResponderImageCell::k_outline), Palette::ProbabilityCellBorder); + ctx->strokeRect(KDRect(2*k_margin+textSize.width(), 0, calculationCellWidth()+2*ResponderImageCell::k_outline, ImageCell::k_height+2*ResponderImageCell::k_outline), *Palette::ProbabilityCellBorder); } } diff --git a/apps/probability/calculation_controller.cpp b/apps/probability/calculation_controller.cpp index 2d4ddd1b6..a291afb56 100644 --- a/apps/probability/calculation_controller.cpp +++ b/apps/probability/calculation_controller.cpp @@ -26,7 +26,7 @@ namespace Probability { constexpr int CalculationController::k_titleBufferSize; CalculationController::ContentView::ContentView(SelectableTableView * selectableTableView, Distribution * distribution, Calculation * calculation) : - m_titleView(KDFont::SmallFont, I18n::Message::ComputeProbability, 0.5f, 0.5f, Palette::SecondaryText, Palette::BackgroundApps), + m_titleView(KDFont::SmallFont, I18n::Message::ComputeProbability, 0.5f, 0.5f, *Palette::SecondaryText, *Palette::BackgroundApps), m_selectableTableView(selectableTableView), m_distributionCurveView(distribution, calculation) { @@ -68,7 +68,7 @@ CalculationController::CalculationController(Responder * parentResponder, InputE m_selectableTableView.setMargins(k_tableMargin); m_selectableTableView.setVerticalCellOverlap(0); m_selectableTableView.setDecoratorType(ScrollView::Decorator::Type::None); - m_selectableTableView.setBackgroundColor(Palette::BackgroundHard); + m_selectableTableView.setBackgroundColor(*Palette::BackgroundHard); for (int i = 0; i < k_numberOfCalculationCells; i++) { diff --git a/apps/probability/cell.cpp b/apps/probability/cell.cpp index 1c36ae1a2..37f339552 100644 --- a/apps/probability/cell.cpp +++ b/apps/probability/cell.cpp @@ -5,7 +5,7 @@ namespace Probability { Cell::Cell() : HighlightCell(), - m_labelView(KDFont::LargeFont, (I18n::Message)0, 0, 0.5, Palette::PrimaryText, Palette::BackgroundHard), + m_labelView(KDFont::LargeFont, (I18n::Message)0, 0, 0.5, *Palette::PrimaryText, *Palette::BackgroundHard), m_icon(nullptr), m_focusedIcon(nullptr) { @@ -36,7 +36,7 @@ void Cell::layoutSubviews(bool force) { void Cell::reloadCell() { HighlightCell::reloadCell(); - KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_labelView.setBackgroundColor(backgroundColor); if (isHighlighted()) { m_iconView.setImage(m_focusedIcon); @@ -57,12 +57,12 @@ void Cell::setImage(const Image * image, const Image * focusedImage) { void Cell::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate width = bounds().width(); KDCoordinate height = bounds().height(); - KDColor backgroundColor = isHighlighted() ? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = isHighlighted() ? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; ctx->fillRect(KDRect(1, 1, width-2, height-1), backgroundColor); - ctx->fillRect(KDRect(0, 0, width, 1), Palette::ProbabilityCellBorder); - ctx->fillRect(KDRect(0, 1, 1, height-1), Palette::ProbabilityCellBorder); - ctx->fillRect(KDRect(width-1, 1, 1, height-1), Palette::ProbabilityCellBorder); - ctx->fillRect(KDRect(0, height-1, width, 1), Palette::ProbabilityCellBorder); + ctx->fillRect(KDRect(0, 0, width, 1), *Palette::ProbabilityCellBorder); + ctx->fillRect(KDRect(0, 1, 1, height-1), *Palette::ProbabilityCellBorder); + ctx->fillRect(KDRect(width-1, 1, 1, height-1), *Palette::ProbabilityCellBorder); + ctx->fillRect(KDRect(0, height-1, width, 1), *Palette::ProbabilityCellBorder); } } diff --git a/apps/probability/distribution_controller.cpp b/apps/probability/distribution_controller.cpp index dedbd4d29..bddd6ac70 100644 --- a/apps/probability/distribution_controller.cpp +++ b/apps/probability/distribution_controller.cpp @@ -90,7 +90,7 @@ bool Probability::DistributionController::handleEvent(Ion::Events::Event event) if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) { StackViewController * stack = (StackViewController *)parentResponder(); setDistributionAccordingToIndex(selectedRow()); - stack->push(m_parametersController, Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder); + stack->push(m_parametersController, *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder); return true; } return false; diff --git a/apps/probability/distribution_controller.h b/apps/probability/distribution_controller.h index 78b0c7c4a..860f48aac 100644 --- a/apps/probability/distribution_controller.h +++ b/apps/probability/distribution_controller.h @@ -26,7 +26,7 @@ private: class ContentView : public View { public: ContentView(SelectableTableView * selectableTableView) : - m_titleView(KDFont::SmallFont, I18n::Message::ChooseDistribution, 0.5f, 0.5f, Palette::SecondaryText, Palette::BackgroundApps), + m_titleView(KDFont::SmallFont, I18n::Message::ChooseDistribution, 0.5f, 0.5f, *Palette::SecondaryText, *Palette::BackgroundApps), m_selectableTableView(selectableTableView) {} constexpr static KDCoordinate k_titleMargin = 8; diff --git a/apps/probability/distribution_curve_view.cpp b/apps/probability/distribution_curve_view.cpp index 4cf8cf407..4582b233b 100644 --- a/apps/probability/distribution_curve_view.cpp +++ b/apps/probability/distribution_curve_view.cpp @@ -6,7 +6,7 @@ using namespace Shared; namespace Probability { -constexpr KDColor DistributionCurveView::k_backgroundColor; +KDColor const * DistributionCurveView::k_backgroundColor = Palette::BackgroundApps; void DistributionCurveView::reload() { CurveView::reload(); @@ -16,9 +16,9 @@ void DistributionCurveView::reload() { void DistributionCurveView::drawRect(KDContext * ctx, KDRect rect) const { float lowerBound = m_calculation->lowerBound(); float upperBound = m_calculation->upperBound(); - ctx->fillRect(bounds(), k_backgroundColor); + ctx->fillRect(bounds(), *k_backgroundColor); drawAxis(ctx, rect, Axis::Horizontal); - drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, false, false, 0, k_backgroundColor); + drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, false, false, 0, *k_backgroundColor); if (m_distribution->type() == Distribution::Type::Normal) { /* Special case for the normal distribution, which has always the same curve * We indicate the pixels from and to which we color under the curve, not @@ -29,9 +29,9 @@ void DistributionCurveView::drawRect(KDContext * ctx, KDRect rect) const { return; } if (m_distribution->isContinuous()) { - drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, m_distribution, nullptr, Palette::ProbabilityCurve, true, true, lowerBound, upperBound); + drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, m_distribution, nullptr, *Palette::ProbabilityCurve, true, true, lowerBound, upperBound); } else { - drawHistogram(ctx, rect, EvaluateAtAbscissa, m_distribution, nullptr, 0, 1, false, Palette::ProbabilityHistogramBar, Palette::ProbabilityCurve, lowerBound, upperBound+0.5f); + drawHistogram(ctx, rect, EvaluateAtAbscissa, m_distribution, nullptr, 0, 1, false, *Palette::ProbabilityHistogramBar, *Palette::ProbabilityCurve, lowerBound, upperBound+0.5f); } } @@ -59,7 +59,7 @@ void DistributionCurveView::drawStandardNormal(KDContext * ctx, KDRect rect, flo // Draw a centered reduced normal curve NormalDistribution n; constCastedThis->setCurveViewRange(&n); - drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, &n, nullptr, Palette::ProbabilityCurve, true, true, pixelToFloat(Axis::Horizontal, colorLowerBoundPixel), pixelToFloat(Axis::Horizontal, colorUpperBoundPixel)); + drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, &n, nullptr, *Palette::ProbabilityCurve, true, true, pixelToFloat(Axis::Horizontal, colorLowerBoundPixel), pixelToFloat(Axis::Horizontal, colorUpperBoundPixel)); // Put back the previous curve view range constCastedThis->setCurveViewRange(previousRange); diff --git a/apps/probability/distribution_curve_view.h b/apps/probability/distribution_curve_view.h index e1288c3be..06721d077 100644 --- a/apps/probability/distribution_curve_view.h +++ b/apps/probability/distribution_curve_view.h @@ -30,7 +30,7 @@ protected: private: static float EvaluateAtAbscissa(float abscissa, void * model, void * context); static Poincare::Coordinate2D EvaluateXYAtAbscissa(float abscissa, void * model, void * context); - static constexpr KDColor k_backgroundColor = Palette::BackgroundApps; + static KDColor const * k_backgroundColor; void drawStandardNormal(KDContext * ctx, KDRect rect, float colorLowerBound, float colorUpperBound) const; char m_labels[k_maxNumberOfXLabels][k_labelBufferMaxSize]; Distribution * m_distribution; diff --git a/apps/probability/parameters_controller.cpp b/apps/probability/parameters_controller.cpp index f3372dbe0..68757290a 100644 --- a/apps/probability/parameters_controller.cpp +++ b/apps/probability/parameters_controller.cpp @@ -8,16 +8,16 @@ namespace Probability { ParametersController::ContentView::ContentView(SelectableTableView * selectableTableView) : m_numberOfParameters(1), - m_titleView(KDFont::SmallFont, I18n::Message::ChooseParameters, 0.5f, 0.5f, Palette::SecondaryText, Palette::BackgroundApps), - m_firstParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps), - m_secondParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps), + m_titleView(KDFont::SmallFont, I18n::Message::ChooseParameters, 0.5f, 0.5f, *Palette::SecondaryText, *Palette::BackgroundApps), + m_firstParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps), + m_secondParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps), m_selectableTableView(selectableTableView) { } void ParametersController::ContentView::drawRect(KDContext * ctx, KDRect rect) const { int tableHeight = m_selectableTableView->minimalSizeForOptimalDisplay().height(); - ctx->fillRect(KDRect(0, tableHeight, bounds().width(), bounds().height() - tableHeight), Palette::BackgroundApps); + ctx->fillRect(KDRect(0, tableHeight, bounds().width(), bounds().height() - tableHeight), *Palette::BackgroundApps); } MessageTextView * ParametersController::ContentView::parameterDefinitionAtIndex(int index) { @@ -161,7 +161,7 @@ bool ParametersController::textFieldDidFinishEditing(TextField * textField, cons void ParametersController::buttonAction() { StackViewController * stack = stackController(); - stack->push(m_calculationController, Palette::BannerSecondText, Palette::BannerSecondBackground, Palette::BannerSecondBorder); + stack->push(m_calculationController, *Palette::BannerSecondText, *Palette::BannerSecondBackground, *Palette::BannerSecondBorder); } } diff --git a/apps/probability/responder_image_cell.cpp b/apps/probability/responder_image_cell.cpp index f9079077e..7b2691a85 100644 --- a/apps/probability/responder_image_cell.cpp +++ b/apps/probability/responder_image_cell.cpp @@ -11,8 +11,8 @@ ResponderImageCell::ResponderImageCell(Responder * parentResponder, Distribution } void ResponderImageCell::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(bounds(), Palette::BackgroundHard); - ctx->strokeRect(KDRect(0, 0, ImageCell::k_width+2*k_outline, ImageCell::k_height+2*k_outline), Palette::ProbabilityCellBorder); + ctx->fillRect(bounds(), *Palette::BackgroundHard); + ctx->strokeRect(KDRect(0, 0, ImageCell::k_width+2*k_outline, ImageCell::k_height+2*k_outline), *Palette::ProbabilityCellBorder); } KDSize ResponderImageCell::minimalSizeForOptimalDisplay() const { diff --git a/apps/reader/read_book_controller.cpp b/apps/reader/read_book_controller.cpp index 622389a98..6e96b2eff 100644 --- a/apps/reader/read_book_controller.cpp +++ b/apps/reader/read_book_controller.cpp @@ -55,7 +55,7 @@ void ReadBookController::loadPosition() { else { m_readerView.setBookSave({ 0, - Palette::PrimaryText + *Palette::PrimaryText }); } } diff --git a/apps/reader/word_wrap_view.cpp b/apps/reader/word_wrap_view.cpp index 49ea133ab..493bb7f92 100644 --- a/apps/reader/word_wrap_view.cpp +++ b/apps/reader/word_wrap_view.cpp @@ -243,7 +243,7 @@ void WordWrapTextView::setBookSave(BookSave save) { bool WordWrapTextView::updateTextColorForward(const char * colorStart) const { if (*(colorStart + 1) == '\\') { - m_textColor = Palette::PrimaryText; + m_textColor = *Palette::PrimaryText; return (*(colorStart + 3) == '%' || *(colorStart + 4) == '%'); } @@ -254,56 +254,56 @@ bool WordWrapTextView::updateTextColorForward(const char * colorStart) const { { case 'r': if (*(colorStart+2) == 'l') { - m_textColor = Palette::RedLight; + m_textColor = *Palette::RedLight; keySize = 2; } else { - m_textColor = Palette::Red; + m_textColor = *Palette::Red; } break; case 'm': - m_textColor = Palette::Magenta; + m_textColor = *Palette::Magenta; break; case 't': - m_textColor = Palette::Turquoise; + m_textColor = *Palette::Turquoise; break; case 'p': if (*(colorStart+2) == 'k') { - m_textColor = Palette::Pink; + m_textColor = *Palette::Pink; keySize = 2; } else if (*(colorStart+2) == 'p') { - m_textColor = Palette::Purple; + m_textColor = *Palette::Purple; keySize = 2; } break; case 'b': if (*(colorStart+2) == 'r') { - m_textColor = Palette::Brown; + m_textColor = *Palette::Brown; keySize = 2; } if (*(colorStart+2) == 'l') { - m_textColor = Palette::BlueLight; + m_textColor = *Palette::BlueLight; keySize = 2; } else { - m_textColor = Palette::Blue; + m_textColor = *Palette::Blue; } break; case 'o': - m_textColor = Palette::Orange; + m_textColor = *Palette::Orange; break; case 'g': if (*(colorStart+2) == 'l') { - m_textColor = Palette::GreenLight; + m_textColor = *Palette::GreenLight; keySize = 2; } else { - m_textColor = Palette::Green; + m_textColor = *Palette::Green; } break; case 'c': - m_textColor = Palette::Cyan; + m_textColor = *Palette::Cyan; break; default: @@ -330,56 +330,56 @@ bool WordWrapTextView::updateTextColorBackward(const char * colorStart) const { { case 'r': if (*(colorStart+2) == 'l') { - m_textColor = Palette::RedLight; + m_textColor = *Palette::RedLight; keySize = 2; } else { - m_textColor = Palette::Red; + m_textColor = *Palette::Red; } break; case 'm': - m_textColor = Palette::Magenta; + m_textColor = *Palette::Magenta; break; case 't': - m_textColor = Palette::Turquoise; + m_textColor = *Palette::Turquoise; break; case 'p': if (*(colorStart+2) == 'k') { - m_textColor = Palette::Pink; + m_textColor = *Palette::Pink; keySize = 2; } else if (*(colorStart+2) == 'p') { - m_textColor = Palette::Purple; + m_textColor = *Palette::Purple; keySize = 2; } break; case 'b': if (*(colorStart+2) == 'r') { - m_textColor = Palette::Brown; + m_textColor = *Palette::Brown; keySize = 2; } if (*(colorStart+2) == 'l') { - m_textColor = Palette::BlueLight; + m_textColor = *Palette::BlueLight; keySize = 2; } else { - m_textColor = Palette::Blue; + m_textColor = *Palette::Blue; } break; case 'o': - m_textColor = Palette::Orange; + m_textColor = *Palette::Orange; break; case 'g': if (*(colorStart+2) == 'l') { - m_textColor = Palette::GreenLight; + m_textColor = *Palette::GreenLight; keySize = 2; } else { - m_textColor = Palette::Green; + m_textColor = *Palette::Green; } break; case 'c': - m_textColor = Palette::Cyan; + m_textColor = *Palette::Cyan; break; default: diff --git a/apps/regression/calculation_controller.cpp b/apps/regression/calculation_controller.cpp index 14b68c105..2229d6269 100644 --- a/apps/regression/calculation_controller.cpp +++ b/apps/regression/calculation_controller.cpp @@ -26,18 +26,18 @@ CalculationController::CalculationController(Responder * parentResponder, Button { m_r2Layout = HorizontalLayout::Builder(CodePointLayout::Builder('r', KDFont::SmallFont), VerticalOffsetLayout::Builder(CodePointLayout::Builder('2', KDFont::SmallFont), VerticalOffsetLayoutNode::Position::Superscript)); m_selectableTableView.setVerticalCellOverlap(0); - m_selectableTableView.setBackgroundColor(Palette::BackgroundAppsSecondary); + m_selectableTableView.setBackgroundColor(*Palette::BackgroundAppsSecondary); m_selectableTableView.setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin); m_r2TitleCell.setAlignment(1.0f, 0.5f); for (int i = 0; i < Store::k_numberOfSeries; i++) { m_columnTitleCells[i].setParentResponder(&m_selectableTableView); } for (int i = 0; i < k_numberOfDoubleCalculationCells; i++) { - m_doubleCalculationCells[i].setTextColor(Palette::SecondaryText); + m_doubleCalculationCells[i].setTextColor(*Palette::SecondaryText); m_doubleCalculationCells[i].setParentResponder(&m_selectableTableView); } for (int i = 0; i < k_numberOfCalculationCells;i++) { - m_calculationCells[i].setTextColor(Palette::SecondaryText); + m_calculationCells[i].setTextColor(*Palette::SecondaryText); } for (int i = 0; i < k_maxNumberOfDisplayableRows; i++) { m_titleCells[i].setMessageFont(KDFont::SmallFont); @@ -167,7 +167,7 @@ void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int buffer[0] = 'Y'; myCell->setSecondText(buffer); assert(seriesNumber < Palette::numberOfDataColors()); - myCell->setColor(Palette::DataColor[seriesNumber]); + myCell->setColor(*Palette::DataColor[seriesNumber]); return; } diff --git a/apps/regression/column_title_cell.h b/apps/regression/column_title_cell.h index d0a14ca49..f207b63c2 100644 --- a/apps/regression/column_title_cell.h +++ b/apps/regression/column_title_cell.h @@ -9,7 +9,7 @@ class ColumnTitleCell : public EvenOddDoubleBufferTextCellWithSeparator { public: ColumnTitleCell(Responder * parentResponder = nullptr) : EvenOddDoubleBufferTextCellWithSeparator(parentResponder, 0.5f, 0.5f), - m_functionColor(Palette::Red) + m_functionColor(*Palette::Red) { } virtual void setColor(KDColor color); diff --git a/apps/regression/graph_controller.cpp b/apps/regression/graph_controller.cpp index 48cfd4a42..598334ee3 100644 --- a/apps/regression/graph_controller.cpp +++ b/apps/regression/graph_controller.cpp @@ -391,7 +391,7 @@ void GraphController::setRoundCrossCursorView() { if (round) { // Set the color although the cursor view stays round assert(*m_selectedSeriesIndex < Palette::numberOfDataColors()); - m_roundCursorView.setColor(Palette::DataColor[*m_selectedSeriesIndex]); + m_roundCursorView.setColor(*Palette::DataColor[*m_selectedSeriesIndex]); } CursorView * nextCursorView = round ? static_cast(&m_roundCursorView) : static_cast(&m_crossCursorView); // Escape if the cursor view stays the same diff --git a/apps/regression/graph_view.cpp b/apps/regression/graph_view.cpp index fb2987e15..e57d3239d 100644 --- a/apps/regression/graph_view.cpp +++ b/apps/regression/graph_view.cpp @@ -15,7 +15,7 @@ GraphView::GraphView(Store * store, CurveViewCursor * cursor, BannerView * banne } void GraphView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(rect, Palette::BackgroundHard); + ctx->fillRect(rect, *Palette::BackgroundHard); drawGrid(ctx, rect); drawAxes(ctx, rect); simpleDrawBothAxesLabels(ctx, rect); @@ -23,7 +23,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const { for (int series = 0; series < Store::k_numberOfSeries; series++) { if (!m_store->seriesIsEmpty(series)) { assert(series < Palette::numberOfDataColors()); - KDColor color = Palette::DataColor[series]; + KDColor color = *Palette::DataColor[series]; Model * seriesModel = m_store->modelForSeries(series); drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, [](float abscissa, void * model, void * context) { Model * regressionModel = static_cast(model); @@ -35,7 +35,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const { drawDot(ctx, rect, m_store->get(series, 0, index), m_store->get(series, 1, index), color); } drawDot(ctx, rect, m_store->meanOfColumn(series, 0), m_store->meanOfColumn(series, 1), color, Size::Small); - drawDot(ctx, rect, m_store->meanOfColumn(series, 0), m_store->meanOfColumn(series, 1), Palette::BackgroundHard); + drawDot(ctx, rect, m_store->meanOfColumn(series, 0), m_store->meanOfColumn(series, 1), *Palette::BackgroundHard); } } } diff --git a/apps/regression/store_controller.cpp b/apps/regression/store_controller.cpp index 69293bf19..0ac6e5c99 100644 --- a/apps/regression/store_controller.cpp +++ b/apps/regression/store_controller.cpp @@ -38,7 +38,7 @@ void StoreController::willDisplayCellAtLocation(HighlightCell * cell, int i, int bool isValuesColumn = i%Store::k_numberOfColumnsPerSeries == 0; mytitleCell->setSeparatorLeft(isValuesColumn && i > 0); int seriesIndex = i/Store::k_numberOfColumnsPerSeries; - mytitleCell->setColor(m_store->numberOfPairsOfSeries(seriesIndex) == 0 ? Palette::SecondaryText : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GreyDark with graph/list_controller and statistics/store_controller + mytitleCell->setColor(m_store->numberOfPairsOfSeries(seriesIndex) == 0 ? *Palette::SecondaryText : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GreyDark with graph/list_controller and statistics/store_controller char name[] = {isValuesColumn ? 'X' : 'Y', static_cast('1' + seriesIndex), 0}; mytitleCell->setText(name); } diff --git a/apps/sequence/graph/graph_view.cpp b/apps/sequence/graph/graph_view.cpp index 3f71d92a5..7c5f06fc2 100644 --- a/apps/sequence/graph/graph_view.cpp +++ b/apps/sequence/graph/graph_view.cpp @@ -30,7 +30,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const { } drawDot(ctx, rect, x, y, s->color()); if (x >= m_highlightedStart && x <= m_highlightedEnd && record == m_selectedRecord) { - KDColor color = m_shouldColorHighlighted ? s->color() : Palette::PrimaryText; + KDColor color = m_shouldColorHighlighted ? s->color() : *Palette::PrimaryText; if (y >= 0.0f) { drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, x, 0.0f, y, color, 1); } else { diff --git a/apps/sequence/list/list_controller.cpp b/apps/sequence/list/list_controller.cpp index 56f78b1d3..bb51746f0 100644 --- a/apps/sequence/list/list_controller.cpp +++ b/apps/sequence/list/list_controller.cpp @@ -15,7 +15,7 @@ ListController::ListController(Responder * parentResponder, ::InputEventHandlerD m_expressionCells{}, m_parameterController(inputEventHandlerDelegate, this), m_typeParameterController(this, this, TableCell::Layout::Vertical), - m_typeStackController(nullptr, &m_typeParameterController, Palette::ToolboxHeaderText, Palette::ToolboxHeaderBackground, Palette::ToolboxHeaderBorder), + m_typeStackController(nullptr, &m_typeParameterController, *Palette::ToolboxHeaderText, *Palette::ToolboxHeaderBackground, *Palette::ToolboxHeaderBorder), m_sequenceToolbox() { for (int i = 0; i < k_maxNumberOfRows; i++) { @@ -191,7 +191,7 @@ void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) { myCell->setLayout(sequence->secondInitialConditionName()); } // Set the color - KDColor nameColor = sequence->isActive() ? sequence->color() : Palette::SecondaryText; + KDColor nameColor = sequence->isActive() ? sequence->color() : *Palette::SecondaryText; myCell->setColor(nameColor); } @@ -209,7 +209,7 @@ void ListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int myCell->setLayout(sequence->secondInitialConditionLayout()); } bool active = sequence->isActive(); - KDColor textColor = active ? Palette::PrimaryText : Palette::SecondaryText; + KDColor textColor = active ? *Palette::PrimaryText : *Palette::SecondaryText; myCell->setTextColor(textColor); } diff --git a/apps/settings/cell_with_separator.cpp b/apps/settings/cell_with_separator.cpp index 8e8bb17b8..3f4094bc6 100644 --- a/apps/settings/cell_with_separator.cpp +++ b/apps/settings/cell_with_separator.cpp @@ -8,7 +8,7 @@ void CellWithSeparator::setHighlighted(bool highlight) { } void CellWithSeparator::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(KDRect(0, Metric::CellSeparatorThickness, bounds().width(), k_margin), Palette::BackgroundApps); + ctx->fillRect(KDRect(0, Metric::CellSeparatorThickness, bounds().width(), k_margin), *Palette::BackgroundApps); } int CellWithSeparator::numberOfSubviews() const { diff --git a/apps/settings/sub_menu/about_controller.cpp b/apps/settings/sub_menu/about_controller.cpp index bf798b88b..d2f55dc83 100644 --- a/apps/settings/sub_menu/about_controller.cpp +++ b/apps/settings/sub_menu/about_controller.cpp @@ -29,7 +29,7 @@ AboutController::AboutController(Responder * parentResponder) : for (int i = 0; i < k_totalNumberOfCell; i++) { m_cells[i].setMessageFont(KDFont::LargeFont); m_cells[i].setAccessoryFont(KDFont::SmallFont); - m_cells[i].setAccessoryTextColor(Palette::SecondaryText); + m_cells[i].setAccessoryTextColor(*Palette::SecondaryText); } } diff --git a/apps/settings/sub_menu/contributors_controller.cpp b/apps/settings/sub_menu/contributors_controller.cpp index 26bab3326..3d24e8294 100644 --- a/apps/settings/sub_menu/contributors_controller.cpp +++ b/apps/settings/sub_menu/contributors_controller.cpp @@ -9,7 +9,7 @@ ContributorsController::ContributorsController(Responder * parentResponder) : for (int i = 0; i < k_totalNumberOfCell; i++) { m_cells[i].setMessageFont(KDFont::LargeFont); m_cells[i].setAccessoryFont(KDFont::SmallFont); - m_cells[i].setAccessoryTextColor(Palette::SecondaryText); + m_cells[i].setAccessoryTextColor(*Palette::SecondaryText); } } @@ -64,15 +64,15 @@ void ContributorsController::willDisplayCellForIndex(HighlightCell * cell, int i myTextCell->setTextColor(KDColor::RGB24(0xC03535)); } else if (index > 0 && index <= s_numberOfDevelopers) { myTextCell->setAccessoryText(I18n::translate(s_developersUsernames[index - 1])); - myTextCell->setTextColor(Palette::PrimaryText); + myTextCell->setTextColor(*Palette::PrimaryText); } else if (index == s_numberOfDevelopers + 1) { myTextCell->setAccessoryText(""); myTextCell->setTextColor(KDColor::RGB24(0x1ABC9A)); } else { myTextCell->setAccessoryText(I18n::translate(s_betaTestersUsernames[index - 2 - s_numberOfDevelopers])); - myTextCell->setTextColor(Palette::PrimaryText); + myTextCell->setTextColor(*Palette::PrimaryText); } - myTextCell->setAccessoryTextColor(Palette::SecondaryText); + myTextCell->setAccessoryTextColor(*Palette::SecondaryText); GenericSubController::willDisplayCellForIndex(cell, index); } diff --git a/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.cpp b/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.cpp index d4685cfe1..aa384dc90 100644 --- a/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.cpp +++ b/apps/settings/sub_menu/message_table_cell_with_editable_text_with_separator.cpp @@ -14,8 +14,8 @@ void MessageTableCellWithEditableTextWithSeparator::setHighlighted(bool highligh } void MessageTableCellWithEditableTextWithSeparator::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), Palette::ListCellBorder); - ctx->fillRect(KDRect(0, k_separatorThickness, bounds().width(), k_margin-k_separatorThickness), Palette::BackgroundApps); + ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), *Palette::ListCellBorder); + ctx->fillRect(KDRect(0, k_separatorThickness, bounds().width(), k_margin-k_separatorThickness), *Palette::BackgroundApps); } int MessageTableCellWithEditableTextWithSeparator::numberOfSubviews() const { diff --git a/apps/settings/sub_menu/selectable_view_with_messages.cpp b/apps/settings/sub_menu/selectable_view_with_messages.cpp index 8e64acce4..7af3b6c01 100644 --- a/apps/settings/sub_menu/selectable_view_with_messages.cpp +++ b/apps/settings/sub_menu/selectable_view_with_messages.cpp @@ -14,12 +14,12 @@ SelectableViewWithMessages::SelectableViewWithMessages(SelectableTableView * sel for (int i = 0; i < k_maxNumberOfLines; i++) { m_messageLines[i].setFont(KDFont::SmallFont); m_messageLines[i].setAlignment(0.5f, 0.5f); - m_messageLines[i].setBackgroundColor(Palette::BackgroundApps); + m_messageLines[i].setBackgroundColor(*Palette::BackgroundApps); } } void SelectableViewWithMessages::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(bounds(), Palette::BackgroundApps); + ctx->fillRect(bounds(), *Palette::BackgroundApps); } void SelectableViewWithMessages::setMessages(I18n::Message * m, int numberOfMessages) { diff --git a/apps/shared/banner_view.h b/apps/shared/banner_view.h index b1ad6e5fc..840c3a373 100644 --- a/apps/shared/banner_view.h +++ b/apps/shared/banner_view.h @@ -12,9 +12,9 @@ public: KDSize minimalSizeForOptimalDisplay() const override; KDCoordinate minimalHeightForOptimalDisplayGivenWidth(KDCoordinate width) const; void reload() { layoutSubviews(); } - static constexpr const KDFont * Font() { return KDFont::SmallFont; } - static constexpr KDColor TextColor() { return Palette::PrimaryText; } - static constexpr KDColor BackgroundColor() { return Palette::SubMenuBackground; } + static const KDFont * Font() { return KDFont::SmallFont; } + static const KDColor TextColor() { return *Palette::PrimaryText; } + static const KDColor BackgroundColor() { return *Palette::SubMenuBackground; } private: static constexpr KDCoordinate LineSpacing = 2; int numberOfSubviews() const override = 0; diff --git a/apps/shared/buffer_text_view_with_text_field.cpp b/apps/shared/buffer_text_view_with_text_field.cpp index e6740cb2f..0dda66630 100644 --- a/apps/shared/buffer_text_view_with_text_field.cpp +++ b/apps/shared/buffer_text_view_with_text_field.cpp @@ -24,18 +24,18 @@ void BufferTextViewWithTextField::drawRect(KDContext * ctx, KDRect rect) const { // Fill margins with white // Left margin - ctx->fillRect(KDRect(0, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), Palette::BackgroundHard); - ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), Palette::BackgroundHard); + ctx->fillRect(KDRect(0, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), *Palette::BackgroundHard); + ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), *Palette::BackgroundHard); // Right margin - ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), Palette::BackgroundHard); + ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), *Palette::BackgroundHard); // Above the text field - ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, 0, textFieldRect.width() + 2*k_borderWidth, bounds().height()), Palette::BackgroundHard); + ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, 0, textFieldRect.width() + 2*k_borderWidth, bounds().height()), *Palette::BackgroundHard); // Under the text field - ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, textFieldRect.bottom() + k_borderWidth, textFieldRect.width() + 2*k_borderWidth, bounds().height()), Palette::BackgroundHard); + ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, textFieldRect.bottom() + k_borderWidth, textFieldRect.width() + 2*k_borderWidth, bounds().height()), *Palette::BackgroundHard); // Draw the text field border KDRect borderRect = KDRect(textFieldRect.x()-k_borderWidth, textFieldRect.y()-k_borderWidth, textFieldRect.width()+2*k_borderWidth, textFieldRect.height()+2*k_borderWidth); - ctx->strokeRect(borderRect, Palette::ListCellBorder); + ctx->strokeRect(borderRect, *Palette::ListCellBorder); } void BufferTextViewWithTextField::didBecomeFirstResponder() { diff --git a/apps/shared/button_with_separator.cpp b/apps/shared/button_with_separator.cpp index 3b3d1b69f..58db27a98 100644 --- a/apps/shared/button_with_separator.cpp +++ b/apps/shared/button_with_separator.cpp @@ -1,22 +1,22 @@ #include "button_with_separator.h" ButtonWithSeparator::ButtonWithSeparator(Responder * parentResponder, I18n::Message message, Invocation invocation) : - Button(parentResponder, message, invocation, KDFont::LargeFont, Palette::ButtonText) + Button(parentResponder, message, invocation, KDFont::LargeFont, *Palette::ButtonText) { } void ButtonWithSeparator::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate width = bounds().width(); KDCoordinate height = bounds().height(); - ctx->fillRect(KDRect(0, 0, width, k_lineThickness), Palette::ListCellBorder); - ctx->fillRect(KDRect(0, k_lineThickness, width, k_margin-k_lineThickness), Palette::BackgroundApps); + ctx->fillRect(KDRect(0, 0, width, k_lineThickness), *Palette::ListCellBorder); + ctx->fillRect(KDRect(0, k_lineThickness, width, k_margin-k_lineThickness), *Palette::BackgroundApps); // Draw rectangle around cell - ctx->fillRect(KDRect(0, k_margin, width, k_lineThickness), Palette::ListCellBorder); - ctx->fillRect(KDRect(0, k_margin+k_lineThickness, k_lineThickness, height-k_margin), Palette::ListCellBorder); - ctx->fillRect(KDRect(width-k_lineThickness, k_lineThickness+k_margin, k_lineThickness, height-k_margin), Palette::ListCellBorder); - ctx->fillRect(KDRect(0, height-3*k_lineThickness, width, k_lineThickness), Palette::ButtonBorderOut); - ctx->fillRect(KDRect(0, height-2*k_lineThickness, width, k_lineThickness), Palette::ListCellBorder); - ctx->fillRect(KDRect(k_lineThickness, height-k_lineThickness, width-2*k_lineThickness, k_lineThickness), Palette::ButtonShadow); + ctx->fillRect(KDRect(0, k_margin, width, k_lineThickness), *Palette::ListCellBorder); + ctx->fillRect(KDRect(0, k_margin+k_lineThickness, k_lineThickness, height-k_margin), *Palette::ListCellBorder); + ctx->fillRect(KDRect(width-k_lineThickness, k_lineThickness+k_margin, k_lineThickness, height-k_margin), *Palette::ListCellBorder); + ctx->fillRect(KDRect(0, height-3*k_lineThickness, width, k_lineThickness), *Palette::ButtonBorderOut); + ctx->fillRect(KDRect(0, height-2*k_lineThickness, width, k_lineThickness), *Palette::ListCellBorder); + ctx->fillRect(KDRect(k_lineThickness, height-k_lineThickness, width-2*k_lineThickness, k_lineThickness), *Palette::ButtonShadow); } diff --git a/apps/shared/cursor_view.cpp b/apps/shared/cursor_view.cpp index 90886b81c..36b355cbc 100644 --- a/apps/shared/cursor_view.cpp +++ b/apps/shared/cursor_view.cpp @@ -5,8 +5,8 @@ namespace Shared { void CursorView::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate width = bounds().width(); KDCoordinate height = bounds().height(); - ctx->fillRect(KDRect((width-1)/2, 0, 1, height), Palette::PrimaryText); - ctx->fillRect(KDRect(0, (height-1)/2, width, 1), Palette::PrimaryText); + ctx->fillRect(KDRect((width-1)/2, 0, 1, height), *Palette::PrimaryText); + ctx->fillRect(KDRect(0, (height-1)/2, width, 1), *Palette::PrimaryText); } KDSize CursorView::minimalSizeForOptimalDisplay() const { diff --git a/apps/shared/curve_view.cpp b/apps/shared/curve_view.cpp index 25c22b796..7802acbf9 100644 --- a/apps/shared/curve_view.cpp +++ b/apps/shared/curve_view.cpp @@ -286,7 +286,7 @@ void CurveView::drawLabel(KDContext * ctx, KDRect rect, float xPosition, float y KDPoint position = positionLabel(xCoordinate, yCoordinate, labelSize, horizontalPosition, verticalPosition); if (rect.intersects(KDRect(position, labelSize))) { // TODO: should we blend? - ctx->drawString(label, position, k_font, color, Palette::BackgroundApps); + ctx->drawString(label, position, k_font, color, *Palette::BackgroundApps); } } @@ -369,7 +369,7 @@ void CurveView::drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis labelPosition, k_labelGraduationLength, 1); - ctx->fillRect(graduation, Palette::PrimaryText); + ctx->fillRect(graduation, *Palette::PrimaryText); } } @@ -414,7 +414,7 @@ void CurveView::drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis DrawLabel: if (rect.intersects(KDRect(position, textSize))) { - ctx->drawString(labelI, position, k_font, Palette::PrimaryText, backgroundColor); + ctx->drawString(labelI, position, k_font, *Palette::PrimaryText, backgroundColor); } } } @@ -557,8 +557,8 @@ void CurveView::drawArrow(KDContext * ctx, KDRect rect, float x, float y, float } void CurveView::drawGrid(KDContext * ctx, KDRect rect) const { - KDColor boldColor = Palette::GridPrimaryLine; - KDColor lightColor = Palette::GridSecondaryLine; + KDColor boldColor = *Palette::GridPrimaryLine; + KDColor lightColor = *Palette::GridSecondaryLine; drawGridLines(ctx, rect, Axis::Vertical, m_curveViewRange->xGridUnit(), boldColor, lightColor); drawGridLines(ctx, rect, Axis::Horizontal, m_curveViewRange->yGridUnit(), boldColor, lightColor); } @@ -569,7 +569,7 @@ void CurveView::drawAxes(KDContext * ctx, KDRect rect) const { } void CurveView::drawAxis(KDContext * ctx, KDRect rect, Axis axis) const { - drawLine(ctx, rect, axis, 0.0f, Palette::PrimaryText, 1); + drawLine(ctx, rect, axis, 0.0f, *Palette::PrimaryText, 1); } constexpr KDCoordinate thinCircleDiameter = 1; diff --git a/apps/shared/curve_view.h b/apps/shared/curve_view.h index 91e73c5b3..f773d4194 100644 --- a/apps/shared/curve_view.h +++ b/apps/shared/curve_view.h @@ -122,7 +122,7 @@ protected: }; // Draw the label at the above/below and to the left/right of the given position void drawLabel(KDContext * ctx, KDRect rect, float xPosition, float yPosition, const char * label, KDColor color, RelativePosition horizontalPosition, RelativePosition verticalPosition) const; - void drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis, bool shiftOrigin, bool graduationOnly = false, bool fixCoordinate = false, KDCoordinate fixedCoordinate = 0, KDColor backgroundColor = Palette::BackgroundHard) const; + void drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis, bool shiftOrigin, bool graduationOnly = false, bool fixCoordinate = false, KDCoordinate fixedCoordinate = 0, KDColor backgroundColor = *Palette::BackgroundHard) const; View * m_bannerView; CurveViewCursor * m_curveViewCursor; private: diff --git a/apps/shared/double_pair_store.h b/apps/shared/double_pair_store.h index 7ef5edb18..689ebafe8 100644 --- a/apps/shared/double_pair_store.h +++ b/apps/shared/double_pair_store.h @@ -56,12 +56,12 @@ public: static KDColor colorOfSeriesAtIndex(int i) { assert(i >= 0 && i < k_numberOfSeries); assert(i < Palette::numberOfDataColors()); - return Palette::DataColor[i]; + return *Palette::DataColor[i]; } static KDColor colorLightOfSeriesAtIndex(int i) { assert(i >= 0 && i < k_numberOfSeries); assert(i < Palette::numberOfLightDataColors()); - return Palette::DataColorLight[i]; + return *Palette::DataColorLight[i]; } double * data() { return reinterpret_cast(&m_data); } protected: diff --git a/apps/shared/function_expression_cell.cpp b/apps/shared/function_expression_cell.cpp index c4ea79244..af2981ce1 100644 --- a/apps/shared/function_expression_cell.cpp +++ b/apps/shared/function_expression_cell.cpp @@ -8,7 +8,7 @@ KDSize FunctionExpressionCell::minimalSizeForOptimalDisplay() const { } void FunctionExpressionCell::drawRect(KDContext * ctx, KDRect rect) const { - KDColor separatorColor = m_even ? Palette::BackgroundApps : Palette::BackgroundHard; + KDColor separatorColor = m_even ? *Palette::BackgroundApps : *Palette::BackgroundHard; // Color the horizontal separator ctx->fillRect(KDRect(0, bounds().height()-k_separatorThickness, bounds().width(), k_separatorThickness), separatorColor); // Color the left margin diff --git a/apps/shared/function_graph_view.cpp b/apps/shared/function_graph_view.cpp index cc8a532bf..b827de912 100644 --- a/apps/shared/function_graph_view.cpp +++ b/apps/shared/function_graph_view.cpp @@ -18,7 +18,7 @@ FunctionGraphView::FunctionGraphView(InteractiveCurveViewRange * graphRange, } void FunctionGraphView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(rect, Palette::BackgroundHard); + ctx->fillRect(rect, *Palette::BackgroundHard); drawGrid(ctx, rect); drawAxes(ctx, rect); simpleDrawBothAxesLabels(ctx, rect); diff --git a/apps/shared/function_list_controller.cpp b/apps/shared/function_list_controller.cpp index d8dbf2ad7..690119503 100644 --- a/apps/shared/function_list_controller.cpp +++ b/apps/shared/function_list_controller.cpp @@ -17,13 +17,13 @@ FunctionListController::FunctionListController(Responder * parentResponder, Butt TabViewController * tabController = list->tabController(); tabController->setActiveTab(1); return true; - }, this), KDFont::SmallFont, Palette::ButtonText), + }, this), KDFont::SmallFont, *Palette::ButtonText), m_valuesButton(this, I18n::Message::DisplayValues, Invocation([](void * context, void * sender) { FunctionListController * list = (FunctionListController *)context; TabViewController * tabController = list->tabController(); tabController->setActiveTab(2); return true; - }, this), KDFont::SmallFont, Palette::ButtonText), + }, this), KDFont::SmallFont, *Palette::ButtonText), m_titlesColumnWidth(k_minTitleColumnWidth) { /* m_memoizedCellBaseline is not initialized by the call to diff --git a/apps/shared/function_title_cell.cpp b/apps/shared/function_title_cell.cpp index c57120bfb..c0a88abf8 100644 --- a/apps/shared/function_title_cell.cpp +++ b/apps/shared/function_title_cell.cpp @@ -23,8 +23,8 @@ void FunctionTitleCell::setBaseline(KDCoordinate baseline) { void FunctionTitleCell::drawRect(KDContext * ctx, KDRect rect) const { if (m_orientation == Orientation::VerticalIndicator){ - KDColor separatorColor = m_even ? Palette::BackgroundApps : Palette::BackgroundHard; - KDColor backgroundColor = m_even ? Palette::BackgroundHard : Palette::BackgroundApps; + KDColor separatorColor = m_even ? *Palette::BackgroundApps : *Palette::BackgroundHard; + KDColor backgroundColor = m_even ? *Palette::BackgroundHard : *Palette::BackgroundApps; // Draw the color indicator ctx->fillRect(KDRect(0, 0, k_colorIndicatorThickness, bounds().height()), m_functionColor); // Draw the horizontal separator diff --git a/apps/shared/function_title_cell.h b/apps/shared/function_title_cell.h index 39ea199ac..2f96d67aa 100644 --- a/apps/shared/function_title_cell.h +++ b/apps/shared/function_title_cell.h @@ -15,7 +15,7 @@ public: EvenOddCell(), m_orientation(orientation), m_baseline(-1), - m_functionColor(Palette::PrimaryText) + m_functionColor(*Palette::PrimaryText) {} virtual void setOrientation(Orientation orientation); virtual void setColor(KDColor color); diff --git a/apps/shared/function_zoom_and_pan_curve_view_controller.cpp b/apps/shared/function_zoom_and_pan_curve_view_controller.cpp index 2b6ab38af..12f37399c 100644 --- a/apps/shared/function_zoom_and_pan_curve_view_controller.cpp +++ b/apps/shared/function_zoom_and_pan_curve_view_controller.cpp @@ -105,7 +105,7 @@ FunctionZoomAndPanCurveViewController::ContentView::LegendView::LegendView() for (int i = 0; i < k_numberOfLegends; i++) { m_legends[i].setFont(KDFont::SmallFont); m_legends[i].setMessage(messages[i]); - m_legends[i].setBackgroundColor(Palette::SubMenuBackground); + m_legends[i].setBackgroundColor(*Palette::SubMenuBackground); m_legends[i].setAlignment(horizontalAlignments[i], 0.5f); } KeyView::Type tokenTypes[k_numberOfTokens] = {KeyView::Type::Up, KeyView::Type::Down, KeyView::Type::Left, KeyView::Type::Right, KeyView::Type::Plus, KeyView::Type::Minus}; @@ -115,7 +115,7 @@ FunctionZoomAndPanCurveViewController::ContentView::LegendView::LegendView() } void FunctionZoomAndPanCurveViewController::ContentView::LegendView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight), Palette::SubMenuBackground); + ctx->fillRect(KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight), *Palette::SubMenuBackground); } int FunctionZoomAndPanCurveViewController::ContentView::LegendView::numberOfSubviews() const { diff --git a/apps/shared/hideable.h b/apps/shared/hideable.h index 12d54d006..d15b29409 100644 --- a/apps/shared/hideable.h +++ b/apps/shared/hideable.h @@ -10,7 +10,7 @@ public: Hideable() : m_hide(false) {} - static KDColor hideColor() { return Palette::BackgroundAppsSecondary; } + static KDColor hideColor() { return *Palette::BackgroundAppsSecondary; } bool hidden() const { return m_hide; } virtual void setHide(bool hide) { m_hide = hide; } virtual void reinit() {} diff --git a/apps/shared/localization_controller.cpp b/apps/shared/localization_controller.cpp index b300e84f2..26a26a934 100644 --- a/apps/shared/localization_controller.cpp +++ b/apps/shared/localization_controller.cpp @@ -11,14 +11,14 @@ LocalizationController::ContentView::ContentView(LocalizationController * contro m_controller(controller), m_selectableTableView(controller, controller, dataSource), m_countryTitleMessage(KDFont::LargeFont, I18n::Message::Country), - m_borderView(Palette::BackgroundApps) + m_borderView(*Palette::BackgroundApps) { - m_countryTitleMessage.setBackgroundColor(Palette::BackgroundHard); + m_countryTitleMessage.setBackgroundColor(*Palette::BackgroundHard); m_countryTitleMessage.setAlignment(0.5f, 0.5f); assert(k_numberOfCountryWarningLines == 2); // textMessages is not overflowed I18n::Message textMessages[k_numberOfCountryWarningLines] = {I18n::Message::CountryWarning1, I18n::Message::CountryWarning2}; for (int i = 0; i < k_numberOfCountryWarningLines; i++) { - m_countryWarningLines[i].setBackgroundColor(Palette::BackgroundApps); + m_countryWarningLines[i].setBackgroundColor(*Palette::BackgroundApps); m_countryWarningLines[i].setFont(KDFont::SmallFont); m_countryWarningLines[i].setAlignment(0.5f, 0.5f); m_countryWarningLines[i].setMessage(textMessages[i]); diff --git a/apps/shared/localization_controller.h b/apps/shared/localization_controller.h index 327d3ef5d..71e5ab0c4 100644 --- a/apps/shared/localization_controller.h +++ b/apps/shared/localization_controller.h @@ -45,7 +45,7 @@ protected: ContentView(LocalizationController * controller, SelectableTableViewDataSource * dataSource); SelectableTableView * selectableTableView() { return &m_selectableTableView; } - void drawRect(KDContext * ctx, KDRect rect) const override { ctx->fillRect(bounds(), Palette::BackgroundApps); } + void drawRect(KDContext * ctx, KDRect rect) const override { ctx->fillRect(bounds(), *Palette::BackgroundApps); } void modeHasChanged(); private: diff --git a/apps/shared/message_view.cpp b/apps/shared/message_view.cpp index 05975da8e..b0e966098 100644 --- a/apps/shared/message_view.cpp +++ b/apps/shared/message_view.cpp @@ -1,19 +1,19 @@ #include "message_view.h" #include -MessageView::MessageView(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages) { +MessageView::MessageView(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages) { m_numberOfMessages = numberOfMessages < k_maxNumberOfMessages ? numberOfMessages : k_maxNumberOfMessages; for (uint8_t i = 0; i < m_numberOfMessages; i++) { m_messageTextViews[i].setFont(i == 0 ? KDFont::LargeFont : KDFont::SmallFont); m_messageTextViews[i].setMessage(messages[i]); m_messageTextViews[i].setAlignment(0.5f, 0.5f); - m_messageTextViews[i].setTextColor(fgcolors[i]); - m_messageTextViews[i].setBackgroundColor(bgcolors[i]); + m_messageTextViews[i].setTextColor(*fgcolors[i]); + m_messageTextViews[i].setBackgroundColor(*bgcolors[i]); } } void MessageView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(bounds(), Palette::BackgroundHard); + ctx->fillRect(bounds(), *Palette::BackgroundHard); } View * MessageView::subviewAtIndex(int index) { diff --git a/apps/shared/message_view.h b/apps/shared/message_view.h index f6b773e95..f5dc81ade 100644 --- a/apps/shared/message_view.h +++ b/apps/shared/message_view.h @@ -5,7 +5,7 @@ class MessageView : public View { public: - MessageView(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages); + MessageView(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors [], uint8_t numberOfMessages); void drawRect(KDContext * ctx, KDRect rect) const override; protected: int numberOfSubviews() const override { return m_numberOfMessages; } diff --git a/apps/shared/ok_view.cpp b/apps/shared/ok_view.cpp index 7a11f3a56..2a22751b9 100644 --- a/apps/shared/ok_view.cpp +++ b/apps/shared/ok_view.cpp @@ -30,7 +30,7 @@ void OkView::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate height = bounds().height(); KDRect frame((width-k_okSize)/2, (height-k_okSize)/2, k_okSize, k_okSize); KDColor okWorkingBuffer[OkView::k_okSize*OkView::k_okSize]; - ctx->blendRectWithMask(frame, Palette::PrimaryText, (const uint8_t *)okMask, okWorkingBuffer); + ctx->blendRectWithMask(frame, *Palette::PrimaryText, (const uint8_t *)okMask, okWorkingBuffer); } KDSize OkView::minimalSizeForOptimalDisplay() const { diff --git a/apps/shared/range_parameter_controller.cpp b/apps/shared/range_parameter_controller.cpp index 3f05c4dcc..884568f09 100644 --- a/apps/shared/range_parameter_controller.cpp +++ b/apps/shared/range_parameter_controller.cpp @@ -41,7 +41,7 @@ void RangeParameterController::willDisplayCellForIndex(HighlightCell * cell, int MessageTableCellWithEditableText * myCell = (MessageTableCellWithEditableText *)cell; I18n::Message labels[k_numberOfTextCell] = {I18n::Message::XMin, I18n::Message::XMax, I18n::Message::YMin, I18n::Message::YMax}; myCell->setMessage(labels[index]); - myCell->setTextColor(Palette::PrimaryText); + myCell->setTextColor(*Palette::PrimaryText); FloatParameterController::willDisplayCellForIndex(cell, index); } diff --git a/apps/shared/round_cursor_view.h b/apps/shared/round_cursor_view.h index 930cea460..f9e81d3cd 100644 --- a/apps/shared/round_cursor_view.h +++ b/apps/shared/round_cursor_view.h @@ -10,7 +10,7 @@ namespace Shared { class RoundCursorView : public CursorView { public: - RoundCursorView(KDColor color = Palette::PrimaryText) : + RoundCursorView(KDColor color = *Palette::PrimaryText) : m_color(color) #ifdef GRAPH_CURSOR_SPEEDUP , m_underneathPixelBufferLoaded(false) diff --git a/apps/shared/scrollable_exact_approximate_expressions_view.cpp b/apps/shared/scrollable_exact_approximate_expressions_view.cpp index 05377dd6d..46a90a80f 100644 --- a/apps/shared/scrollable_exact_approximate_expressions_view.cpp +++ b/apps/shared/scrollable_exact_approximate_expressions_view.cpp @@ -9,7 +9,7 @@ static inline KDCoordinate maxCoordinate(KDCoordinate x, KDCoordinate y) { retur ScrollableExactApproximateExpressionsView::ContentCell::ContentCell() : m_rightExpressionView(), - m_approximateSign(KDFont::LargeFont, I18n::Message::AlmostEqual, 0.5f, 0.5f, Palette::ApproximateSignText), + m_approximateSign(KDFont::LargeFont, I18n::Message::AlmostEqual, 0.5f, 0.5f, *Palette::ApproximateSignText), m_leftExpressionView(), m_selectedSubviewPosition((SubviewPosition)0), m_displayLeftExpression(true) @@ -17,7 +17,7 @@ ScrollableExactApproximateExpressionsView::ContentCell::ContentCell() : } KDColor ScrollableExactApproximateExpressionsView::ContentCell::backgroundColor() const { - KDColor background = m_even ? Palette::CalculationBackgroundEven : Palette::CalculationBackgroundOdd; + KDColor background = m_even ? *Palette::CalculationBackgroundEven : *Palette::CalculationBackgroundOdd; return background; } @@ -29,9 +29,9 @@ void ScrollableExactApproximateExpressionsView::ContentCell::setHighlighted(bool m_approximateSign.setBackgroundColor(backgroundColor()); if (highlight) { if (m_selectedSubviewPosition == SubviewPosition::Left) { - m_leftExpressionView.setBackgroundColor(Palette::ListCellBackgroundSelected); + m_leftExpressionView.setBackgroundColor(*Palette::ListCellBackgroundSelected); } else { - m_rightExpressionView.setBackgroundColor(Palette::ListCellBackgroundSelected); + m_rightExpressionView.setBackgroundColor(*Palette::ListCellBackgroundSelected); } } } @@ -45,9 +45,9 @@ void ScrollableExactApproximateExpressionsView::ContentCell::setEven(bool even) void ScrollableExactApproximateExpressionsView::ContentCell::reloadTextColor() { if (numberOfSubviews() == 1) { - m_rightExpressionView.setTextColor(Palette::PrimaryText); + m_rightExpressionView.setTextColor(*Palette::PrimaryText); } else { - m_rightExpressionView.setTextColor(Palette::ApproximateExpressionText); + m_rightExpressionView.setTextColor(*Palette::ApproximateExpressionText); } } diff --git a/apps/shared/scrollable_multiple_expressions_view.cpp b/apps/shared/scrollable_multiple_expressions_view.cpp index 49021e1a8..b7d936b5a 100644 --- a/apps/shared/scrollable_multiple_expressions_view.cpp +++ b/apps/shared/scrollable_multiple_expressions_view.cpp @@ -8,7 +8,7 @@ namespace Shared { AbstractScrollableMultipleExpressionsView::ContentCell::ContentCell() : m_rightExpressionView(), - m_approximateSign(k_font, k_defaultApproximateMessage, 0.5f, 0.5f, Palette::SecondaryText), + m_approximateSign(k_font, k_defaultApproximateMessage, 0.5f, 0.5f, *Palette::SecondaryText), m_centeredExpressionView(), m_selectedSubviewPosition(SubviewPosition::Center), m_displayCenter(true) @@ -16,7 +16,7 @@ AbstractScrollableMultipleExpressionsView::ContentCell::ContentCell() : } KDColor AbstractScrollableMultipleExpressionsView::ContentCell::backgroundColor() const { - KDColor background = m_even ? Palette::CalculationBackgroundEven : Palette::CalculationBackgroundOdd; + KDColor background = m_even ? *Palette::CalculationBackgroundEven : *Palette::CalculationBackgroundOdd; return background; } @@ -24,13 +24,13 @@ void AbstractScrollableMultipleExpressionsView::ContentCell::setHighlighted(bool // Do not call HighlightCell::setHighlighted to avoid marking all cell as dirty m_highlighted = highlight; KDColor defaultColor = backgroundColor(); - KDColor color = highlight && m_selectedSubviewPosition == SubviewPosition::Center ? Palette::Select : defaultColor; + KDColor color = highlight && m_selectedSubviewPosition == SubviewPosition::Center ? *Palette::Select : defaultColor; m_centeredExpressionView.setBackgroundColor(color); - color = highlight && m_selectedSubviewPosition == SubviewPosition::Right ? Palette::Select : defaultColor; + color = highlight && m_selectedSubviewPosition == SubviewPosition::Right ? *Palette::Select : defaultColor; m_rightExpressionView.setBackgroundColor(color); m_approximateSign.setBackgroundColor(defaultColor); if (leftExpressionView()) { - color = highlight && m_selectedSubviewPosition == SubviewPosition::Left ? Palette::Select : defaultColor; + color = highlight && m_selectedSubviewPosition == SubviewPosition::Left ? *Palette::Select : defaultColor; leftExpressionView()->setBackgroundColor(color); } } @@ -48,9 +48,9 @@ void AbstractScrollableMultipleExpressionsView::ContentCell::setEven(bool even) void AbstractScrollableMultipleExpressionsView::ContentCell::reloadTextColor() { if (displayCenter()) { - m_rightExpressionView.setTextColor(Palette::SecondaryText); + m_rightExpressionView.setTextColor(*Palette::SecondaryText); } else { - m_rightExpressionView.setTextColor(Palette::PrimaryText); + m_rightExpressionView.setTextColor(*Palette::PrimaryText); } } diff --git a/apps/shared/sequence_store.cpp b/apps/shared/sequence_store.cpp index a9e54d717..b3d1d57d5 100644 --- a/apps/shared/sequence_store.cpp +++ b/apps/shared/sequence_store.cpp @@ -32,7 +32,7 @@ Ion::Storage::Record::ErrorStatus SequenceStore::addEmptyModel() { assert(name); // Choose the corresponding color assert(nameIndex < Palette::numberOfDataColors()); - KDColor color = Palette::DataColor[nameIndex]; + KDColor color = *Palette::DataColor[nameIndex]; Sequence::RecordDataBuffer data(color); // m_sequences return Ion::Storage::sharedStorage()->createRecordWithExtension(name, modelExtension(), &data, sizeof(data)); diff --git a/apps/shared/store_controller.cpp b/apps/shared/store_controller.cpp index ee4244f3b..34ad54d58 100644 --- a/apps/shared/store_controller.cpp +++ b/apps/shared/store_controller.cpp @@ -17,7 +17,7 @@ StoreController::ContentView::ContentView(DoublePairStore * store, Responder * p m_formulaInputView(this, inputEventHandlerDelegate, textFieldDelegate), m_displayFormulaInputView(false) { - m_dataView.setBackgroundColor(Palette::BackgroundAppsSecondary); + m_dataView.setBackgroundColor(*Palette::BackgroundAppsSecondary); m_dataView.setVerticalCellOverlap(0); m_dataView.setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin); } diff --git a/apps/shared/sum_graph_controller.cpp b/apps/shared/sum_graph_controller.cpp index 423582e90..3a750587e 100644 --- a/apps/shared/sum_graph_controller.cpp +++ b/apps/shared/sum_graph_controller.cpp @@ -155,16 +155,16 @@ void SumGraphController::reloadBannerView() { /* Legend View */ SumGraphController::LegendView::LegendView(SumGraphController * controller, InputEventHandlerDelegate * inputEventHandlerDelegate, CodePoint sumSymbol) : - m_sum(0.0f, 0.5f, KDColorBlack, Palette::GrayMiddle), - m_legend(k_font, I18n::Message::Default, 0.0f, 0.5f, KDColorBlack, Palette::GrayMiddle), - m_editableZone(controller, m_textBuffer, k_editableZoneBufferSize, TextField::maxBufferSize(), inputEventHandlerDelegate, controller, k_font, 0.0f, 0.5f, KDColorBlack, Palette::GrayMiddle), + m_sum(0.0f, 0.5f, KDColorBlack, *Palette::GrayMiddle), + m_legend(k_font, I18n::Message::Default, 0.0f, 0.5f, KDColorBlack, *Palette::GrayMiddle), + m_editableZone(controller, m_textBuffer, k_editableZoneBufferSize, TextField::maxBufferSize(), inputEventHandlerDelegate, controller, k_font, 0.0f, 0.5f, KDColorBlack, *Palette::GrayMiddle), m_sumSymbol(sumSymbol) { m_textBuffer[0] = 0; } void SumGraphController::LegendView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(bounds(), Palette::GrayMiddle); + ctx->fillRect(bounds(), *Palette::GrayMiddle); } KDSize SumGraphController::LegendView::minimalSizeForOptimalDisplay() const { diff --git a/apps/shared/text_field_with_extension.h b/apps/shared/text_field_with_extension.h index dc1f46d81..246738147 100644 --- a/apps/shared/text_field_with_extension.h +++ b/apps/shared/text_field_with_extension.h @@ -17,8 +17,8 @@ public: const KDFont * size = KDFont::LargeFont, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, - KDColor textColor = Palette::PrimaryText, - KDColor backgroundColor = Palette::BackgroundHard) : + KDColor textColor = *Palette::PrimaryText, + KDColor backgroundColor = *Palette::BackgroundHard) : TextField(parentResponder, textBuffer, textBufferSize, draftTextBufferSize, inputEventHandlerDelegate, delegate, size, horizontalAlignment, verticalAlignment, textColor, backgroundColor), m_extensionLength(extensionLength) {} diff --git a/apps/shared/values_controller.cpp b/apps/shared/values_controller.cpp index 6b5262116..e21700872 100644 --- a/apps/shared/values_controller.cpp +++ b/apps/shared/values_controller.cpp @@ -30,7 +30,7 @@ ValuesController::ValuesController(Responder * parentResponder, ButtonRowControl void ValuesController::setupSelectableTableViewAndCells(InputEventHandlerDelegate * inputEventHandlerDelegate) { selectableTableView()->setVerticalCellOverlap(0); selectableTableView()->setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin); - selectableTableView()->setBackgroundColor(Palette::BackgroundAppsSecondary); + selectableTableView()->setBackgroundColor(*Palette::BackgroundAppsSecondary); int numberOfAbscissaCells = abscissaCellsCount(); for (int i = 0; i < numberOfAbscissaCells; i++) { diff --git a/apps/shared/vertical_cursor_view.cpp b/apps/shared/vertical_cursor_view.cpp index a4366911d..089a37194 100644 --- a/apps/shared/vertical_cursor_view.cpp +++ b/apps/shared/vertical_cursor_view.cpp @@ -4,7 +4,7 @@ namespace Shared { void VerticalCursorView::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate height = bounds().height(); - ctx->fillRect(KDRect(0, 0, 1, height), Palette::PrimaryText); + ctx->fillRect(KDRect(0, 0, 1, height), *Palette::PrimaryText); } KDSize VerticalCursorView::minimalSizeForOptimalDisplay() const { diff --git a/apps/shift_alpha_lock_view.cpp b/apps/shift_alpha_lock_view.cpp index 7809c7d10..05db8f3af 100644 --- a/apps/shift_alpha_lock_view.cpp +++ b/apps/shift_alpha_lock_view.cpp @@ -2,13 +2,13 @@ ShiftAlphaLockView::ShiftAlphaLockView() : View(), - m_shiftAlphaView(KDFont::SmallFont, I18n::Message::Default, 1.0f, 0.5f, Palette::ToolbarText, Palette::Toolbar), + m_shiftAlphaView(KDFont::SmallFont, I18n::Message::Default, 1.0f, 0.5f, *Palette::ToolbarText, *Palette::Toolbar), m_status(Ion::Events::ShiftAlphaStatus::Default) { } void ShiftAlphaLockView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(bounds(), Palette::Toolbar); + ctx->fillRect(bounds(), *Palette::Toolbar); } bool ShiftAlphaLockView::setStatus(Ion::Events::ShiftAlphaStatus status) { diff --git a/apps/solver/equation_list_view.cpp b/apps/solver/equation_list_view.cpp index 6ed4befa7..bdcb56556 100644 --- a/apps/solver/equation_list_view.cpp +++ b/apps/solver/equation_list_view.cpp @@ -19,7 +19,7 @@ EquationListView::EquationListView(ListController * listController) : listController->setScrollViewDelegate(this); m_scrollBraceView.setMargins(k_margin, k_margin, k_margin, k_margin); m_scrollBraceView.setDecoratorType(ScrollView::Decorator::Type::None); - m_scrollBraceView.setBackgroundColor(Palette::BackgroundHard); + m_scrollBraceView.setBackgroundColor(*Palette::BackgroundHard); } void EquationListView::setBraceStyle(BraceStyle style) { @@ -106,15 +106,15 @@ const uint8_t bottomBrace[braceExtremumHeight][braceExtremumWidth] = { }; void EquationListView::BraceView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(bounds(), Palette::BackgroundHard); + ctx->fillRect(bounds(), *Palette::BackgroundHard); KDCoordinate height = bounds().height(); KDCoordinate margin = 3; KDColor braceWorkingBuffer[60]; - ctx->blendRectWithMask(KDRect(margin, 0, braceExtremumWidth, braceExtremumHeight), Palette::PrimaryText, (const uint8_t *)topBrace, (KDColor *)(braceWorkingBuffer)); - ctx->blendRectWithMask(KDRect(0, height/2-braceCenterHeight/2, braceCenterWidth, braceCenterHeight), Palette::PrimaryText, (const uint8_t *)middleBrace, (KDColor *)(braceWorkingBuffer)); - ctx->blendRectWithMask(KDRect(margin, height-braceExtremumHeight, braceExtremumWidth, braceExtremumHeight), Palette::PrimaryText, (const uint8_t *)bottomBrace, (KDColor *)(braceWorkingBuffer)); - ctx->fillRect(KDRect(margin, braceExtremumHeight, 1, height/2-braceCenterHeight/2-braceExtremumHeight), Palette::PrimaryText); - ctx->fillRect(KDRect(margin, height/2+braceCenterHeight/2, 1, height/2-braceExtremumHeight/2-braceExtremumHeight), Palette::PrimaryText); + ctx->blendRectWithMask(KDRect(margin, 0, braceExtremumWidth, braceExtremumHeight), *Palette::PrimaryText, (const uint8_t *)topBrace, (KDColor *)(braceWorkingBuffer)); + ctx->blendRectWithMask(KDRect(0, height/2-braceCenterHeight/2, braceCenterWidth, braceCenterHeight), *Palette::PrimaryText, (const uint8_t *)middleBrace, (KDColor *)(braceWorkingBuffer)); + ctx->blendRectWithMask(KDRect(margin, height-braceExtremumHeight, braceExtremumWidth, braceExtremumHeight), *Palette::PrimaryText, (const uint8_t *)bottomBrace, (KDColor *)(braceWorkingBuffer)); + ctx->fillRect(KDRect(margin, braceExtremumHeight, 1, height/2-braceCenterHeight/2-braceExtremumHeight), *Palette::PrimaryText); + ctx->fillRect(KDRect(margin, height/2+braceCenterHeight/2, 1, height/2-braceExtremumHeight/2-braceExtremumHeight), *Palette::PrimaryText); } KDSize EquationListView::BraceView::minimalSizeForOptimalDisplay() const { diff --git a/apps/solver/interval_controller.cpp b/apps/solver/interval_controller.cpp index 986f5b4cf..9cbfe7b46 100644 --- a/apps/solver/interval_controller.cpp +++ b/apps/solver/interval_controller.cpp @@ -7,14 +7,14 @@ namespace Solver { IntervalController::ContentView::ContentView(SelectableTableView * selectableTableView) : - m_instructions0(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction0, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps), - m_instructions1(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction1, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps), + m_instructions0(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction0, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps), + m_instructions1(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction1, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps), m_selectableTableView(selectableTableView) { } void IntervalController::ContentView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(KDRect(0, 0, bounds().width(), k_topMargin), Palette::BackgroundApps); + ctx->fillRect(KDRect(0, 0, bounds().width(), k_topMargin), *Palette::BackgroundApps); } int IntervalController::ContentView::numberOfSubviews() const { @@ -104,7 +104,7 @@ bool IntervalController::textFieldDidFinishEditing(TextField * textField, const void IntervalController::buttonAction() { StackViewController * stack = stackController(); m_equationStore->approximateSolve(textFieldDelegateApp()->localContext(), m_shouldReplaceFunctionsButNotSymbols); - stack->push(App::app()->solutionsControllerStack(), Palette::BannerSecondText, Palette::BannerSecondBackground, Palette::BannerSecondBorder); + stack->push(App::app()->solutionsControllerStack(), *Palette::BannerSecondText, *Palette::BannerSecondBackground, *Palette::BannerSecondBorder); } } diff --git a/apps/solver/list_controller.cpp b/apps/solver/list_controller.cpp index 376b2be52..590255169 100644 --- a/apps/solver/list_controller.cpp +++ b/apps/solver/list_controller.cpp @@ -17,9 +17,9 @@ ListController::ListController(Responder * parentResponder, EquationStore * equa ListController * list = (ListController *)context; list->resolveEquations(); return true; - }, this), KDFont::LargeFont, Palette::ButtonText), + }, this), KDFont::LargeFont, *Palette::ButtonText), m_modelsParameterController(this, equationStore, this), - m_modelsStackController(nullptr, &m_modelsParameterController, Palette::BannerFirstVariantText, Palette::BannerFirstVariantBackground, Palette::BannerFirstVariantBorder) + m_modelsStackController(nullptr, &m_modelsParameterController, *Palette::BannerFirstVariantText, *Palette::BannerFirstVariantBackground, *Palette::BannerFirstVariantBorder) { m_addNewModel.setAlignment(0.3f, 0.5f); // (EquationListView::k_braceTotalWidth+k_expressionMargin) / (Ion::Display::Width-m_addNewModel.text().size()) = (30+5)/(320-200) for (int i = 0; i < k_maxNumberOfRows; i++) { @@ -191,7 +191,7 @@ void ListController::resolveEquations() { case EquationStore::Error::RequireApproximateSolution: { reinterpret_cast(App::app()->intervalController())->setShouldReplaceFuncionsButNotSymbols(resultWithoutUserDefinedSymbols); - stackController()->push(App::app()->intervalController(), Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder); + stackController()->push(App::app()->intervalController(), *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder); return; } default: @@ -199,7 +199,7 @@ void ListController::resolveEquations() { assert(e == EquationStore::Error::NoError); StackViewController * stack = stackController(); reinterpret_cast(App::app()->intervalController())->setShouldReplaceFuncionsButNotSymbols(resultWithoutUserDefinedSymbols); - stack->push(App::app()->solutionsControllerStack(), Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder); + stack->push(App::app()->solutionsControllerStack(), *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder); } } } diff --git a/apps/solver/solutions_controller.cpp b/apps/solver/solutions_controller.cpp index 8e5e985dc..3112f92b0 100644 --- a/apps/solver/solutions_controller.cpp +++ b/apps/solver/solutions_controller.cpp @@ -17,21 +17,21 @@ using namespace Shared; namespace Solver { -constexpr KDColor SolutionsController::ContentView::k_backgroundColor; +KDColor const * SolutionsController::ContentView::k_backgroundColor = Palette::BackgroundAppsSecondary; SolutionsController::ContentView::ContentView(SolutionsController * controller) : - m_warningMessageView0(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, KDColorBlack, k_backgroundColor), - m_warningMessageView1(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, KDColorBlack, k_backgroundColor), + m_warningMessageView0(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, KDColorBlack, *k_backgroundColor), + m_warningMessageView1(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, KDColorBlack, *k_backgroundColor), m_selectableTableView(controller, controller, controller, controller), m_displayWarningMoreSolutions(false) { - m_selectableTableView.setBackgroundColor(k_backgroundColor); + m_selectableTableView.setBackgroundColor(*k_backgroundColor); m_selectableTableView.setVerticalCellOverlap(0); } void SolutionsController::ContentView::drawRect(KDContext * ctx, KDRect rect) const { if (m_displayWarningMoreSolutions) { - ctx->fillRect(KDRect(0, 0, bounds().width(), k_topMargin), k_backgroundColor); + ctx->fillRect(KDRect(0, 0, bounds().width(), k_topMargin), *k_backgroundColor); } } diff --git a/apps/solver/solutions_controller.h b/apps/solver/solutions_controller.h index 4fac929a1..60598167a 100644 --- a/apps/solver/solutions_controller.h +++ b/apps/solver/solutions_controller.h @@ -42,7 +42,7 @@ private: class ContentView : public View { public: constexpr static KDCoordinate k_topMargin = 50; - constexpr static KDColor k_backgroundColor = Palette::BackgroundAppsSecondary; + static KDColor const * k_backgroundColor; ContentView(SolutionsController * controller); void drawRect(KDContext * ctx, KDRect rect) const override; void setWarning(bool warning); @@ -61,7 +61,7 @@ private: class MessageCell : public HighlightCell { public: - MessageCell() : m_messageView(KDFont::SmallFont, (I18n::Message)0, 0.0f, k_verticalAlignment, KDColorBlack, SolutionsController::ContentView::k_backgroundColor) {} + MessageCell() : m_messageView(KDFont::SmallFont, (I18n::Message)0, 0.0f, k_verticalAlignment, KDColorBlack, *SolutionsController::ContentView::k_backgroundColor) {} void setBackgroundColor(KDColor color) { m_messageView.setBackgroundColor(color); } void setHorizontalAlignment(float alignment) { m_messageView.setAlignment(alignment, k_verticalAlignment); } void setMessage(I18n::Message message) { m_messageView.setMessage(message); } diff --git a/apps/statistics/box_axis_view.cpp b/apps/statistics/box_axis_view.cpp index c36ab4175..3bbeea5fb 100644 --- a/apps/statistics/box_axis_view.cpp +++ b/apps/statistics/box_axis_view.cpp @@ -6,9 +6,9 @@ using namespace Shared; namespace Statistics { void BoxAxisView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(rect, Palette::BackgroundHard); + ctx->fillRect(rect, *Palette::BackgroundHard); KDRect lineRect = KDRect(0, k_axisMargin, bounds().width(), 1); - ctx->fillRect(lineRect, Palette::PrimaryText); + ctx->fillRect(lineRect, *Palette::PrimaryText); drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, false, true, k_axisMargin); } diff --git a/apps/statistics/box_view.cpp b/apps/statistics/box_view.cpp index b2e2a101d..2d783588a 100644 --- a/apps/statistics/box_view.cpp +++ b/apps/statistics/box_view.cpp @@ -52,7 +52,7 @@ void BoxView::reload() { } void BoxView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(rect, Palette::BackgroundHard); + ctx->fillRect(rect, *Palette::BackgroundHard); KDCoordinate lowBoundPixel = boxLowerBoundPixel(); KDCoordinate upBoundPixel = boxUpperBoundPixel(); @@ -63,7 +63,7 @@ void BoxView::drawRect(KDContext * ctx, KDRect rect) const { double thirdQuart = m_store->thirdQuartile(m_series); double maxVal = m_store->maxValue(m_series); - KDColor boxColor = isMainViewSelected() ? m_selectedHistogramLightColor : Palette::StatisticsNotSelected; + KDColor boxColor = isMainViewSelected() ? m_selectedHistogramLightColor : *Palette::StatisticsNotSelected; // Draw the main box KDCoordinate firstQuartilePixels = std::round(floatToPixel(Axis::Horizontal, firstQuart)); KDCoordinate thirdQuartilePixels = std::round(floatToPixel(Axis::Horizontal, thirdQuart)); @@ -71,7 +71,7 @@ void BoxView::drawRect(KDContext * ctx, KDRect rect) const { upBoundPixel-lowBoundPixel), boxColor); // Draw the horizontal lines linking the box to the extreme bounds - KDColor horizontalColor = isMainViewSelected() ? m_selectedHistogramColor : Palette::SecondaryText; + KDColor horizontalColor = isMainViewSelected() ? m_selectedHistogramColor : *Palette::SecondaryText; float segmentOrd = (lowBound + upBound)/ 2.0f; drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, segmentOrd, minVal, firstQuart, horizontalColor); drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, segmentOrd, thirdQuart, maxVal, horizontalColor); @@ -83,10 +83,10 @@ void BoxView::drawRect(KDContext * ctx, KDRect rect) const { * lines. This solution could hide the highlighted line by coloring the next * quantile if it has the same value. */ for (int k = 0; k < 5; k++) { - drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, calculations[k], lowBound, upBound, Palette::StatisticsBoxVerticalLine, k_quantileBarWidth); + drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, calculations[k], lowBound, upBound, *Palette::StatisticsBoxVerticalLine, k_quantileBarWidth); } if (isMainViewSelected()) { - drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, calculations[(int)*m_selectedQuantile], lowBound, upBound, Palette::StatisticsBox, k_quantileBarWidth); + drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, calculations[(int)*m_selectedQuantile], lowBound, upBound, *Palette::StatisticsBox, k_quantileBarWidth); } } diff --git a/apps/statistics/calculation_controller.cpp b/apps/statistics/calculation_controller.cpp index fe21be458..2463f1ad0 100644 --- a/apps/statistics/calculation_controller.cpp +++ b/apps/statistics/calculation_controller.cpp @@ -19,7 +19,7 @@ CalculationController::CalculationController(Responder * parentResponder, Button m_hideableCell(), m_store(store) { - m_selectableTableView.setBackgroundColor(Palette::BackgroundAppsSecondary); + m_selectableTableView.setBackgroundColor(*Palette::BackgroundAppsSecondary); m_selectableTableView.setVerticalCellOverlap(0); m_selectableTableView.setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin); for (int i = 0; i < k_numberOfSeriesTitleCells; i++) { @@ -30,7 +30,7 @@ CalculationController::CalculationController(Responder * parentResponder, Button m_calculationTitleCells[i].setMessageFont(KDFont::SmallFont); } for (int i = 0; i < k_numberOfCalculationCells; i++) { - m_calculationCells[i].setTextColor(Palette::SecondaryText); + m_calculationCells[i].setTextColor(*Palette::SecondaryText); } m_hideableCell.setHide(true); } diff --git a/apps/statistics/histogram_view.cpp b/apps/statistics/histogram_view.cpp index 66250b872..2cf94cfcb 100644 --- a/apps/statistics/histogram_view.cpp +++ b/apps/statistics/histogram_view.cpp @@ -39,7 +39,7 @@ void HistogramView::reloadSelectedBar() { void HistogramView::drawRect(KDContext * ctx, KDRect rect) const { m_controller->setCurrentDrawnSeries(m_series); - ctx->fillRect(rect, Palette::BackgroundHard); + ctx->fillRect(rect, *Palette::BackgroundHard); drawAxis(ctx, rect, Axis::Horizontal); drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, !m_displayLabels); /* We memoize the total size to avoid recomputing it in double precision at diff --git a/apps/statistics/histogram_view.h b/apps/statistics/histogram_view.h index 94bb8a9bf..237cea1d1 100644 --- a/apps/statistics/histogram_view.h +++ b/apps/statistics/histogram_view.h @@ -13,7 +13,7 @@ class HistogramController; class HistogramView : public Shared::HorizontallyLabeledCurveView { public: - HistogramView(HistogramController * controller, Store * store, int series, Shared::BannerView * bannerView, KDColor selectedHistogramColor = Palette::StatisticsSelected, KDColor notSelectedHistogramColor = Palette::StatisticsNotSelected, KDColor selectedBarColor = Palette::StatisticsSelected); + HistogramView(HistogramController * controller, Store * store, int series, Shared::BannerView * bannerView, KDColor selectedHistogramColor = *Palette::StatisticsSelected, KDColor notSelectedHistogramColor = *Palette::StatisticsNotSelected, KDColor selectedBarColor = *Palette::StatisticsSelected); int series() const { return m_series; } void reload() override; void reloadSelectedBar(); diff --git a/apps/statistics/multiple_data_view.cpp b/apps/statistics/multiple_data_view.cpp index 569d7827d..5626f499b 100644 --- a/apps/statistics/multiple_data_view.cpp +++ b/apps/statistics/multiple_data_view.cpp @@ -112,7 +112,7 @@ void MultipleDataView::layoutBanner(bool force) { void MultipleDataView::drawRect(KDContext * ctx, KDRect rect) const { if (!m_displayBanner) { - ctx->fillRect(bannerFrame(), Palette::BackgroundHard); + ctx->fillRect(bannerFrame(), *Palette::BackgroundHard); } } diff --git a/apps/statistics/store_controller.cpp b/apps/statistics/store_controller.cpp index c98270579..8add78471 100644 --- a/apps/statistics/store_controller.cpp +++ b/apps/statistics/store_controller.cpp @@ -49,7 +49,7 @@ void StoreController::willDisplayCellAtLocation(HighlightCell * cell, int i, int I18n::Message sizesMessages[] = {I18n::Message::Frequencies1, I18n::Message::Frequencies2, I18n::Message::Frequencies3}; mytitleCell->setText(I18n::translate(sizesMessages[seriesIndex])); } - mytitleCell->setColor(m_store->numberOfPairsOfSeries(seriesIndex) == 0 ? Palette::SecondaryText : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GreyDark with graph/list_controller + mytitleCell->setColor(m_store->numberOfPairsOfSeries(seriesIndex) == 0 ? *Palette::SecondaryText : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GreyDark with graph/list_controller } HighlightCell * StoreController::titleCells(int index) { diff --git a/apps/title_bar_view.cpp b/apps/title_bar_view.cpp index a842b394e..8119a0eec 100644 --- a/apps/title_bar_view.cpp +++ b/apps/title_bar_view.cpp @@ -9,9 +9,9 @@ using namespace Poincare; TitleBarView::TitleBarView() : View(), - m_titleView(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, Palette::ToolbarText, Palette::Toolbar), - m_preferenceView(KDFont::SmallFont, 1.0f, 0.5, Palette::ToolbarText, Palette::Toolbar), - m_clockView(KDFont::SmallFont, 0.5f, 0.5f, Palette::ToolbarText, Palette::Toolbar), + m_titleView(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, *Palette::ToolbarText, *Palette::Toolbar), + m_preferenceView(KDFont::SmallFont, 1.0f, 0.5, *Palette::ToolbarText, *Palette::Toolbar), + m_clockView(KDFont::SmallFont, 0.5f, 0.5f, *Palette::ToolbarText, *Palette::Toolbar), m_hours(-1), m_mins(-1), m_clockEnabled(Ion::RTC::mode() != Ion::RTC::Mode::Disabled) @@ -23,7 +23,7 @@ TitleBarView::TitleBarView() : void TitleBarView::drawRect(KDContext * ctx, KDRect rect) const { /* As we cheated to layout the title view, we have to fill a very thin * rectangle at the top with the background color. */ - ctx->fillRect(KDRect(0, 0, bounds().width(), 2), Palette::Toolbar); + ctx->fillRect(KDRect(0, 0, bounds().width(), 2), *Palette::Toolbar); } void TitleBarView::setTitle(I18n::Message title) { diff --git a/apps/usb/usb_connected_controller.cpp b/apps/usb/usb_connected_controller.cpp index 71a354c4a..54f373f2e 100644 --- a/apps/usb/usb_connected_controller.cpp +++ b/apps/usb/usb_connected_controller.cpp @@ -13,17 +13,17 @@ static I18n::Message sUSBConnectedMessages[] = { I18n::Message::ConnectedMessage5, I18n::Message::ConnectedMessage6}; -static KDColor sUSBConnectedFGColors[] = { +static KDColor const * sUSBConnectedFGColors[] = { Palette::PrimaryText, Palette::PrimaryText, Palette::PrimaryText, Palette::AccentText, - KDColorWhite, + &KDColorWhite, Palette::PrimaryText, Palette::PrimaryText, Palette::PrimaryText}; -static KDColor sUSBConnectedBGColors[] = { +static KDColor const * sUSBConnectedBGColors[] = { Palette::BackgroundHard, Palette::BackgroundHard, Palette::BackgroundHard, diff --git a/apps/variable_box_empty_controller.cpp b/apps/variable_box_empty_controller.cpp index ec6a9a24c..e36af88ff 100644 --- a/apps/variable_box_empty_controller.cpp +++ b/apps/variable_box_empty_controller.cpp @@ -7,12 +7,12 @@ using namespace Poincare; using namespace Ion; VariableBoxEmptyController::VariableBoxEmptyView::VariableBoxEmptyView() : - m_layoutExample(0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps) + m_layoutExample(0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps) { for (int i = 0; i < k_numberOfMessages; i++) { m_messages[i].setFont(k_font); m_messages[i].setAlignment(0.5f, 0.5f); - m_messages[i].setBackgroundColor(Palette::BackgroundApps); + m_messages[i].setBackgroundColor(*Palette::BackgroundApps); } m_messages[0].setAlignment(0.5f,1.0f); m_messages[k_numberOfMessages-1].setAlignment(0.5f,0.0f); @@ -29,7 +29,7 @@ void VariableBoxEmptyController::VariableBoxEmptyView::setLayout(Poincare::Layou } void VariableBoxEmptyController::VariableBoxEmptyView::drawRect(KDContext * ctx, KDRect rect) const { - drawBorderOfRect(ctx, bounds(), Palette::ListCellBorder); + drawBorderOfRect(ctx, bounds(), *Palette::ListCellBorder); } int VariableBoxEmptyController::VariableBoxEmptyView::numberOfSubviews() const { diff --git a/escher/Makefile b/escher/Makefile index a8bb8491c..3fbe83708 100644 --- a/escher/Makefile +++ b/escher/Makefile @@ -5,7 +5,14 @@ $(eval $(call rule_for, \ THEME, \ escher/palette.h, \ $(addprefix themes/themes/local/, $(addsuffix .json, $(THEME_NAME))), \ - $$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR)/, \ + $$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR) --header, \ + global \ +)) +$(eval $(call rule_for, \ + THEME, \ + escher/palette_data.cpp, \ + $(addprefix themes/themes/local/, $(addsuffix .json, $(THEME_NAME))), \ + $$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR) --cpp, \ global \ )) else @@ -13,7 +20,14 @@ $(eval $(call rule_for, \ THEME, \ escher/palette.h, \ themes/themes/git/.empty-folder, \ - $$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR)/, \ + $$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR) --header, \ + global \ +)) +$(eval $(call rule_for, \ + THEME, \ + escher/palette_data.cpp, \ + themes/themes/git/.empty-folder, \ + $$(PYTHON) themes/themes_manager.py $(THEME_REPO) $(THEME_NAME) $$@ $(BUILD_DIR) --cpp, \ global \ )) endif @@ -113,6 +127,10 @@ escher_src += $(addprefix escher/src/,\ window.cpp \ ) +escher_src += $(addprefix escher/,\ + palette_data.cpp\ +) + tests_src += $(addprefix escher/test/,\ clipboard.cpp \ layout_field.cpp\ diff --git a/escher/include/escher/alternate_empty_view_delegate.h b/escher/include/escher/alternate_empty_view_delegate.h index 05cdac76e..6b6f1af9b 100644 --- a/escher/include/escher/alternate_empty_view_delegate.h +++ b/escher/include/escher/alternate_empty_view_delegate.h @@ -17,7 +17,7 @@ public: class AlternateEmptyViewDefaultDelegate : public AlternateEmptyViewDelegate { public: - AlternateEmptyViewDefaultDelegate() : m_message(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps) {} + AlternateEmptyViewDefaultDelegate() : m_message(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps) {} virtual I18n::Message emptyMessage() = 0; View * emptyView() override { m_message.setMessage(emptyMessage()); diff --git a/escher/include/escher/buffer_text_view.h b/escher/include/escher/buffer_text_view.h index 8367d79b9..8eaa9b3d3 100644 --- a/escher/include/escher/buffer_text_view.h +++ b/escher/include/escher/buffer_text_view.h @@ -7,7 +7,7 @@ class BufferTextView : public TextView { public: static constexpr int k_maxNumberOfChar = 256; BufferTextView(const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.5f, float verticalAlignment = 0.5f, - KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::ListCellBackground); + KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::ListCellBackground); void setText(const char * text) override; const char * text() const override; void appendText(const char * text); diff --git a/escher/include/escher/button.h b/escher/include/escher/button.h index e6e3188c9..f5b1ba325 100644 --- a/escher/include/escher/button.h +++ b/escher/include/escher/button.h @@ -10,11 +10,11 @@ class Button : public HighlightCell, public Responder { public: - Button(Responder * parentResponder, I18n::Message textBody, Invocation invocation, const KDFont * font = KDFont::SmallFont, KDColor textColor = Palette::ButtonText); + Button(Responder * parentResponder, I18n::Message textBody, Invocation invocation, const KDFont * font = KDFont::SmallFont, KDColor textColor = *Palette::ButtonText); void setMessage(I18n::Message message); bool handleEvent(Ion::Events::Event event) override; void setHighlighted(bool highlight) override; - virtual KDColor highlightedBackgroundColor() const { return Palette::ButtonBackgroundSelected; } + virtual KDColor highlightedBackgroundColor() const { return *Palette::ButtonBackgroundSelected; } Responder * responder() override { return this; } diff --git a/escher/include/escher/editable_text_cell.h b/escher/include/escher/editable_text_cell.h index 3369f3460..2dbdd467f 100644 --- a/escher/include/escher/editable_text_cell.h +++ b/escher/include/escher/editable_text_cell.h @@ -11,7 +11,7 @@ class EditableTextCell : public HighlightCell, public Responder { public: EditableTextCell(Responder * parentResponder = nullptr, InputEventHandlerDelegate * inputEventHandlerDelegate = nullptr, TextFieldDelegate * delegate = nullptr, const KDFont * font = KDFont::LargeFont, - float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = Palette::PrimaryText, KDColor = Palette::BackgroundHard, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0); + float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = *Palette::PrimaryText, KDColor = *Palette::BackgroundHard, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0); TextField * textField(); void setMargins(KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0); void setHighlighted(bool highlight) override; diff --git a/escher/include/escher/even_odd_expression_cell.h b/escher/include/escher/even_odd_expression_cell.h index 00f884ac3..aa056dcc4 100644 --- a/escher/include/escher/even_odd_expression_cell.h +++ b/escher/include/escher/even_odd_expression_cell.h @@ -7,7 +7,7 @@ class EvenOddExpressionCell : public EvenOddCell { public: EvenOddExpressionCell(float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, - KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundHard); + KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundHard); void setEven(bool even) override; void setHighlighted(bool highlight) override; void setLayout(Poincare::Layout layout); diff --git a/escher/include/escher/even_odd_message_text_cell.h b/escher/include/escher/even_odd_message_text_cell.h index 5bb9fceec..e7ee7f39f 100644 --- a/escher/include/escher/even_odd_message_text_cell.h +++ b/escher/include/escher/even_odd_message_text_cell.h @@ -11,7 +11,7 @@ public: EvenOddMessageTextCell(const KDFont * font = KDFont::LargeFont); void setEven(bool even) override; void setHighlighted(bool highlight) override; - void setMessage(I18n::Message textContent, KDColor textColor = Palette::PrimaryText); + void setMessage(I18n::Message textContent, KDColor textColor = *Palette::PrimaryText); void setAlignment(float horizontalAlignment, float verticalAlignment); void setMessageFont(const KDFont * font) { m_messageTextView.setFont(font); } protected: diff --git a/escher/include/escher/expression_view.h b/escher/include/escher/expression_view.h index 76666fb41..6b97e0788 100644 --- a/escher/include/escher/expression_view.h +++ b/escher/include/escher/expression_view.h @@ -14,7 +14,7 @@ class ExpressionView : public View { public: ExpressionView(float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, - KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::ListCellBackground, Poincare::Layout * selectionStart = nullptr, Poincare::Layout * selectionEnd = nullptr); + KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::ListCellBackground, Poincare::Layout * selectionStart = nullptr, Poincare::Layout * selectionEnd = nullptr); Poincare::Layout layout() const { return m_layout; } bool setLayout(Poincare::Layout layout); void drawRect(KDContext * ctx, KDRect rect) const override; diff --git a/escher/include/escher/message_table_cell_with_buffer.h b/escher/include/escher/message_table_cell_with_buffer.h index 64866cce2..8adb84c9e 100644 --- a/escher/include/escher/message_table_cell_with_buffer.h +++ b/escher/include/escher/message_table_cell_with_buffer.h @@ -6,7 +6,7 @@ class MessageTableCellWithBuffer : public MessageTableCell { public: - MessageTableCellWithBuffer(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont, const KDFont * accessoryFont = KDFont::LargeFont, KDColor accessoryTextColor = Palette::PrimaryText); + MessageTableCellWithBuffer(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont, const KDFont * accessoryFont = KDFont::LargeFont, KDColor accessoryTextColor = *Palette::PrimaryText); View * accessoryView() const override; void setHighlighted(bool highlight) override; void setAccessoryText(const char * textBody); diff --git a/escher/include/escher/message_text_view.h b/escher/include/escher/message_text_view.h index a879a0465..05ba30238 100644 --- a/escher/include/escher/message_text_view.h +++ b/escher/include/escher/message_text_view.h @@ -8,7 +8,7 @@ class MessageTextView : public TextView { public: MessageTextView(const KDFont * font = KDFont::LargeFont, I18n::Message message = (I18n::Message)0, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, - KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::ListCellBackground); + KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::ListCellBackground); void setText(const char * text) override; void setMessage(I18n::Message message); const char * text() const override; diff --git a/escher/include/escher/modal_view_empty_controller.h b/escher/include/escher/modal_view_empty_controller.h index cf175aab4..9009b8aec 100644 --- a/escher/include/escher/modal_view_empty_controller.h +++ b/escher/include/escher/modal_view_empty_controller.h @@ -21,7 +21,7 @@ protected: void drawRect(KDContext * ctx, KDRect rect) const override; private: constexpr static int k_expressionViewRowIndex = 2; - constexpr static KDColor k_backgroundColor = Palette::WallScreen; + static KDColor const * k_backgroundColor; int numberOfSubviews() const override; View * subviewAtIndex(int index) override; void layoutSubviews(bool force = false) override; diff --git a/escher/include/escher/pointer_text_view.h b/escher/include/escher/pointer_text_view.h index 7158d626c..7c1b328b3 100644 --- a/escher/include/escher/pointer_text_view.h +++ b/escher/include/escher/pointer_text_view.h @@ -7,7 +7,7 @@ class PointerTextView : public TextView { public: PointerTextView(const KDFont * font = KDFont::LargeFont, const char * text = nullptr, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, - KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundHard); + KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundHard); const char * text() const override { return m_text; } void setText(const char * text) override; private: diff --git a/escher/include/escher/pop_up_controller.h b/escher/include/escher/pop_up_controller.h index 0374d68d2..5c62a2537 100644 --- a/escher/include/escher/pop_up_controller.h +++ b/escher/include/escher/pop_up_controller.h @@ -8,7 +8,7 @@ class HighContrastButton : public Button { public: using Button::Button; - KDColor highlightedBackgroundColor() const override { return Palette::ButtonBackgroundSelectedHighContrast; } + KDColor highlightedBackgroundColor() const override { return *Palette::ButtonBackgroundSelectedHighContrast; } }; class PopUpController : public ViewController { diff --git a/escher/include/escher/scrollable_expression_view.h b/escher/include/escher/scrollable_expression_view.h index 2ba69f0da..57c01511d 100644 --- a/escher/include/escher/scrollable_expression_view.h +++ b/escher/include/escher/scrollable_expression_view.h @@ -8,7 +8,7 @@ class ScrollableExpressionView : public ScrollableView, public ScrollViewDataSource { public: - ScrollableExpressionView(Responder * parentResponder, KDCoordinate leftRightMargin, KDCoordinate topBottomMargin, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundApps); + ScrollableExpressionView(Responder * parentResponder, KDCoordinate leftRightMargin, KDCoordinate topBottomMargin, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundApps); Poincare::Layout layout() const; void setLayout(Poincare::Layout layout); void setBackgroundColor(KDColor backgroundColor) override; diff --git a/escher/include/escher/solid_text_area.h b/escher/include/escher/solid_text_area.h index e80908c9d..b0fdd272e 100644 --- a/escher/include/escher/solid_text_area.h +++ b/escher/include/escher/solid_text_area.h @@ -9,7 +9,7 @@ class SolidTextArea : public TextArea { public: SolidTextArea(Responder * parentResponder, const KDFont * font = KDFont::LargeFont, - KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundHard) : + KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundHard) : TextArea(parentResponder, &m_contentView, font), m_contentView(font, textColor, backgroundColor) {} protected: diff --git a/escher/include/escher/stack_view_controller.h b/escher/include/escher/stack_view_controller.h index 0881139d1..53eeec34c 100644 --- a/escher/include/escher/stack_view_controller.h +++ b/escher/include/escher/stack_view_controller.h @@ -10,10 +10,10 @@ constexpr uint8_t kMaxNumberOfStacks = 4; class StackViewController : public ViewController { public: StackViewController(Responder * parentResponder, ViewController * rootViewController, - KDColor textColor = Palette::SubMenuText, KDColor backgroundColor = Palette::SubMenuBackground, KDColor separatorColor = Palette::SubMenuBorder); + KDColor textColor = *Palette::SubMenuText, KDColor backgroundColor = *Palette::SubMenuBackground, KDColor separatorColor = *Palette::SubMenuBorder); /* Push creates a new StackView and adds it */ - void push(ViewController * vc, KDColor textColor = Palette::SubMenuText, KDColor backgroundColor = Palette::SubMenuBackground, KDColor separatorColor = Palette::SubMenuBorder); + void push(ViewController * vc, KDColor textColor = *Palette::SubMenuText, KDColor backgroundColor = *Palette::SubMenuBackground, KDColor separatorColor = *Palette::SubMenuBorder); void pop(); int depth() const { return m_numberOfChildren; } @@ -28,7 +28,7 @@ public: private: class Frame { public: - Frame(ViewController * viewController = nullptr, KDColor textColor = Palette::SubMenuText, KDColor backgroundColor = Palette::SubMenuBackground, KDColor separatorColor = Palette::SubMenuBorder) : + Frame(ViewController * viewController = nullptr, KDColor textColor = *Palette::SubMenuText, KDColor backgroundColor = *Palette::SubMenuBackground, KDColor separatorColor = *Palette::SubMenuBorder) : m_viewController(viewController), m_textColor(textColor), m_backgroundColor(backgroundColor), diff --git a/escher/include/escher/text_field.h b/escher/include/escher/text_field.h index f7901b7f8..808157d79 100644 --- a/escher/include/escher/text_field.h +++ b/escher/include/escher/text_field.h @@ -21,7 +21,7 @@ public: TextField(Responder * parentResponder, char * textBuffer, size_t textBufferSize, size_t draftTextBufferSize, InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * delegate = nullptr, const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, - KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundHard); + KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundHard); void setBackgroundColor(KDColor backgroundColor) override; void setTextColor(KDColor textColor); void setDelegates(InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * delegate) { m_inputEventHandlerDelegate = inputEventHandlerDelegate; m_delegate = delegate; } diff --git a/escher/include/escher/text_view.h b/escher/include/escher/text_view.h index eca7a16d0..6da3414b8 100644 --- a/escher/include/escher/text_view.h +++ b/escher/include/escher/text_view.h @@ -11,7 +11,7 @@ class TextView : public View { public: - TextView(const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, KDColor textColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundHard) : + TextView(const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, KDColor textColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundHard) : View(), m_font(font), m_horizontalAlignment(horizontalAlignment), diff --git a/escher/src/background_view.cpp b/escher/src/background_view.cpp index 3711185c0..9b6a7965a 100644 --- a/escher/src/background_view.cpp +++ b/escher/src/background_view.cpp @@ -22,7 +22,7 @@ struct OBMHeader BackgroundView::BackgroundView(): m_data(nullptr), m_isDataValid(false), - m_defaultColor(Palette::BackgroundHard) + m_defaultColor(*Palette::BackgroundHard) { } diff --git a/escher/src/button.cpp b/escher/src/button.cpp index d1539c27c..e923a9451 100644 --- a/escher/src/button.cpp +++ b/escher/src/button.cpp @@ -5,7 +5,7 @@ Button::Button(Responder * parentResponder, I18n::Message textBody, Invocation invocation, const KDFont * font, KDColor textColor) : HighlightCell(), Responder(parentResponder), - m_messageTextView(font, textBody, 0.5f, 0.5f, textColor, Palette::ButtonBackground), + m_messageTextView(font, textBody, 0.5f, 0.5f, textColor, *Palette::ButtonBackground), m_invocation(invocation), m_font(font) { @@ -38,7 +38,7 @@ bool Button::handleEvent(Ion::Events::Event event) { void Button::setHighlighted(bool highlight) { HighlightCell::setHighlighted(highlight); - KDColor backgroundColor = highlight? highlightedBackgroundColor() : Palette::ButtonBackground; + KDColor backgroundColor = highlight? highlightedBackgroundColor() : *Palette::ButtonBackground; m_messageTextView.setBackgroundColor(backgroundColor); markRectAsDirty(bounds()); } diff --git a/escher/src/button_row_controller.cpp b/escher/src/button_row_controller.cpp index 021c00038..1afda58df 100644 --- a/escher/src/button_row_controller.cpp +++ b/escher/src/button_row_controller.cpp @@ -96,28 +96,28 @@ void ButtonRowController::ContentView::layoutSubviews(bool force) { void ButtonRowController::ContentView::drawRect(KDContext * ctx, KDRect rect) const { if (numberOfButtons() == 0) { if (m_position == Position::Top) { - ctx->fillRect(KDRect(0, 0, bounds().width(), 1), Palette::ButtonBorderOut); + ctx->fillRect(KDRect(0, 0, bounds().width(), 1), *Palette::ButtonBorderOut); } return; } if (m_style == Style::PlainWhite) { if (m_position == Position::Top) { - ctx->fillRect(KDRect(0, 0, bounds().width(), k_plainStyleHeight), Palette::SubTabBackground); - ctx->fillRect(KDRect(0, k_plainStyleHeight, bounds().width(), 1), Palette::ButtonBorderOut); + ctx->fillRect(KDRect(0, 0, bounds().width(), k_plainStyleHeight), *Palette::SubTabBackground); + ctx->fillRect(KDRect(0, k_plainStyleHeight, bounds().width(), 1), *Palette::ButtonBorderOut); } else { - ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight, bounds().width(), k_plainStyleHeight), Palette::SubTabBackground); - ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight-1, bounds().width(), 1), Palette::ButtonBorderOut); + ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight, bounds().width(), k_plainStyleHeight), *Palette::SubTabBackground); + ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight-1, bounds().width(), 1), *Palette::ButtonBorderOut); } return; } int buttonHeight = m_size == Size::Small ? k_embossedStyleHeightSmall : k_embossedStyleHeightLarge; int buttonMargin = m_size == Size::Small ? k_embossedStyleHeightMarginSmall : k_embossedStyleHeightMarginLarge; if (m_position == Position::Top) { - ctx->fillRect(KDRect(0, 0, bounds().width(), buttonHeight), Palette::ButtonBorderOut); - ctx->fillRect(KDRect(0, buttonHeight, bounds().width(), 1), Palette::ButtonRowBorder); + ctx->fillRect(KDRect(0, 0, bounds().width(), buttonHeight), *Palette::ButtonBorderOut); + ctx->fillRect(KDRect(0, buttonHeight, bounds().width(), 1), *Palette::ButtonRowBorder); } else { - ctx->fillRect(KDRect(0, bounds().height() - buttonHeight, bounds().width(), buttonHeight), Palette::ButtonBorderOut); - ctx->fillRect(KDRect(0, bounds().height() - buttonHeight-1, bounds().width(), 1), Palette::ButtonRowBorder); + ctx->fillRect(KDRect(0, bounds().height() - buttonHeight, bounds().width(), buttonHeight), *Palette::ButtonBorderOut); + ctx->fillRect(KDRect(0, bounds().height() - buttonHeight-1, bounds().width(), 1), *Palette::ButtonRowBorder); } KDCoordinate y0 = m_position == Position::Top ? buttonMargin-1 : bounds().height()-buttonHeight+buttonMargin-1; KDCoordinate y1 = m_position == Position::Top ? buttonHeight-buttonMargin-2 : bounds().height()-buttonMargin; @@ -132,12 +132,12 @@ void ButtonRowController::ContentView::drawRect(KDContext * ctx, KDRect rect) co for (int i = 0; i < numberOfButtons(); i++) { Button * button = buttonAtIndex(i); KDCoordinate buttonWidth = button->minimalSizeForOptimalDisplay().width(); - ctx->fillRect(KDRect(currentXOrigin, y0, 1, y1-y0+1), Palette::ButtonRowBorder); - ctx->fillRect(KDRect(currentXOrigin-1, y0, 1, y1-y0+2), Palette::SecondaryText); - ctx->fillRect(KDRect(currentXOrigin, y0, buttonWidth+2, 1), Palette::ButtonRowBorder); - ctx->fillRect(KDRect(currentXOrigin, y1, buttonWidth+2, 1), Palette::ButtonRowBorder); - ctx->fillRect(KDRect(currentXOrigin, y1+1, buttonWidth+2, 1), Palette::SecondaryText); - ctx->fillRect(KDRect(currentXOrigin+1+buttonWidth, y0, 1, y1-y0+1), Palette::ButtonRowBorder); + ctx->fillRect(KDRect(currentXOrigin, y0, 1, y1-y0+1), *Palette::ButtonRowBorder); + ctx->fillRect(KDRect(currentXOrigin-1, y0, 1, y1-y0+2), *Palette::SecondaryText); + ctx->fillRect(KDRect(currentXOrigin, y0, buttonWidth+2, 1), *Palette::ButtonRowBorder); + ctx->fillRect(KDRect(currentXOrigin, y1, buttonWidth+2, 1), *Palette::ButtonRowBorder); + ctx->fillRect(KDRect(currentXOrigin, y1+1, buttonWidth+2, 1), *Palette::SecondaryText); + ctx->fillRect(KDRect(currentXOrigin+1+buttonWidth, y0, 1, y1-y0+1), *Palette::ButtonRowBorder); currentXOrigin += buttonWidth + widthMargin; } } diff --git a/escher/src/button_state.cpp b/escher/src/button_state.cpp index 3541eb499..5e59432d4 100644 --- a/escher/src/button_state.cpp +++ b/escher/src/button_state.cpp @@ -22,7 +22,7 @@ void ButtonState::layoutSubviews(bool force) { } void ButtonState::drawRect(KDContext * ctx, KDRect rect) const { - KDColor backColor = isHighlighted() ? highlightedBackgroundColor() : Palette::ButtonBackground; + KDColor backColor = isHighlighted() ? highlightedBackgroundColor() : *Palette::ButtonBackground; ctx->fillRect(bounds(), backColor); } diff --git a/escher/src/chevron_view.cpp b/escher/src/chevron_view.cpp index f596be273..ceff3bac3 100644 --- a/escher/src/chevron_view.cpp +++ b/escher/src/chevron_view.cpp @@ -23,7 +23,7 @@ void ChevronView::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate chevronHalfHeight = k_chevronHeight/2; KDRect frame(width - k_chevronWidth, heightCenter -chevronHalfHeight, k_chevronWidth, k_chevronHeight); KDColor workingBuffer[ChevronView::k_chevronWidth*ChevronView::k_chevronHeight]; - ctx->blendRectWithMask(frame, Palette::Control, (const uint8_t *)chevronMask, workingBuffer); + ctx->blendRectWithMask(frame, *Palette::Control, (const uint8_t *)chevronMask, workingBuffer); } KDSize ChevronView::minimalSizeForOptimalDisplay() const { diff --git a/escher/src/editable_text_cell.cpp b/escher/src/editable_text_cell.cpp index 9a835cabd..1230fd1a4 100644 --- a/escher/src/editable_text_cell.cpp +++ b/escher/src/editable_text_cell.cpp @@ -30,7 +30,7 @@ TextField * EditableTextCell::textField() { void EditableTextCell::setHighlighted(bool highlight) { HighlightCell::setHighlighted(highlight); - KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_textField.setBackgroundColor(backgroundColor); } diff --git a/escher/src/ellipsis_view.cpp b/escher/src/ellipsis_view.cpp index a675514c6..5fe648472 100644 --- a/escher/src/ellipsis_view.cpp +++ b/escher/src/ellipsis_view.cpp @@ -18,7 +18,7 @@ void EllipsisView::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate ellipsisHalfHeight = k_ellipsisHeight/2; KDRect frame(widthCenter - ellipsisHalfWidth, heightCenter - ellipsisHalfHeight, k_ellipsisWidth, k_ellipsisHeight); KDColor ellipsisWorkingBuffer[EllipsisView::k_ellipsisWidth*EllipsisView::k_ellipsisHeight]; - ctx->blendRectWithMask(frame, Palette::PrimaryText, (const uint8_t *)ellipsisMask, ellipsisWorkingBuffer); + ctx->blendRectWithMask(frame, *Palette::PrimaryText, (const uint8_t *)ellipsisMask, ellipsisWorkingBuffer); } KDSize EllipsisView::minimalSizeForOptimalDisplay() const { diff --git a/escher/src/even_odd_cell.cpp b/escher/src/even_odd_cell.cpp index 7aa2a15be..529c755a8 100644 --- a/escher/src/even_odd_cell.cpp +++ b/escher/src/even_odd_cell.cpp @@ -16,8 +16,8 @@ void EvenOddCell::setEven(bool even) { KDColor EvenOddCell::backgroundColor() const { // Select the background color according to the even line and the cursor selection - KDColor background = m_even ? Palette::BackgroundHard : Palette::BackgroundApps ; - background = isHighlighted() ? Palette::ListCellBackgroundSelected : background; + KDColor background = m_even ? *Palette::BackgroundHard : *Palette::BackgroundApps ; + background = isHighlighted() ? *Palette::ListCellBackgroundSelected : background; return background; } diff --git a/escher/src/even_odd_editable_text_cell.cpp b/escher/src/even_odd_editable_text_cell.cpp index 0f42d93d3..909f740a2 100644 --- a/escher/src/even_odd_editable_text_cell.cpp +++ b/escher/src/even_odd_editable_text_cell.cpp @@ -5,7 +5,7 @@ EvenOddEditableTextCell::EvenOddEditableTextCell(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * delegate, const KDFont * font, float horizontalAlignment, float verticalAlignment, KDCoordinate topMargin, KDCoordinate rightMargin, KDCoordinate bottomMargin, KDCoordinate leftMargin) : EvenOddCell(), Responder(parentResponder), - m_editableCell(this, inputEventHandlerDelegate, delegate, font, horizontalAlignment, verticalAlignment, Palette::PrimaryText, Palette::BackgroundHard, topMargin, rightMargin, bottomMargin, leftMargin) + m_editableCell(this, inputEventHandlerDelegate, delegate, font, horizontalAlignment, verticalAlignment, *Palette::PrimaryText, *Palette::BackgroundHard, topMargin, rightMargin, bottomMargin, leftMargin) { } diff --git a/escher/src/expression_field.cpp b/escher/src/expression_field.cpp index b151e5687..30a100fab 100644 --- a/escher/src/expression_field.cpp +++ b/escher/src/expression_field.cpp @@ -10,15 +10,15 @@ ExpressionField::ExpressionField(Responder * parentResponder, InputEventHandlerD Responder(parentResponder), View(), m_inputViewMemoizedHeight(0), - m_textField(parentResponder, nullptr, k_textFieldBufferSize, k_textFieldBufferSize, inputEventHandlerDelegate, textFieldDelegate, KDFont::LargeFont, 0.0f, 0.5f, Palette::PrimaryText, Palette::ExpressionInputBackground), + m_textField(parentResponder, nullptr, k_textFieldBufferSize, k_textFieldBufferSize, inputEventHandlerDelegate, textFieldDelegate, KDFont::LargeFont, 0.0f, 0.5f, *Palette::PrimaryText, *Palette::ExpressionInputBackground), m_layoutField(parentResponder, inputEventHandlerDelegate, layoutFieldDelegate) { // Initialize text field m_textField.setMargins(0, k_horizontalMargin, 0, k_horizontalMargin); - m_textField.setBackgroundColor(Palette::ExpressionInputBackground); + m_textField.setBackgroundColor(*Palette::ExpressionInputBackground); // Initialize layout field m_layoutField.setMargins(k_verticalMargin, k_horizontalMargin, k_verticalMargin, k_horizontalMargin); - m_layoutField.setBackgroundColor(Palette::ExpressionInputBackground); + m_layoutField.setBackgroundColor(*Palette::ExpressionInputBackground); } void ExpressionField::setEditing(bool isEditing, bool reinitDraftBuffer) { @@ -77,7 +77,7 @@ void ExpressionField::layoutSubviews(bool force) { void ExpressionField::drawRect(KDContext * ctx, KDRect rect) const { // Draw the separator - ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), Palette::ExpressionInputBorder); + ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), *Palette::ExpressionInputBorder); } bool ExpressionField::handleEvent(Ion::Events::Event event) { diff --git a/escher/src/expression_table_cell.cpp b/escher/src/expression_table_cell.cpp index 83c3c4408..b59fb2341 100644 --- a/escher/src/expression_table_cell.cpp +++ b/escher/src/expression_table_cell.cpp @@ -6,7 +6,7 @@ ExpressionTableCell::ExpressionTableCell(Responder * parentResponder, Layout layout) : Responder(parentResponder), TableCell(layout), - m_labelExpressionView(this, k_horizontalMargin, 0, 0.0f, 0.5f, Palette::PrimaryText, Palette::ListCellBackground) + m_labelExpressionView(this, k_horizontalMargin, 0, 0.0f, 0.5f, *Palette::PrimaryText, *Palette::ListCellBackground) { } @@ -16,7 +16,7 @@ View * ExpressionTableCell::labelView() const { void ExpressionTableCell::setHighlighted(bool highlight) { TableCell::setHighlighted(highlight); - KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_labelExpressionView.setBackgroundColor(backgroundColor); } diff --git a/escher/src/expression_table_cell_with_expression.cpp b/escher/src/expression_table_cell_with_expression.cpp index 7d4b422f1..bac84547f 100644 --- a/escher/src/expression_table_cell_with_expression.cpp +++ b/escher/src/expression_table_cell_with_expression.cpp @@ -5,7 +5,7 @@ ExpressionTableCellWithExpression::ExpressionTableCellWithExpression(Responder * parentResponder) : ExpressionTableCell(parentResponder, Layout::HorizontalLeftOverlap), - m_accessoryExpressionView(this, k_horizontalMargin, 0, 1.0f, 0.5f, Palette::SecondaryText, Palette::ListCellBackground) + m_accessoryExpressionView(this, k_horizontalMargin, 0, 1.0f, 0.5f, *Palette::SecondaryText, *Palette::ListCellBackground) {} View * ExpressionTableCellWithExpression::accessoryView() const { @@ -14,7 +14,7 @@ View * ExpressionTableCellWithExpression::accessoryView() const { void ExpressionTableCellWithExpression::setHighlighted(bool highlight) { ExpressionTableCell::setHighlighted(highlight); - KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_accessoryExpressionView.setBackgroundColor(backgroundColor); } diff --git a/escher/src/expression_table_cell_with_pointer.cpp b/escher/src/expression_table_cell_with_pointer.cpp index 19253a132..c086d9fd6 100644 --- a/escher/src/expression_table_cell_with_pointer.cpp +++ b/escher/src/expression_table_cell_with_pointer.cpp @@ -4,7 +4,7 @@ ExpressionTableCellWithPointer::ExpressionTableCellWithPointer(Responder * parentResponder, I18n::Message accessoryMessage, Layout layout) : ExpressionTableCell(parentResponder, layout), - m_accessoryView(KDFont::SmallFont, accessoryMessage, 0.0f, 0.5f, Palette::SecondaryText, Palette::ListCellBackground) + m_accessoryView(KDFont::SmallFont, accessoryMessage, 0.0f, 0.5f, *Palette::SecondaryText, *Palette::ListCellBackground) { if (layout != Layout::Vertical) { m_accessoryView.setAlignment(1.0f, 0.5f); @@ -17,7 +17,7 @@ View * ExpressionTableCellWithPointer::accessoryView() const { void ExpressionTableCellWithPointer::setHighlighted(bool highlight) { ExpressionTableCell::setHighlighted(highlight); - KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_accessoryView.setBackgroundColor(backgroundColor); } diff --git a/escher/src/expression_view.cpp b/escher/src/expression_view.cpp index 75dab0d4e..ea5e6bf2c 100644 --- a/escher/src/expression_view.cpp +++ b/escher/src/expression_view.cpp @@ -72,6 +72,6 @@ KDPoint ExpressionView::absoluteDrawingOrigin() const { void ExpressionView::drawRect(KDContext * ctx, KDRect rect) const { ctx->fillRect(rect, m_backgroundColor); if (!m_layout.isUninitialized()) { - m_layout.draw(ctx, drawingOrigin(), m_textColor, m_backgroundColor, m_selectionStart, m_selectionEnd, Palette::Select); + m_layout.draw(ctx, drawingOrigin(), m_textColor, m_backgroundColor, m_selectionStart, m_selectionEnd, *Palette::Select); } } diff --git a/escher/src/gauge_view.cpp b/escher/src/gauge_view.cpp index 35055777f..4104aaeca 100644 --- a/escher/src/gauge_view.cpp +++ b/escher/src/gauge_view.cpp @@ -16,7 +16,7 @@ const uint8_t gaugeIndicatorMask[GaugeView::k_indicatorDiameter][GaugeView::k_in GaugeView::GaugeView() : m_level(1), - m_backgroundColor(Palette::ListCellBackground) + m_backgroundColor(*Palette::ListCellBackground) { } @@ -47,10 +47,10 @@ void GaugeView::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate height = bounds().height(); KDColor gaugeIndicatorWorkingBuffer[GaugeView::k_indicatorDiameter*GaugeView::k_indicatorDiameter]; - ctx->fillRect(KDRect(k_indicatorDiameter/2, (height-k_thickness)/2, width*m_level, k_thickness), Palette::ControlEnabled); - ctx->fillRect(KDRect(k_indicatorDiameter/2+width*m_level, (height-k_thickness)/2, width*(1.0f-m_level), k_thickness), Palette::ControlDisabled); + ctx->fillRect(KDRect(k_indicatorDiameter/2, (height-k_thickness)/2, width*m_level, k_thickness), *Palette::ControlEnabled); + ctx->fillRect(KDRect(k_indicatorDiameter/2+width*m_level, (height-k_thickness)/2, width*(1.0f-m_level), k_thickness), *Palette::ControlDisabled); KDRect frame(width*m_level, (height-k_indicatorDiameter)/2, k_indicatorDiameter, k_indicatorDiameter); - ctx->blendRectWithMask(frame, Palette::Control, (const uint8_t *)gaugeIndicatorMask, gaugeIndicatorWorkingBuffer); + ctx->blendRectWithMask(frame, *Palette::Control, (const uint8_t *)gaugeIndicatorMask, gaugeIndicatorWorkingBuffer); } KDSize GaugeView::minimalSizeForOptimalDisplay() const { diff --git a/escher/src/key_view.cpp b/escher/src/key_view.cpp index 8b561ddcc..02f8aeefb 100644 --- a/escher/src/key_view.cpp +++ b/escher/src/key_view.cpp @@ -83,7 +83,7 @@ void KeyView::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate height = bounds().height(); KDRect frame((width - k_keySize)/2, (height - k_keySize)/2, k_keySize, k_keySize); KDColor keyWorkingBuffer[KeyView::k_keySize*KeyView::k_keySize]; - ctx->blendRectWithMask(frame, Palette::PrimaryText, mask(), keyWorkingBuffer); + ctx->blendRectWithMask(frame, *Palette::PrimaryText, mask(), keyWorkingBuffer); } KDSize KeyView::minimalSizeForOptimalDisplay() const { diff --git a/escher/src/layout_field.cpp b/escher/src/layout_field.cpp index cfdbea00c..fc8fa638c 100644 --- a/escher/src/layout_field.cpp +++ b/escher/src/layout_field.cpp @@ -13,7 +13,7 @@ using namespace Poincare; LayoutField::ContentView::ContentView() : m_cursor(), m_insertionCursor(), - m_expressionView(0.0f, 0.5f, Palette::PrimaryText, Palette::BackgroundHard, &m_selectionStart, &m_selectionEnd), + m_expressionView(0.0f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundHard, &m_selectionStart, &m_selectionEnd), m_cursorView(), m_selectionStart(), m_selectionEnd(), diff --git a/escher/src/message_table_cell.cpp b/escher/src/message_table_cell.cpp index 648ef9068..eb494ab75 100644 --- a/escher/src/message_table_cell.cpp +++ b/escher/src/message_table_cell.cpp @@ -4,7 +4,7 @@ MessageTableCell::MessageTableCell(I18n::Message label, const KDFont * font, Layout layout) : TableCell(layout), - m_messageTextView(font, label, 0, 0.5, Palette::PrimaryText, Palette::ListCellBackground), + m_messageTextView(font, label, 0, 0.5, *Palette::PrimaryText, *Palette::ListCellBackground), m_backgroundColor(KDColorWhite) { } @@ -15,7 +15,7 @@ View * MessageTableCell::labelView() const { void MessageTableCell::setHighlighted(bool highlight) { HighlightCell::setHighlighted(highlight); - KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_messageTextView.setBackgroundColor(backgroundColor); } diff --git a/escher/src/message_table_cell_with_buffer.cpp b/escher/src/message_table_cell_with_buffer.cpp index 127e63113..4e10a1910 100644 --- a/escher/src/message_table_cell_with_buffer.cpp +++ b/escher/src/message_table_cell_with_buffer.cpp @@ -22,7 +22,7 @@ View * MessageTableCellWithBuffer::accessoryView() const { void MessageTableCellWithBuffer::setHighlighted(bool highlight) { MessageTableCell::setHighlighted(highlight); - KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_accessoryView.setBackgroundColor(backgroundColor); } diff --git a/escher/src/message_table_cell_with_chevron_and_buffer.cpp b/escher/src/message_table_cell_with_chevron_and_buffer.cpp index db2a17b68..48f782dca 100644 --- a/escher/src/message_table_cell_with_chevron_and_buffer.cpp +++ b/escher/src/message_table_cell_with_chevron_and_buffer.cpp @@ -3,7 +3,7 @@ MessageTableCellWithChevronAndBuffer::MessageTableCellWithChevronAndBuffer(const KDFont * labelFont, const KDFont * subAccessoryFont) : MessageTableCellWithChevron((I18n::Message)0, labelFont), - m_subAccessoryView(subAccessoryFont, 1.0f, 0.5f, Palette::SecondaryText) + m_subAccessoryView(subAccessoryFont, 1.0f, 0.5f, *Palette::SecondaryText) { } @@ -13,7 +13,7 @@ View * MessageTableCellWithChevronAndBuffer::subAccessoryView() const { void MessageTableCellWithChevronAndBuffer::setHighlighted(bool highlight) { MessageTableCellWithChevron::setHighlighted(highlight); - KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_subAccessoryView.setBackgroundColor(backgroundColor); } diff --git a/escher/src/message_table_cell_with_chevron_and_expression.cpp b/escher/src/message_table_cell_with_chevron_and_expression.cpp index 723acc9ae..9fd45aa32 100644 --- a/escher/src/message_table_cell_with_chevron_and_expression.cpp +++ b/escher/src/message_table_cell_with_chevron_and_expression.cpp @@ -4,7 +4,7 @@ MessageTableCellWithChevronAndExpression::MessageTableCellWithChevronAndExpression(I18n::Message message, const KDFont * font) : MessageTableCellWithChevron(message, font), - m_subtitleView(1.0f, 0.5f, Palette::SecondaryText) + m_subtitleView(1.0f, 0.5f, *Palette::SecondaryText) { m_subtitleView.setHorizontalMargin(Metric::ExpressionViewHorizontalMargin); } @@ -15,7 +15,7 @@ View * MessageTableCellWithChevronAndExpression::subAccessoryView() const { void MessageTableCellWithChevronAndExpression::setHighlighted(bool highlight) { MessageTableCellWithChevron::setHighlighted(highlight); - KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_subtitleView.setBackgroundColor(backgroundColor); } diff --git a/escher/src/message_table_cell_with_chevron_and_message.cpp b/escher/src/message_table_cell_with_chevron_and_message.cpp index 4e8cd6b7a..f5e056f76 100644 --- a/escher/src/message_table_cell_with_chevron_and_message.cpp +++ b/escher/src/message_table_cell_with_chevron_and_message.cpp @@ -3,7 +3,7 @@ MessageTableCellWithChevronAndMessage::MessageTableCellWithChevronAndMessage(const KDFont * labelFont, const KDFont * contentFont) : MessageTableCellWithChevron((I18n::Message)0, labelFont), - m_subtitleView(contentFont, (I18n::Message)0, 1.0f, 0.5f, Palette::SecondaryText) + m_subtitleView(contentFont, (I18n::Message)0, 1.0f, 0.5f, *Palette::SecondaryText) { } @@ -13,7 +13,7 @@ View * MessageTableCellWithChevronAndMessage::subAccessoryView() const { void MessageTableCellWithChevronAndMessage::setHighlighted(bool highlight) { MessageTableCellWithChevron::setHighlighted(highlight); - KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_subtitleView.setBackgroundColor(backgroundColor); } diff --git a/escher/src/message_table_cell_with_editable_text.cpp b/escher/src/message_table_cell_with_editable_text.cpp index b0ff43b91..465e0c007 100644 --- a/escher/src/message_table_cell_with_editable_text.cpp +++ b/escher/src/message_table_cell_with_editable_text.cpp @@ -32,7 +32,7 @@ void MessageTableCellWithEditableText::setEditing(bool isEditing) { void MessageTableCellWithEditableText::setHighlighted(bool highlight) { MessageTableCell::setHighlighted(highlight); - KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_textField.setBackgroundColor(backgroundColor); } diff --git a/escher/src/message_table_cell_with_expression.cpp b/escher/src/message_table_cell_with_expression.cpp index 6b3f5b5d1..bab961566 100644 --- a/escher/src/message_table_cell_with_expression.cpp +++ b/escher/src/message_table_cell_with_expression.cpp @@ -3,7 +3,7 @@ MessageTableCellWithExpression::MessageTableCellWithExpression(I18n::Message message, const KDFont * font) : MessageTableCell(message, font), - m_subtitleView(1.0f, 0.5f, Palette::SecondaryText) + m_subtitleView(1.0f, 0.5f, *Palette::SecondaryText) { } @@ -13,7 +13,7 @@ View * MessageTableCellWithExpression::accessoryView() const { void MessageTableCellWithExpression::setHighlighted(bool highlight) { MessageTableCell::setHighlighted(highlight); - KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_subtitleView.setBackgroundColor(backgroundColor); } diff --git a/escher/src/message_table_cell_with_gauge.cpp b/escher/src/message_table_cell_with_gauge.cpp index f9b996a8b..d649faa0d 100644 --- a/escher/src/message_table_cell_with_gauge.cpp +++ b/escher/src/message_table_cell_with_gauge.cpp @@ -13,6 +13,6 @@ View * MessageTableCellWithGauge::accessoryView() const { void MessageTableCellWithGauge::setHighlighted(bool highlight) { MessageTableCell::setHighlighted(highlight); - KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_accessoryView.setBackgroundColor(backgroundColor); } diff --git a/escher/src/message_table_cell_with_message.cpp b/escher/src/message_table_cell_with_message.cpp index 16cfd3c6e..00360c8b8 100644 --- a/escher/src/message_table_cell_with_message.cpp +++ b/escher/src/message_table_cell_with_message.cpp @@ -25,7 +25,7 @@ View * MessageTableCellWithMessage::accessoryView() const { void MessageTableCellWithMessage::setHighlighted(bool highlight) { MessageTableCell::setHighlighted(highlight); - KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; m_accessoryView.setBackgroundColor(backgroundColor); } diff --git a/escher/src/modal_view_empty_controller.cpp b/escher/src/modal_view_empty_controller.cpp index f8f7056df..512ab1570 100644 --- a/escher/src/modal_view_empty_controller.cpp +++ b/escher/src/modal_view_empty_controller.cpp @@ -2,7 +2,7 @@ #include #include -constexpr KDColor ModalViewEmptyController::ModalViewEmptyView::k_backgroundColor; +KDColor const * ModalViewEmptyController::ModalViewEmptyView::k_backgroundColor = Palette::WallScreen; // ModalViewEmptyController::ModalViewEmptyView void ModalViewEmptyController::ModalViewEmptyView::initMessageViews() { @@ -10,7 +10,7 @@ void ModalViewEmptyController::ModalViewEmptyView::initMessageViews() { for (int i = 0; i < numberOfMessageViews; i++) { MessageTextView * message = messageTextViewAtIndex(i); message->setFont(k_font); - message->setBackgroundColor(k_backgroundColor); + message->setBackgroundColor(*k_backgroundColor); float verticalAlignment = 0.5f; if (i == 0) { verticalAlignment = 1.0f; @@ -29,8 +29,8 @@ void ModalViewEmptyController::ModalViewEmptyView::setMessages(I18n::Message * m } void ModalViewEmptyController::ModalViewEmptyView::drawRect(KDContext * ctx, KDRect rect) const { - ctx->fillRect(bounds(), k_backgroundColor); - drawBorderOfRect(ctx, bounds(), Palette::ListCellBorder); + ctx->fillRect(bounds(), *k_backgroundColor); + drawBorderOfRect(ctx, bounds(), *Palette::ListCellBorder); } int ModalViewEmptyController::ModalViewEmptyView::numberOfSubviews() const { diff --git a/escher/src/nested_menu_controller.cpp b/escher/src/nested_menu_controller.cpp index 735f5a32c..143d1c191 100644 --- a/escher/src/nested_menu_controller.cpp +++ b/escher/src/nested_menu_controller.cpp @@ -89,7 +89,7 @@ void NestedMenuController::ListController::setFirstSelectedRow(int firstSelected /* NestedMenuController */ NestedMenuController::NestedMenuController(Responder * parentResponder, I18n::Message title) : - StackViewController(parentResponder, &m_listController, Palette::ToolboxHeaderText, Palette::ToolboxHeaderBackground, Palette::ToolboxHeaderBorder), + StackViewController(parentResponder, &m_listController, *Palette::ToolboxHeaderText, *Palette::ToolboxHeaderBackground, *Palette::ToolboxHeaderBorder), m_selectableTableView(&m_listController, this, this, this), m_listController(this, &m_selectableTableView, title), m_sender(nullptr) diff --git a/escher/src/palette.cpp b/escher/src/palette.cpp index c77487251..2f9e28c0e 100644 --- a/escher/src/palette.cpp +++ b/escher/src/palette.cpp @@ -1,161 +1,10 @@ #include #include -constexpr KDColor Palette::PrimaryText; -constexpr KDColor Palette::SecondaryText; // =GREYDARK -constexpr KDColor Palette::AccentText; -constexpr KDColor Palette::BackgroundHard; -constexpr KDColor Palette::BackgroundApps; -constexpr KDColor Palette::BackgroundAppsSecondary; -constexpr KDColor Palette::Toolbar; -constexpr KDColor Palette::ToolbarText; -constexpr KDColor Palette::ExpressionInputBackground; -constexpr KDColor Palette::ExpressionInputBorder; -constexpr KDColor Palette::Battery; -constexpr KDColor Palette::BatteryInCharge; -constexpr KDColor Palette::BatteryLow; -constexpr KDColor Palette::ApproximateSignText; -constexpr KDColor Palette::ApproximateExpressionText; -constexpr KDColor Palette::ScrollBarForeground; -constexpr KDColor Palette::ScrollBarBackground; - -constexpr KDColor Palette::Control; -constexpr KDColor Palette::ControlEnabled; -constexpr KDColor Palette::ControlDisabled; - -constexpr KDColor Palette::CalculationBackgroundOdd; -constexpr KDColor Palette::CalculationBackgroundEven; -constexpr KDColor Palette::CalculationEmptyBox; -constexpr KDColor Palette::CalculationEmptyBoxNeeded; -constexpr KDColor Palette::CalculationTrigoAndComplexForeground; - -constexpr KDColor Palette::CodeBackground; -constexpr KDColor Palette::CodeBackgroundSelected; -constexpr KDColor Palette::CodeText; -constexpr KDColor Palette::CodeComment; -constexpr KDColor Palette::CodeNumber; -constexpr KDColor Palette::CodeKeyword; -constexpr KDColor Palette::CodeOperator; -constexpr KDColor Palette::CodeString; -constexpr KDColor Palette::CodeGutterViewBackground; - -constexpr KDColor Palette::ProbabilityCurve; -constexpr KDColor Palette::ProbabilityCellBorder; -constexpr KDColor Palette::ProbabilityHistogramBar; - -constexpr KDColor Palette::StatisticsBox; -constexpr KDColor Palette::StatisticsBoxVerticalLine; -constexpr KDColor Palette::StatisticsSelected; -constexpr KDColor Palette::StatisticsNotSelected; - -constexpr KDColor Palette::GraphTangent; - -constexpr KDColor Palette::SubMenuBackground; -constexpr KDColor Palette::SubMenuBorder; -constexpr KDColor Palette::SubMenuText; - -constexpr KDColor Palette::ToolboxHeaderBackground; -constexpr KDColor Palette::ToolboxHeaderText; -constexpr KDColor Palette::ToolboxHeaderBorder; -constexpr KDColor Palette::ToolboxBackground; - -constexpr KDColor Palette::ListCellBackground; -constexpr KDColor Palette::ListCellBackgroundSelected; -constexpr KDColor Palette::ListCellBorder; - -constexpr KDColor Palette::ButtonBackground; -constexpr KDColor Palette::ButtonBackgroundSelected; -constexpr KDColor Palette::ButtonBackgroundSelectedHighContrast; -constexpr KDColor Palette::ButtonBorder; -constexpr KDColor Palette::ButtonRowBorder; -constexpr KDColor Palette::ButtonBorderOut; -constexpr KDColor Palette::ButtonShadow; -constexpr KDColor Palette::ButtonText; - -constexpr KDColor Palette::TabBackground; -constexpr KDColor Palette::TabBackgroundSelected; -constexpr KDColor Palette::TabBackgroundActive; -constexpr KDColor Palette::TabBackgroundSelectedAndActive; -constexpr KDColor Palette::TabText; -constexpr KDColor Palette::TabTextActive; - -constexpr KDColor Palette::SubTabBackground; -constexpr KDColor Palette::SubTabBackgroundSelected; -constexpr KDColor Palette::SubTabText; - -constexpr KDColor Palette::BannerFirstBackground; -constexpr KDColor Palette::BannerFirstBorder; -constexpr KDColor Palette::BannerFirstText; -constexpr KDColor Palette::BannerFirstVariantBackground; -constexpr KDColor Palette::BannerFirstVariantBorder; -constexpr KDColor Palette::BannerFirstVariantText; -constexpr KDColor Palette::BannerSecondBackground; -constexpr KDColor Palette::BannerSecondBorder; -constexpr KDColor Palette::BannerSecondText; -constexpr KDColor Palette::GridPrimaryLine; -constexpr KDColor Palette::GridSecondaryLine; - -constexpr KDColor Palette::HomeBackground; -constexpr KDColor Palette::HomeCellBackground; -constexpr KDColor Palette::HomeCellBackgroundActive; -constexpr KDColor Palette::HomeCellText; -constexpr KDColor Palette::HomeCellTextActive; -constexpr KDColor Palette::HomeCellTextExternal; -constexpr KDColor Palette::HomeCellTextExternalActive; - -constexpr KDColor Palette::YellowDark; // Done -constexpr KDColor Palette::YellowLight; // Done -constexpr KDColor Palette::PurpleBright; // Done -constexpr KDColor Palette::PurpleDark; // Done -constexpr KDColor Palette::GrayWhite; // Done -constexpr KDColor Palette::GrayBright; // Done -constexpr KDColor Palette::GrayMiddle; // Done -constexpr KDColor Palette::GrayDark; // Done -constexpr KDColor Palette::GrayVeryDark; // Done -constexpr KDColor Palette::Select; // Done -constexpr KDColor Palette::SelectDark; // Done -constexpr KDColor Palette::WallScreen; // Done -constexpr KDColor Palette::WallScreenDark; // Done -constexpr KDColor Palette::SubTab; // Done -constexpr KDColor Palette::LowBattery; // Done -constexpr KDColor Palette::Red; -constexpr KDColor Palette::RedLight; -constexpr KDColor Palette::Magenta; -constexpr KDColor Palette::Turquoise; -constexpr KDColor Palette::Pink; -constexpr KDColor Palette::Blue; -constexpr KDColor Palette::BlueLight; -constexpr KDColor Palette::Orange; -constexpr KDColor Palette::Green; -constexpr KDColor Palette::GreenLight; -constexpr KDColor Palette::Brown; -constexpr KDColor Palette::Purple; -constexpr KDColor Palette::Cyan; // TODO Palette change -constexpr KDColor Palette::BlueishGrey; // TODO Palette change -constexpr KDColor Palette::DataColor[]; -constexpr KDColor Palette::DataColorLight[]; - -constexpr KDColor Palette::AtomUnknown; -constexpr KDColor Palette::AtomText; -constexpr KDColor Palette::AtomAlkaliMetal; -constexpr KDColor Palette::AtomAlkaliEarthMetal; -constexpr KDColor Palette::AtomLanthanide; -constexpr KDColor Palette::AtomActinide; -constexpr KDColor Palette::AtomTransitionMetal; -constexpr KDColor Palette::AtomPostTransitionMetal; -constexpr KDColor Palette::AtomMetalloid; -constexpr KDColor Palette::AtomHalogen; -constexpr KDColor Palette::AtomReactiveNonmetal; -constexpr KDColor Palette::AtomNobleGas; -constexpr KDColor Palette::AtomTableLines; -constexpr KDColor Palette::AtomBackground; -constexpr KDColor Palette::AtomHighlight; -constexpr KDColor Palette::AtomColor[]; - KDColor Palette::nextDataColor(int * colorIndex) { size_t nbOfColors = numberOfDataColors(); assert(*colorIndex < nbOfColors); - KDColor c = DataColor[*colorIndex]; + KDColor c = *DataColor[*colorIndex]; *colorIndex = (*colorIndex + 1) % nbOfColors; return c; } diff --git a/escher/src/scroll_view.cpp b/escher/src/scroll_view.cpp index a653ae4cf..b918a7f3c 100644 --- a/escher/src/scroll_view.cpp +++ b/escher/src/scroll_view.cpp @@ -16,7 +16,7 @@ ScrollView::ScrollView(View * contentView, ScrollViewDataSource * dataSource) : m_bottomMargin(0), m_leftMargin(0), m_decorators(), - m_backgroundColor(Palette::BackgroundApps) + m_backgroundColor(*Palette::BackgroundApps) { assert(m_dataSource != nullptr); setDecoratorType(Decorator::Type::Bars); diff --git a/escher/src/scroll_view_indicator.cpp b/escher/src/scroll_view_indicator.cpp index aa9e78f94..c3fe0f21b 100644 --- a/escher/src/scroll_view_indicator.cpp +++ b/escher/src/scroll_view_indicator.cpp @@ -8,7 +8,7 @@ extern "C" { ScrollViewIndicator::ScrollViewIndicator() : View(), - m_color(Palette::ScrollBarForeground), + m_color(*Palette::ScrollBarForeground), m_margin(Metric::CommonTopMargin) { } @@ -17,7 +17,7 @@ ScrollViewBar::ScrollViewBar() : ScrollViewIndicator(), m_offset(0), m_visibleLength(0), - m_trackColor(Palette::ScrollBarBackground) + m_trackColor(*Palette::ScrollBarBackground) { } diff --git a/escher/src/switch_view.cpp b/escher/src/switch_view.cpp index 804ae87cb..21230cf1d 100644 --- a/escher/src/switch_view.cpp +++ b/escher/src/switch_view.cpp @@ -43,7 +43,7 @@ void SwitchView::drawRect(KDContext * ctx, KDRect rect) const { KDRect frame(width - k_switchWidth, heightCenter - halfHeight, k_switchWidth, k_switchHeight); ctx->blendRectWithMask( frame, - m_state ? Palette::Control : Palette::ControlDisabled, + m_state ? *Palette::Control : *Palette::ControlDisabled, reinterpret_cast(switchMask), workingBuffer); @@ -52,7 +52,7 @@ void SwitchView::drawRect(KDContext * ctx, KDRect rect) const { KDRect onOffFrame(onOffX, heightCenter - halfHeight, k_onOffSize, k_onOffSize); ctx->blendRectWithMask( onOffFrame, - Palette::ListCellBackground, + *Palette::ListCellBackground, reinterpret_cast(onOffMask), workingBuffer); } \ No newline at end of file diff --git a/escher/src/tab_view.cpp b/escher/src/tab_view.cpp index 5a7dd8011..ce3ae07ef 100644 --- a/escher/src/tab_view.cpp +++ b/escher/src/tab_view.cpp @@ -20,7 +20,7 @@ void TabView::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate height = bounds().height(); KDCoordinate width = bounds().width(); // Draw a separator with the content - ctx->fillRect(KDRect(0, height-k_activeTabHeight, width, k_activeTabHeight), Palette::BackgroundHard); + ctx->fillRect(KDRect(0, height-k_activeTabHeight, width, k_activeTabHeight), *Palette::BackgroundHard); } void TabView::addTab(ViewController * controller) { diff --git a/escher/src/tab_view_cell.cpp b/escher/src/tab_view_cell.cpp index 63e0c7d1a..dcc446736 100644 --- a/escher/src/tab_view_cell.cpp +++ b/escher/src/tab_view_cell.cpp @@ -35,13 +35,13 @@ void TabViewCell::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate height = bounds().height(); KDCoordinate width = bounds().width(); // choose the background color - KDColor text = m_active ? Palette::TabTextActive : Palette::TabText; - KDColor background = m_active ? Palette::TabBackgroundActive : Palette::TabBackground; - KDColor selection = m_active ? Palette::TabBackgroundSelectedAndActive : Palette::TabBackgroundSelected; + KDColor text = m_active ? *Palette::TabTextActive : *Palette::TabText; + KDColor background = m_active ? *Palette::TabBackgroundActive : *Palette::TabBackground; + KDColor selection = m_active ? *Palette::TabBackgroundSelectedAndActive : *Palette::TabBackgroundSelected; background = m_selected ? selection : background; // Color the background according to the state of the tab cell if (m_active || m_selected) { - ctx->fillRect(KDRect(0, 0, width, 1), Palette::TabBackgroundSelected); + ctx->fillRect(KDRect(0, 0, width, 1), *Palette::TabBackgroundSelected); ctx->fillRect(KDRect(0, 1, width, height-1), background); } else { ctx->fillRect(KDRect(0, 0, width, height), background); diff --git a/escher/src/table_cell.cpp b/escher/src/table_cell.cpp index b0ce6c15d..648b0ac9b 100644 --- a/escher/src/table_cell.cpp +++ b/escher/src/table_cell.cpp @@ -165,7 +165,7 @@ void TableCell::layoutSubviews(bool force) { } void TableCell::drawRect(KDContext * ctx, KDRect rect) const { - KDColor backColor = isHighlighted() ? Palette::ListCellBackgroundSelected : Palette::ListCellBackground; + KDColor backColor = isHighlighted() ? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground; drawInnerRect(ctx, bounds(), backColor); - drawBorderOfRect(ctx, bounds(), Palette::ListCellBorder); + drawBorderOfRect(ctx, bounds(), *Palette::ListCellBorder); } diff --git a/escher/src/text_cursor_view.cpp b/escher/src/text_cursor_view.cpp index 437742157..a97d12105 100644 --- a/escher/src/text_cursor_view.cpp +++ b/escher/src/text_cursor_view.cpp @@ -3,7 +3,7 @@ void TextCursorView::drawRect(KDContext * ctx, KDRect rect) const { KDCoordinate height = bounds().height(); - ctx->fillRect(KDRect(0, 0, 1, height), Palette::PrimaryText); + ctx->fillRect(KDRect(0, 0, 1, height), *Palette::PrimaryText); } KDSize TextCursorView::minimalSizeForOptimalDisplay() const { diff --git a/escher/src/text_field.cpp b/escher/src/text_field.cpp index 4411f12a4..559772dbc 100644 --- a/escher/src/text_field.cpp +++ b/escher/src/text_field.cpp @@ -42,7 +42,7 @@ void TextField::ContentView::setTextColor(KDColor textColor) { void TextField::ContentView::drawRect(KDContext * ctx, KDRect rect) const { KDColor backgroundColor = m_backgroundColor; /*if (m_isEditing) { - backgroundColor = Palette::BackgroundHard; + backgroundColor = *Palette::BackgroundHard; }*/ ctx->fillRect(bounds(), backgroundColor); if (selectionIsEmpty()) { @@ -55,7 +55,7 @@ void TextField::ContentView::drawRect(KDContext * ctx, KDRect rect) const { int selectionLength = m_selectionEnd - m_selectionStart; textToDraw += selectionOffset; // Draw the selected text - ctx->drawString(text() + selectionOffset, glyphFrameAtPosition(text(), textToDraw).origin(), m_font, m_textColor, Palette::Select, selectionLength); + ctx->drawString(text() + selectionOffset, glyphFrameAtPosition(text(), textToDraw).origin(), m_font, m_textColor, *Palette::Select, selectionLength); textToDraw += selectionLength; // Draw the non selected text on the right of the selection ctx->drawString(text() + selectionOffset + selectionLength, glyphFrameAtPosition(text(), textToDraw).origin(), m_font, m_textColor, backgroundColor); diff --git a/escher/src/toggleable_dot_view.cpp b/escher/src/toggleable_dot_view.cpp index a267cb922..0a7af9d4a 100644 --- a/escher/src/toggleable_dot_view.cpp +++ b/escher/src/toggleable_dot_view.cpp @@ -35,7 +35,7 @@ void ToggleableDotView::drawRect(KDContext * ctx, KDRect rect) const { KDRect frame(width - k_dotSize, heightCenter - halfHeight, k_dotSize, k_dotSize); ctx->blendRectWithMask( frame, - m_state ? Palette::Control : Palette::GrayDark, + m_state ? *Palette::Control : *Palette::GrayDark, m_state ? reinterpret_cast(MediumDotMask) : reinterpret_cast(MediumShallowDotMask), workingBuffer); } diff --git a/escher/src/toolbox.cpp b/escher/src/toolbox.cpp index 29f22a041..c0e0b4077 100644 --- a/escher/src/toolbox.cpp +++ b/escher/src/toolbox.cpp @@ -30,7 +30,7 @@ void Toolbox::willDisplayCellForIndex(HighlightCell * cell, int index) { MessageTableCellWithMessage * myCell = (MessageTableCellWithMessage *)cell; myCell->setMessage(messageTree->label()); myCell->setAccessoryMessage(messageTree->text()); - myCell->setAccessoryTextColor(Palette::SecondaryText); + myCell->setAccessoryTextColor(*Palette::SecondaryText); return; } MessageTableCell * myCell = (MessageTableCell *)cell; diff --git a/escher/src/warning_controller.cpp b/escher/src/warning_controller.cpp index 5ca4e8526..7303450e9 100644 --- a/escher/src/warning_controller.cpp +++ b/escher/src/warning_controller.cpp @@ -4,8 +4,8 @@ WarningController::ContentView::ContentView() : SolidColorView(KDColorBlack), - m_textView1(KDFont::SmallFont, (I18n::Message)0, k_middleAlignment, k_middleAlignment, Palette::BackgroundHard, Palette::PrimaryText), - m_textView2(KDFont::SmallFont, (I18n::Message)0, k_middleAlignment, (1.0f-k_shiftedAlignment), Palette::BackgroundHard, Palette::PrimaryText) + m_textView1(KDFont::SmallFont, (I18n::Message)0, k_middleAlignment, k_middleAlignment, *Palette::BackgroundHard, *Palette::PrimaryText), + m_textView2(KDFont::SmallFont, (I18n::Message)0, k_middleAlignment, (1.0f-k_shiftedAlignment), *Palette::BackgroundHard, *Palette::PrimaryText) { } diff --git a/kandinsky/Makefile b/kandinsky/Makefile index 16cfdc668..e0bceef2d 100644 --- a/kandinsky/Makefile +++ b/kandinsky/Makefile @@ -19,6 +19,7 @@ kandinsky_src += $(addprefix kandinsky/src/,\ postprocess_invert_context.cpp \ postprocess_zoom_context.cpp \ rect.cpp \ + theme_buffer.cpp \ ) kandinsky_src += $(addprefix kandinsky/fonts/, \ diff --git a/kandinsky/include/kandinsky/color.h b/kandinsky/include/kandinsky/color.h index 1ac9b91dc..d8cc6425b 100644 --- a/kandinsky/include/kandinsky/color.h +++ b/kandinsky/include/kandinsky/color.h @@ -39,13 +39,13 @@ private: uint16_t m_value; }; -constexpr KDColor KDColorBlack = KDColor::RGB24(0x000000); -constexpr KDColor KDColorWhite = KDColor::RGB24(0xFFFFFF); -constexpr KDColor KDColorRed = KDColor::RGB24(0xFF0000); -constexpr KDColor KDColorGreen = KDColor::RGB24(0x00FF00); -constexpr KDColor KDColorBlue = KDColor::RGB24(0x0000FF); -constexpr KDColor KDColorYellow = KDColor::RGB24(0xFFFF00); -constexpr KDColor KDColorOrange = KDColor::RGB24(0xFF9900); -constexpr KDColor KDColorPurple = KDColor::RGB24(0xFF00DD); +static constexpr KDColor KDColorBlack = KDColor::RGB24(0x000000); +static constexpr KDColor KDColorWhite = KDColor::RGB24(0xFFFFFF); +static constexpr KDColor KDColorRed = KDColor::RGB24(0xFF0000); +static constexpr KDColor KDColorGreen = KDColor::RGB24(0x00FF00); +static constexpr KDColor KDColorBlue = KDColor::RGB24(0x0000FF); +static constexpr KDColor KDColorYellow = KDColor::RGB24(0xFFFF00); +static constexpr KDColor KDColorOrange = KDColor::RGB24(0xFF9900); +static constexpr KDColor KDColorPurple = KDColor::RGB24(0xFF00DD); #endif diff --git a/kandinsky/src/theme_buffer.cpp b/kandinsky/src/theme_buffer.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/poincare/include/poincare/layout.h b/poincare/include/poincare/layout.h index 96d49ec58..7efd52a57 100644 --- a/poincare/include/poincare/layout.h +++ b/poincare/include/poincare/layout.h @@ -32,7 +32,7 @@ public: bool isIdenticalTo(Layout l) { return isUninitialized() ? l.isUninitialized() : node()->isIdenticalTo(l); } // Rendering - void draw(KDContext * ctx, KDPoint p, KDColor expressionColor = KDColorBlack, KDColor backgroundColor = KDColorWhite, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = Palette::Select) { + void draw(KDContext * ctx, KDPoint p, KDColor expressionColor = KDColorBlack, KDColor backgroundColor = KDColorWhite, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = *Palette::Select) { return node()->draw(ctx, p, expressionColor, backgroundColor, selectionStart, selectionEnd, selectionColor); } void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) { diff --git a/poincare/include/poincare/layout_node.h b/poincare/include/poincare/layout_node.h index e2aaf7a89..657b5042e 100644 --- a/poincare/include/poincare/layout_node.h +++ b/poincare/include/poincare/layout_node.h @@ -62,7 +62,7 @@ public: bool isIdenticalTo(Layout l); // Rendering - void draw(KDContext * ctx, KDPoint p, KDColor expressionColor = Palette::PrimaryText, KDColor backgroundColor = Palette::BackgroundHard, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed); + void draw(KDContext * ctx, KDPoint p, KDColor expressionColor = *Palette::PrimaryText, KDColor backgroundColor = *Palette::BackgroundHard, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed); KDPoint absoluteOrigin(); KDSize layoutSize(); KDCoordinate baseline(); diff --git a/poincare/src/empty_layout.cpp b/poincare/src/empty_layout.cpp index 3200c2d9b..f6f29774c 100644 --- a/poincare/src/empty_layout.cpp +++ b/poincare/src/empty_layout.cpp @@ -88,7 +88,7 @@ bool EmptyLayoutNode::willAddSibling(LayoutCursor * cursor, LayoutNode * sibling void EmptyLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) { if (m_isVisible) { - KDColor fillColor = m_color == Color::Yellow ? Palette::CalculationEmptyBoxNeeded : Palette::CalculationEmptyBox; + KDColor fillColor = m_color == Color::Yellow ? *Palette::CalculationEmptyBoxNeeded : *Palette::CalculationEmptyBox; ctx->fillRect(KDRect(p.x()+(m_margins ? k_marginWidth : 0), p.y()+(m_margins ? k_marginHeight : 0), width(), height()), fillColor); ctx->fillRect(KDRect(p.x()+(m_margins ? k_marginWidth : 0), p.y()+(m_margins ? k_marginHeight : 0), width(), height()), fillColor); } diff --git a/python/port/mod/kandinsky/modkandinsky.cpp b/python/port/mod/kandinsky/modkandinsky.cpp index 8053979f8..3141c42e9 100644 --- a/python/port/mod/kandinsky/modkandinsky.cpp +++ b/python/port/mod/kandinsky/modkandinsky.cpp @@ -60,8 +60,8 @@ mp_obj_t modkandinsky_set_pixel(mp_obj_t x, mp_obj_t y, mp_obj_t input) { mp_obj_t modkandinsky_draw_string(size_t n_args, const mp_obj_t * args) { const char * text = mp_obj_str_get_str(args[0]); KDPoint point(mp_obj_get_int(args[1]), mp_obj_get_int(args[2])); - KDColor textColor = (n_args >= 4) ? MicroPython::Color::Parse(args[3]) : Palette::PrimaryText; - KDColor backgroundColor = (n_args >= 5) ? MicroPython::Color::Parse(args[4]) : Palette::HomeBackground; + KDColor textColor = (n_args >= 4) ? MicroPython::Color::Parse(args[3]) : *Palette::PrimaryText; + KDColor backgroundColor = (n_args >= 5) ? MicroPython::Color::Parse(args[4]) : *Palette::HomeBackground; const KDFont * font = (n_args >= 6) ? ((mp_obj_is_true(args[5])) ? KDFont::SmallFont : KDFont::LargeFont) : KDFont::LargeFont; MicroPython::ExecutionEnvironment::currentExecutionEnvironment()->displaySandbox(); KDIonContext::sharedContext()->drawString(text, point, font, textColor, backgroundColor); @@ -249,11 +249,11 @@ mp_obj_t modkandinsky_get_keys() { mp_obj_t modkandinsky_get_palette() { mp_obj_t modkandinsky_palette_table = mp_obj_new_dict(0); - mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_PrimaryText), TupleForKDColor(Palette::PrimaryText)); - mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_SecondaryText), TupleForKDColor(Palette::SecondaryText)); - mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_AccentText), TupleForKDColor(Palette::AccentText)); - mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_Toolbar), TupleForKDColor(Palette::Toolbar)); - mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_HomeBackground), TupleForKDColor(Palette::HomeBackground)); + mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_PrimaryText), TupleForKDColor(*Palette::PrimaryText)); + mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_SecondaryText), TupleForKDColor(*Palette::SecondaryText)); + mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_AccentText), TupleForKDColor(*Palette::AccentText)); + mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_Toolbar), TupleForKDColor(*Palette::Toolbar)); + mp_obj_dict_store(modkandinsky_palette_table, MP_ROM_QSTR(MP_QSTR_HomeBackground), TupleForKDColor(*Palette::HomeBackground)); return modkandinsky_palette_table; } diff --git a/python/port/port.cpp b/python/port/port.cpp index 76c707372..ca2807967 100644 --- a/python/port/port.cpp +++ b/python/port/port.cpp @@ -230,20 +230,20 @@ KDColor MicroPython::Color::Parse(mp_obj_t input, Mode mode){ if (mp_obj_is_str(input)) { size_t l; const char * color = mp_obj_str_get_data(input, &l); - constexpr NamedColor pairs[] = { - NamedColor("blue", KDColorBlue), - NamedColor("b", KDColorBlue), - NamedColor("red", KDColorRed), - NamedColor("r", KDColorRed), + const NamedColor pairs[] = { + NamedColor("blue", &KDColorBlue), + NamedColor("b", &KDColorBlue), + NamedColor("red", &KDColorRed), + NamedColor("r", &KDColorRed), NamedColor("green", Palette::Green), NamedColor("g", Palette::Green), - NamedColor("yellow", KDColorYellow), - NamedColor("y", KDColorYellow), + NamedColor("yellow", &KDColorYellow), + NamedColor("y", &KDColorYellow), NamedColor("brown", Palette::Brown), - NamedColor("black", KDColorBlack), - NamedColor("k", KDColorBlack), - NamedColor("white", KDColorWhite), - NamedColor("w", KDColorWhite), + NamedColor("black", &KDColorBlack), + NamedColor("k", &KDColorBlack), + NamedColor("white", &KDColorWhite), + NamedColor("w", &KDColorWhite), NamedColor("pink", Palette::Pink), NamedColor("orange", Palette::Orange), NamedColor("purple", Palette::Purple), diff --git a/python/port/port.h b/python/port/port.h index 75a973887..58d6e2a8b 100644 --- a/python/port/port.h +++ b/python/port/port.h @@ -52,15 +52,15 @@ public: private: class NamedColor { public: - constexpr NamedColor(const char * name, KDColor color) : + constexpr NamedColor(const char * name, KDColor const * color) : m_name(name), m_color(color) {} const char * name() const { return m_name; } - KDColor color() const { return m_color; } + KDColor color() const { return *m_color; } private: const char * m_name; - KDColor m_color; + KDColor const * m_color; }; }; diff --git a/themes/themes_manager.py b/themes/themes_manager.py index cdc5997af..ce270a821 100644 --- a/themes/themes_manager.py +++ b/themes/themes_manager.py @@ -71,17 +71,7 @@ def get_data(theme, path): return data -def write_palette_h(data, file_p): - """ - Write the header to file_p - """ - file_p.write("#ifndef ESCHER_PALETTE_H\n") - file_p.write("#define ESCHER_PALETTE_H\n\n") - file_p.write("#include \n") - file_p.write("#include \n\n") - file_p.write("class Palette {\n") - file_p.write("public:\n") - +def make_palette(data): # Default values - sometimes never used defaults = { "YellowDark": "ffb734", @@ -115,35 +105,72 @@ def write_palette_h(data, file_p): "Cyan": "00ffff", } + palette = [] + for key in data["colors"].keys(): if type(data["colors"][key]) is str: - file_p.write(" constexpr static KDColor " + key + " = KDColor::RGB24(0x" + data["colors"][key] + ");\n") + palette.append((key, data["colors"][key])) if defaults.keys().__contains__(key): del defaults[key] else: for sub_key in data["colors"][key].keys(): - file_p.write(" constexpr static KDColor " + key + sub_key + " = KDColor::RGB24(0x" + data["colors"][key][sub_key] + ");\n") + palette.append((key + sub_key, data["colors"][key][sub_key])) if defaults.keys().__contains__(key+sub_key): del defaults[key+sub_key] - for key in defaults.keys(): - file_p.write(" constexpr static KDColor " + key + " = KDColor::RGB24(0x" + defaults[key] + ");\n") + palette.append((key, defaults[key])) - file_p.write(" constexpr static KDColor DataColor[] = {Red, Blue, Green, YellowDark, Magenta, Turquoise, Pink, Orange};\n") - file_p.write(" constexpr static KDColor DataColorLight[] = {RedLight, BlueLight, GreenLight, YellowLight};\n") + return palette - file_p.write(" constexpr static KDColor AtomColor[] = {\n") - file_p.write(" AtomUnknown, AtomAlkaliMetal, AtomAlkaliEarthMetal, AtomLanthanide, AtomActinide, AtomTransitionMetal,\n") - file_p.write(" AtomPostTransitionMetal, AtomMetalloid, AtomHalogen, AtomReactiveNonmetal, AtomNobleGas\n") - file_p.write(" };\n\n") +def write_palette_h(palette, file_p): + """ + Write the header to file_p + """ + file_p.write("#ifndef ESCHER_PALETTE_H\n") + file_p.write("#define ESCHER_PALETTE_H\n\n") + file_p.write("#include \n") + file_p.write("#include \n\n") + file_p.write("class Palette {\n") + file_p.write("public:\n") - file_p.write(" constexpr static size_t numberOfDataColors() { return sizeof(DataColor)/sizeof(KDColor); }\n") - file_p.write(" constexpr static size_t numberOfLightDataColors() { return sizeof(DataColorLight)/sizeof(KDColor); }\n") + file_p.write(f" static KDColor const palette[" + str(len(palette)) + "];") + + for name, color in palette: + file_p.write(f"\n static KDColor const * {name};") + + file_p.write(" static KDColor const * DataColor[8];\n") + file_p.write(" static KDColor const * DataColorLight[4];\n") + file_p.write(" static KDColor const * AtomColor[11];\n") + + file_p.write(" const static size_t numberOfDataColors() { return 8; }\n") + file_p.write(" const static size_t numberOfLightDataColors() { return 4; }\n") file_p.write(" static KDColor nextDataColor(int * colorIndex);\n") - file_p.write("};\n\n") + file_p.write("};\n\n") file_p.write("#endif\n") +def write_palette_cpp(palette, file_p): + file_p.write("#include \"palette.h\"\n\n") + + file_p.write("KDColor const Palette::palette[" + str(len(palette)) + "] = {") + + for name, color in palette: + file_p.write("KDColor::RGB24(0x" + color + "), ") + + file_p.write(" };\n") + + for index, (name, color) in enumerate(palette): + file_p.write(f"KDColor const * Palette::" + name + " = Palette::palette + " + str(index) + ";\n") + + + file_p.write("KDColor const * Palette::DataColor[] = {Red, Blue, Green, YellowDark, Magenta, Turquoise, Pink, Orange};\n") + file_p.write("KDColor const * Palette::DataColorLight[] = {RedLight, BlueLight, GreenLight, YellowLight};\n") + + file_p.write("KDColor const * Palette::AtomColor[] = {\n") + file_p.write(" AtomUnknown, AtomAlkaliMetal, AtomAlkaliEarthMetal, AtomLanthanide, AtomActinide, AtomTransitionMetal,\n") + file_p.write(" AtomPostTransitionMetal, AtomMetalloid, AtomHalogen, AtomReactiveNonmetal, AtomNobleGas\n") + file_p.write("};\n\n") + def handle_git(args): output_folder = os.path.basename(args.repo) @@ -180,11 +207,18 @@ def handle_theme(args, path): print(" (!!) Icon " + icons[args.output.replace(args.build_dir, "")] + " not found in icon theme " + data["icons"] + ". Using default!") shutil.copyfile(args.output.replace(args.build_dir, ""), args.output) else: + palette = make_palette(data) if (args.stdout): - write_palette_h(data, sys.stdout) + if args.cpp: + write_palette_cpp(palette, sys.stdout) + elif args.header: + write_palette_h(palette, sys.stdout) else: with open(args.output, "w") as palette_file: - write_palette_h(data, palette_file) + if args.cpp: + write_palette_cpp(palette, palette_file) + elif args.header: + write_palette_h(palette, palette_file) def main(args): @@ -221,6 +255,8 @@ if __name__ == "__main__": parser.add_argument("-l", "--list", help="list locals themes", action="store_true") parser.add_argument("-i", "--icon", help="outputs an icon instead of a header", action="store_true") parser.add_argument("--stdout", help="print palette.h to stdout", action="store_true") + parser.add_argument("--header", help="generate an header", action="store_true") + parser.add_argument("--cpp", help="generate a cpp file", action="store_true") args = parser.parse_args() main(args)