[themes] Color with pointers

This commit is contained in:
Laury
2022-02-11 18:41:00 +01:00
parent 84d88a3e8d
commit 63d1e0ee4e
175 changed files with 546 additions and 652 deletions

View File

@@ -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;

View File

@@ -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,

View File

@@ -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;

View File

@@ -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,

View File

@@ -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 {

View File

@@ -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<float>(a*std::cos(t*th), b*std::sin(t*th));
}, &parameters, &th, false, Palette::SecondaryText, false);
}, &parameters, &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);
}
}

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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)
{

View File

@@ -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<ExpressionWithEqualSignView *>(&m_leftExpressionView); }
private:

View File

@@ -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<float>(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);
}
}

View File

@@ -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 {

View File

@@ -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(); }

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -9,7 +9,7 @@ namespace Code {
SandboxController::SandboxController(Responder * parentResponder) :
ViewController(parentResponder),
m_solidColorView(Palette::CodeBackground)
m_solidColorView(*Palette::CodeBackground)
{
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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
}

View File

@@ -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);
}

View File

@@ -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

View File

@@ -167,7 +167,7 @@ void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) {
// Set name and color if the name is not being edited
ExpiringPointer<ContinuousFunction> 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<ContinuousFunction> 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);
}

View File

@@ -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); }
};

View File

@@ -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);

View File

@@ -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;

View File

@@ -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);
}
}

View File

@@ -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

View File

@@ -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 {

View File

@@ -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();
}

View File

@@ -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 {

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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);
}
}

View File

@@ -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++) {

View File

@@ -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);
}
}

View File

@@ -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;

View File

@@ -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;

View File

@@ -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);

View File

@@ -30,7 +30,7 @@ protected:
private:
static float EvaluateAtAbscissa(float abscissa, void * model, void * context);
static Poincare::Coordinate2D<float> 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;

View File

@@ -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);
}
}

View File

@@ -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 {

View File

@@ -55,7 +55,7 @@ void ReadBookController::loadPosition() {
else {
m_readerView.setBookSave({
0,
Palette::PrimaryText
*Palette::PrimaryText
});
}
}

View File

@@ -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:

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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<Shared::CursorView *>(&m_roundCursorView) : static_cast<Shared::CursorView *>(&m_crossCursorView);
// Escape if the cursor view stays the same

View File

@@ -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 *>(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);
}
}
}

View File

@@ -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<char>('1' + seriesIndex), 0};
mytitleCell->setText(name);
}

View File

@@ -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 {

View File

@@ -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);
}

View File

@@ -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 {

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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 {

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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() {

View File

@@ -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);
}

View File

@@ -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 {

View File

@@ -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;

View File

@@ -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:

View File

@@ -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<double*>(&m_data); }
protected:

View File

@@ -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

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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 {

View File

@@ -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() {}

View File

@@ -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]);

View File

@@ -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:

View File

@@ -1,19 +1,19 @@
#include "message_view.h"
#include <assert.h>
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) {

View File

@@ -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; }

View File

@@ -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 {

View File

@@ -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);
}

View File

@@ -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)

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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));

View File

@@ -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);
}

View File

@@ -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 {

View File

@@ -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)
{}

View File

@@ -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++) {

View File

@@ -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 {

View File

@@ -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) {

View File

@@ -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 {

View File

@@ -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);
}
}

View File

@@ -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<IntervalController *>(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<IntervalController *>(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);
}
}
}

View File

@@ -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);
}
}

View File

@@ -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); }

View File

@@ -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);
}

View File

@@ -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);
}
}

View File

@@ -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);
}

Some files were not shown because too many files have changed in this diff Show More