KDColorBlack -> Palette::Text for the theming engine

This commit is contained in:
Quentin Guidée
2019-11-26 19:22:24 +01:00
parent eb6198306a
commit db269f1204
53 changed files with 75 additions and 66 deletions

View File

@@ -53,7 +53,7 @@ private:
ConsoleLineView m_consoleLineView;
};
static KDColor textColor(ConsoleLine * line) {
return line->isFromCurrentSession() ? KDColorBlack : Palette::GreyDark;
return line->isFromCurrentSession() ? Palette::Text : Palette::GreyDark;
}
MessageTextView m_promptView;
ScrollableConsoleLineView m_scrollableView;

View File

@@ -36,7 +36,7 @@ static inline KDColor TokenColor(mp_token_kind_t tokenKind) {
if (tokenKind >= MP_TOKEN_DEL_EQUAL && tokenKind <= MP_TOKEN_DEL_MINUS_MORE) {
return OperatorColor;
}
return KDColorBlack;
return Palette::Text;
}
static inline size_t TokenLength(mp_lexer_t * lex) {

View File

@@ -23,10 +23,10 @@ void ScriptNodeCell::ScriptNodeView::setScriptStore(ScriptStore * scriptStore) {
}
void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->drawString(m_scriptNode->name(), KDPoint(0, Metric::TableCellLabelTopMargin), k_font, KDColorBlack, isHighlighted()? Palette::Select : KDColorWhite);
ctx->drawString(m_scriptNode->name(), KDPoint(0, Metric::TableCellLabelTopMargin), k_font, Palette::Text, isHighlighted()? Palette::Select : KDColorWhite);
KDSize nameSize = k_font->stringSize(m_scriptNode->name());
if (m_scriptNode->type() == ScriptNode::Type::Function) {
ctx->drawString(ScriptNodeCell::k_parentheses, KDPoint(nameSize.width(), Metric::TableCellLabelTopMargin), k_font, KDColorBlack, isHighlighted()? Palette::Select : KDColorWhite);
ctx->drawString(ScriptNodeCell::k_parentheses, KDPoint(nameSize.width(), Metric::TableCellLabelTopMargin), k_font, Palette::Text, isHighlighted()? Palette::Select : KDColorWhite);
}
ctx->drawString(m_scriptStore->scriptAtIndex(m_scriptNode->scriptIndex()).fullName(), KDPoint(0, Metric::TableCellLabelTopMargin + nameSize.height() + k_verticalMargin), k_font, Palette::GreyDark, isHighlighted()? Palette::Select : KDColorWhite);
}

View File

@@ -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() ? KDColorBlack : Palette::GreyDark;
KDColor textColor = f->isActive() ? Palette::Text : Palette::GreyDark;
myCell->setTextColor(textColor);
}

View File

@@ -17,7 +17,7 @@ public:
const KDFont * size = KDFont::LargeFont,
float horizontalAlignment = 0.0f,
float verticalAlignment = 0.5f,
KDColor textColor = KDColorBlack,
KDColor textColor = Palette::Text,
KDColor backgroundColor = KDColorWhite) :
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(KDColorBlack)
m_color(Palette::Text)
{
}

View File

@@ -5,7 +5,7 @@ namespace Home {
AppCell::AppCell() :
HighlightCell(),
m_nameView(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, KDColorBlack, KDColorWhite),
m_nameView(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::Text, KDColorWhite),
m_visible(true)
{
}
@@ -45,7 +45,7 @@ void AppCell::setVisible(bool visible) {
}
void AppCell::reloadCell() {
m_nameView.setTextColor(isHighlighted() ? KDColorWhite : KDColorBlack);
m_nameView.setTextColor(isHighlighted() ? KDColorWhite : Palette::Text);
m_nameView.setBackgroundColor(isHighlighted() ? Palette::YellowDark : KDColorWhite);
}

View File

@@ -5,7 +5,7 @@ namespace Probability {
Cell::Cell() :
HighlightCell(),
m_labelView(KDFont::LargeFont, (I18n::Message)0, 0, 0.5, KDColorBlack, KDColorWhite),
m_labelView(KDFont::LargeFont, (I18n::Message)0, 0, 0.5, Palette::Text, KDColorWhite),
m_icon(nullptr),
m_focusedIcon(nullptr)
{

View File

@@ -9,8 +9,8 @@ namespace Probability {
ParametersController::ContentView::ContentView(Responder * parentResponder, SelectableTableView * selectableTableView) :
m_numberOfParameters(1),
m_titleView(KDFont::SmallFont, I18n::Message::ChooseParameters, 0.5f, 0.5f, Palette::GreyDark, Palette::WallScreen),
m_firstParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_secondParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_firstParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::Text, Palette::WallScreen),
m_secondParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::Text, Palette::WallScreen),
m_selectableTableView(selectableTableView)
{
}

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() : KDColorBlack;
KDColor color = m_shouldColorHighlighted ? s->color() : Palette::Text;
if (y >= 0.0f) {
drawSegment(ctx, rect, Axis::Vertical, x, 0.0f, y, color, 1);
} else {

View File

@@ -208,7 +208,7 @@ void ListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int
myCell->setLayout(sequence->secondInitialConditionLayout());
}
bool active = sequence->isActive();
KDColor textColor = active ? KDColorBlack : Palette::GreyDark;
KDColor textColor = active ? Palette::Text : Palette::GreyDark;
myCell->setTextColor(textColor);
}

View File

@@ -12,7 +12,7 @@ public:
KDSize minimalSizeForOptimalDisplay() const override;
void reload() { layoutSubviews(); }
static constexpr const KDFont * Font() { return KDFont::SmallFont; }
static constexpr KDColor TextColor() { return KDColorBlack; }
static constexpr KDColor TextColor() { return Palette::Text; }
static constexpr KDColor BackgroundColor() { return Palette::GreyMiddle; }
private:
static constexpr KDCoordinate LineSpacing = 2;

View File

@@ -1,7 +1,7 @@
#include "button_with_separator.h"
ButtonWithSeparator::ButtonWithSeparator(Responder * parentResponder, I18n::Message message, Invocation invocation) :
Button(parentResponder, message, invocation, KDFont::LargeFont, KDColorBlack)
Button(parentResponder, message, invocation, KDFont::LargeFont, Palette::Text)
{
}

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), KDColorBlack);
ctx->fillRect(KDRect(0, (height-1)/2, width, 1), KDColorBlack);
ctx->fillRect(KDRect((width-1)/2, 0, 1, height), Palette::Text);
ctx->fillRect(KDRect(0, (height-1)/2, width, 1), Palette::Text);
}
KDSize CursorView::minimalSizeForOptimalDisplay() const {

View File

@@ -301,7 +301,7 @@ void CurveView::drawLabels(KDContext * ctx, KDRect rect, Axis axis, bool shiftOr
labelPosition,
k_labelGraduationLength,
1);
ctx->fillRect(graduation, KDColorBlack);
ctx->fillRect(graduation, Palette::Text);
}
}
@@ -352,7 +352,7 @@ void CurveView::drawLabels(KDContext * ctx, KDRect rect, Axis axis, bool shiftOr
}
KDPoint origin = KDPoint(xPosition, yPosition);
if (rect.intersects(KDRect(origin, textSize))) {
ctx->drawString(labelI, origin, k_font, KDColorBlack, backgroundColor);
ctx->drawString(labelI, origin, k_font, Palette::Text, backgroundColor);
}
}
}
@@ -449,7 +449,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, KDColorBlack, 1);
drawLine(ctx, rect, axis, 0.0f, Palette::Text, 1);
}
#define LINE_THICKNESS 2

View File

@@ -15,7 +15,7 @@ public:
EvenOddCell(),
m_orientation(orientation),
m_baseline(-1),
m_functionColor(KDColorBlack)
m_functionColor(Palette::Text)
{}
virtual void setOrientation(Orientation orientation);
virtual void setColor(KDColor color);

View File

@@ -31,7 +31,7 @@ void OkView::drawRect(KDContext * ctx, KDRect rect) const {
KDCoordinate width = bounds().width();
KDCoordinate height = bounds().height();
KDRect frame((width-k_okSize)/2, (height-k_okSize)/2, k_okSize, k_okSize);
ctx->blendRectWithMask(frame, KDColorBlack, (const uint8_t *)okMask, s_okWorkingBuffer);
ctx->blendRectWithMask(frame, Palette::Text, (const uint8_t *)okMask, s_okWorkingBuffer);
}
KDSize OkView::minimalSizeForOptimalDisplay() const {

View File

@@ -56,8 +56,8 @@ void RangeParameterController::willDisplayCellForIndex(HighlightCell * cell, int
MessageTableCellWithEditableText * myCell = (MessageTableCellWithEditableText *)cell;
I18n::Message labels[k_numberOfTextCell+1] = {I18n::Message::XMin, I18n::Message::XMax, I18n::Message::Default, I18n::Message::YMin, I18n::Message::YMax};
myCell->setMessage(labels[index]);
KDColor yColor = m_interactiveRange->yAuto() ? Palette::GreyDark : KDColorBlack;
KDColor colors[k_numberOfTextCell+1] = {KDColorBlack, KDColorBlack, KDColorBlack, yColor, yColor};
KDColor yColor = m_interactiveRange->yAuto() ? Palette::GreyDark : Palette::Text;
KDColor colors[k_numberOfTextCell+1] = {Palette::Text, Palette::Text, Palette::Text, yColor, yColor};
myCell->setTextColor(colors[index]);
FloatParameterController::willDisplayCellForIndex(cell, index);
}

View File

@@ -9,7 +9,7 @@ namespace Shared {
class RoundCursorView : public CursorView {
public:
RoundCursorView(KDColor color = KDColorBlack) : m_color(color), m_underneathPixelBufferLoaded(false) {}
RoundCursorView(KDColor color = Palette::Text) : m_color(color), m_underneathPixelBufferLoaded(false) {}
void drawRect(KDContext * ctx, KDRect rect) const override;
KDSize minimalSizeForOptimalDisplay() const override;
void setColor(KDColor color);

View File

@@ -45,7 +45,7 @@ void ScrollableExactApproximateExpressionsView::ContentCell::setEven(bool even)
void ScrollableExactApproximateExpressionsView::ContentCell::reloadTextColor() {
if (numberOfSubviews() == 1) {
m_rightExpressionView.setTextColor(KDColorBlack);
m_rightExpressionView.setTextColor(Palette::Text);
} else {
m_rightExpressionView.setTextColor(Palette::GreyVeryDark);
}

View File

@@ -155,10 +155,10 @@ void SumGraphController::reloadBannerView() {
/* Legend View */
SumGraphController::LegendView::LegendView(SumGraphController * controller, InputEventHandlerDelegate * inputEventHandlerDelegate, CodePoint sumSymbol) :
m_sum(0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_sum(0.0f, 0.5f, Palette::Text, Palette::GreyMiddle),
m_sumLayout(),
m_legend(k_font, I18n::Message::Default, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_editableZone(controller, m_textBuffer, k_editableZoneBufferSize, TextField::maxBufferSize(), inputEventHandlerDelegate, controller, k_font, 0.0f, 0.5f, KDColorBlack, Palette::GreyMiddle),
m_legend(k_font, I18n::Message::Default, 0.0f, 0.5f, Palette::Text, Palette::GreyMiddle),
m_editableZone(controller, m_textBuffer, k_editableZoneBufferSize, TextField::maxBufferSize(), inputEventHandlerDelegate, controller, k_font, 0.0f, 0.5f, Palette::Text, Palette::GreyMiddle),
m_sumSymbol(sumSymbol)
{
m_textBuffer[0] = 0;

View File

@@ -17,7 +17,7 @@ public:
const KDFont * size = KDFont::LargeFont,
float horizontalAlignment = 0.0f,
float verticalAlignment = 0.5f,
KDColor textColor = KDColorBlack,
KDColor textColor = Palette::Text,
KDColor backgroundColor = KDColorWhite) :
TextField(parentResponder, textBuffer, textBufferSize, draftTextBufferSize, inputEventHandlerDelegate, delegate, size, horizontalAlignment, verticalAlignment, textColor, backgroundColor),
m_extensionLength(extensionLength)

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), KDColorBlack);
ctx->fillRect(KDRect(0, 0, 1, height), Palette::Text);
}
KDSize VerticalCursorView::minimalSizeForOptimalDisplay() const {

View File

@@ -111,11 +111,11 @@ void EquationListView::BraceView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(bounds(), KDColorWhite);
KDCoordinate height = bounds().height();
KDCoordinate margin = 3;
ctx->blendRectWithMask(KDRect(margin, 0, braceExtremumWidth, braceExtremumHeight), KDColorBlack, (const uint8_t *)topBrace, (KDColor *)(s_braceWorkingBuffer));
ctx->blendRectWithMask(KDRect(0, height/2-braceCenterHeight/2, braceCenterWidth, braceCenterHeight), KDColorBlack, (const uint8_t *)middleBrace, (KDColor *)(s_braceWorkingBuffer));
ctx->blendRectWithMask(KDRect(margin, height-braceExtremumHeight, braceExtremumWidth, braceExtremumHeight), KDColorBlack, (const uint8_t *)bottomBrace, (KDColor *)(s_braceWorkingBuffer));
ctx->fillRect(KDRect(margin, braceExtremumHeight, 1, height/2-braceCenterHeight/2-braceExtremumHeight), KDColorBlack);
ctx->fillRect(KDRect(margin, height/2+braceCenterHeight/2, 1, height/2-braceExtremumHeight/2-braceExtremumHeight), KDColorBlack);
ctx->blendRectWithMask(KDRect(margin, 0, braceExtremumWidth, braceExtremumHeight), Palette::Text, (const uint8_t *)topBrace, (KDColor *)(s_braceWorkingBuffer));
ctx->blendRectWithMask(KDRect(0, height/2-braceCenterHeight/2, braceCenterWidth, braceCenterHeight), Palette::Text, (const uint8_t *)middleBrace, (KDColor *)(s_braceWorkingBuffer));
ctx->blendRectWithMask(KDRect(margin, height-braceExtremumHeight, braceExtremumWidth, braceExtremumHeight), Palette::Text, (const uint8_t *)bottomBrace, (KDColor *)(s_braceWorkingBuffer));
ctx->fillRect(KDRect(margin, braceExtremumHeight, 1, height/2-braceCenterHeight/2-braceExtremumHeight), Palette::Text);
ctx->fillRect(KDRect(margin, height/2+braceCenterHeight/2, 1, height/2-braceExtremumHeight/2-braceExtremumHeight), Palette::Text);
}
KDSize EquationListView::BraceView::minimalSizeForOptimalDisplay() const {

View File

@@ -7,8 +7,8 @@
namespace Solver {
IntervalController::ContentView::ContentView(SelectableTableView * selectableTableView) :
m_instructions0(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_instructions1(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction1, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen),
m_instructions0(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction0, 0.5f, 0.5f, Palette::Text, Palette::WallScreen),
m_instructions1(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction1, 0.5f, 0.5f, Palette::Text, Palette::WallScreen),
m_selectableTableView(selectableTableView)
{
}

View File

@@ -18,8 +18,8 @@ namespace Solver {
static inline KDCoordinate maxCoordinate(KDCoordinate x, KDCoordinate y) { return x > y ? x : y; }
SolutionsController::ContentView::ContentView(SolutionsController * controller) :
m_warningMessageView0(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, KDColorBlack, Palette::WallScreenDark),
m_warningMessageView1(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, KDColorBlack, Palette::WallScreenDark),
m_warningMessageView0(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, Palette::Text, Palette::WallScreenDark),
m_warningMessageView1(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, Palette::Text, Palette::WallScreenDark),
m_selectableTableView(controller),
m_displayWarningMoreSolutions(false)
{

View File

@@ -8,7 +8,7 @@ namespace Statistics {
void BoxAxisView::drawRect(KDContext * ctx, KDRect rect) const {
ctx->fillRect(rect, KDColorWhite);
KDRect lineRect = KDRect(0, k_axisMargin, bounds().width(), 1);
ctx->fillRect(lineRect, KDColorBlack);
ctx->fillRect(lineRect, Palette::Text);
drawLabels(ctx, rect, Axis::Horizontal, false, false, true, k_axisMargin);
}

View File

@@ -7,7 +7,7 @@ using namespace Poincare;
using namespace Ion;
VariableBoxEmptyController::VariableBoxEmptyView::VariableBoxEmptyView() :
m_layoutExample(0.5f, 0.5f, KDColorBlack, Palette::WallScreen)
m_layoutExample(0.5f, 0.5f, Palette::Text, Palette::WallScreen)
{
for (int i = 0; i < k_numberOfMessages; i++) {
m_messages[i].setFont(k_font);

View File

@@ -7,7 +7,8 @@ EPSILON_VERSION ?= 12.0.0
EPSILON_CUSTOM_VERSION ?= 1.17.0-0
# USERNAME ?= N/A
# Valid values are "none", "update", "beta"
EPSILON_APPS ?= calculation rpn graph code statistics probability solver atom sequence regression settings
# EPSILON_APPS ?= calculation rpn graph code statistics probability solver atom sequence regression settings
EPSILON_APPS ?= calculation graph code statistics probability solver atom sequence regression settings
EPSILON_I18N ?= en fr es de pt
EPSILON_GETOPT ?= 0
ESCHER_LOG_EVENTS_BINARY ?= 0

View File

@@ -17,7 +17,7 @@ public:
class AlternateEmptyViewDefaultDelegate : public AlternateEmptyViewDelegate {
public:
AlternateEmptyViewDefaultDelegate() : m_message(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, KDColorBlack, Palette::WallScreen) {}
AlternateEmptyViewDefaultDelegate() : m_message(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::Text, Palette::WallScreen) {}
virtual I18n::Message emptyMessage() = 0;
View * emptyView() override {
m_message.setMessage(emptyMessage());

View File

@@ -7,7 +7,7 @@ class BufferTextView : public TextView {
public:
static constexpr int k_maxNumberOfChar = 256;
BufferTextView(const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.5f, float verticalAlignment = 0.5f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
KDColor textColor = Palette::Text, KDColor backgroundColor = KDColorWhite);
void setText(const char * text) override;
const char * text() const override;
void appendText(const char * text);

View File

@@ -10,7 +10,7 @@
class Button : public HighlightCell, public Responder {
public:
Button(Responder * parentResponder, I18n::Message textBody, Invocation invocation, const KDFont * font = KDFont::SmallFont, KDColor textColor = KDColorBlack);
Button(Responder * parentResponder, I18n::Message textBody, Invocation invocation, const KDFont * font = KDFont::SmallFont, KDColor textColor = Palette::Text);
void setMessage(I18n::Message message);
bool handleEvent(Ion::Events::Event event) override;
void setHighlighted(bool highlight) override;

View File

@@ -11,7 +11,7 @@
class EditableTextCell : public HighlightCell, public Responder {
public:
EditableTextCell(Responder * parentResponder = nullptr, InputEventHandlerDelegate * inputEventHandlerDelegate = nullptr, TextFieldDelegate * delegate = nullptr, const KDFont * font = KDFont::LargeFont,
float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = KDColorBlack, KDColor = KDColorWhite, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f, KDColor textColor = Palette::Text, KDColor = KDColorWhite, KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
TextField * textField();
void setMargins(KDCoordinate topMargin = 0, KDCoordinate rightMargin = 0, KDCoordinate bottomMargin = 0, KDCoordinate leftMargin = 0);
void setHighlighted(bool highlight) override;

View File

@@ -7,7 +7,7 @@
class EvenOddExpressionCell : public EvenOddCell {
public:
EvenOddExpressionCell(float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
KDColor textColor = Palette::Text, KDColor backgroundColor = KDColorWhite);
void setEven(bool even) override;
void setHighlighted(bool highlight) override;
void setLayout(Poincare::Layout layout);

View File

@@ -11,7 +11,7 @@ public:
EvenOddMessageTextCell(const KDFont * font = KDFont::LargeFont);
void setEven(bool even) override;
void setHighlighted(bool highlight) override;
void setMessage(I18n::Message textContent, KDColor textColor = KDColorBlack);
void setMessage(I18n::Message textContent, KDColor textColor = Palette::Text);
void setAlignment(float horizontalAlignment, float verticalAlignment);
void setMessageFont(const KDFont * font) { m_messageTextView.setFont(font); }
protected:

View File

@@ -14,7 +14,7 @@
class ExpressionView : public View {
public:
ExpressionView(float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
KDColor textColor = Palette::Text, KDColor backgroundColor = KDColorWhite);
Poincare::Layout layout() const { return m_layout; }
bool setLayout(Poincare::Layout layout);
void drawRect(KDContext * ctx, KDRect rect) const override;

View File

@@ -6,7 +6,7 @@
class MessageTableCellWithBuffer : public MessageTableCell {
public:
MessageTableCellWithBuffer(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont, const KDFont * accessoryFont = KDFont::LargeFont, KDColor accessoryTextColor = KDColorBlack);
MessageTableCellWithBuffer(I18n::Message message = (I18n::Message)0, const KDFont * font = KDFont::SmallFont, const KDFont * accessoryFont = KDFont::LargeFont, KDColor accessoryTextColor = Palette::Text);
View * accessoryView() const override;
void setHighlighted(bool highlight) override;
void setAccessoryText(const char * textBody);

View File

@@ -3,11 +3,12 @@
#include <escher/text_view.h>
#include <escher/i18n.h>
#include <escher/palette.h>
class MessageTextView : public TextView {
public:
MessageTextView(const KDFont * font = KDFont::LargeFont, I18n::Message message = (I18n::Message)0, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
KDColor textColor = Palette::Text, KDColor backgroundColor = KDColorWhite);
void setText(const char * text) override;
void setMessage(I18n::Message message);
const char * text() const override;

View File

@@ -5,6 +5,7 @@
class Palette {
public:
constexpr static KDColor Text = KDColor::RGB24(0x000000);
constexpr static KDColor YellowDark = KDColor::RGB24(0xffb734);
constexpr static KDColor YellowLight = KDColor::RGB24(0xffcc7b);
constexpr static KDColor PurpleBright = KDColor::RGB24(0x656975);

View File

@@ -7,7 +7,7 @@
class PointerTextView : public TextView {
public:
PointerTextView(const KDFont * font = KDFont::LargeFont, const char * text = nullptr, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
KDColor textColor = Palette::Text, KDColor backgroundColor = KDColorWhite);
const char * text() const override { return m_text; }
void setText(const char * text) override;
private:

View File

@@ -9,7 +9,7 @@
class SolidTextArea : public TextArea {
public:
SolidTextArea(Responder * parentResponder, const KDFont * font = KDFont::LargeFont,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite) :
KDColor textColor = Palette::Text, KDColor backgroundColor = KDColorWhite) :
TextArea(parentResponder, &m_contentView, font),
m_contentView(font, textColor, backgroundColor) {}
protected:

View File

@@ -19,7 +19,7 @@ public:
TextField(Responder * parentResponder, char * textBuffer, size_t textBufferSize, size_t draftTextBufferSize,
InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * delegate = nullptr,
const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.0f, float verticalAlignment = 0.5f,
KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
KDColor textColor = Palette::Text, KDColor backgroundColor = KDColorWhite);
void setBackgroundColor(KDColor backgroundColor) override;
void setTextColor(KDColor textColor);
void setDelegates(InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * delegate) { m_inputEventHandlerDelegate = inputEventHandlerDelegate; m_delegate = delegate; }

View File

@@ -2,6 +2,7 @@
#define ESCHER_TEXT_VIEW_H
#include <escher/view.h>
#include <escher/palette.h>
#include <kandinsky/color.h>
/* alignment = 0 -> align left or top
@@ -10,7 +11,7 @@
class TextView : public View {
public:
TextView(const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, KDColor textColor = KDColorBlack, KDColor backgroundColor = KDColorWhite) :
TextView(const KDFont * font = KDFont::LargeFont, float horizontalAlignment = 0.0f, float verticalAlignment = 0.0f, KDColor textColor = Palette::Text, KDColor backgroundColor = KDColorWhite) :
View(),
m_font(font),
m_horizontalAlignment(horizontalAlignment),

View File

@@ -1,4 +1,5 @@
#include <escher/ellipsis_view.h>
#include <escher/palette.h>
#include <kandinsky/color.h>
const uint8_t ellipsisMask[EllipsisView::k_ellipsisHeight][EllipsisView::k_ellipsisWidth] = {
@@ -18,7 +19,7 @@ void EllipsisView::drawRect(KDContext * ctx, KDRect rect) const {
KDCoordinate heightCenter = bounds().height()/2;
KDCoordinate ellipsisHalfHeight = k_ellipsisHeight/2;
KDRect frame(widthCenter - ellipsisHalfWidth, heightCenter - ellipsisHalfHeight, k_ellipsisWidth, k_ellipsisHeight);
ctx->blendRectWithMask(frame, KDColorBlack, (const uint8_t *)ellipsisMask, s_ellipsisWorkingBuffer);
ctx->blendRectWithMask(frame, Palette::Text, (const uint8_t *)ellipsisMask, s_ellipsisWorkingBuffer);
}
KDSize EllipsisView::minimalSizeForOptimalDisplay() const {

View File

@@ -5,7 +5,7 @@
EvenOddEditableTextCell::EvenOddEditableTextCell(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * delegate, const KDFont * font, float horizontalAlignment, float verticalAlignment, KDCoordinate topMargin, KDCoordinate rightMargin, KDCoordinate bottomMargin, KDCoordinate leftMargin) :
EvenOddCell(),
Responder(parentResponder),
m_editableCell(this, inputEventHandlerDelegate, delegate, font, horizontalAlignment, verticalAlignment, KDColorBlack, KDColorWhite, topMargin, rightMargin, bottomMargin, leftMargin)
m_editableCell(this, inputEventHandlerDelegate, delegate, font, horizontalAlignment, verticalAlignment, Palette::Text, KDColorWhite, topMargin, rightMargin, bottomMargin, leftMargin)
{
}

View File

@@ -8,7 +8,7 @@ static inline KDCoordinate maxCoordinate(KDCoordinate x, KDCoordinate y) { retur
ExpressionField::ExpressionField(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * textFieldDelegate, LayoutFieldDelegate * layoutFieldDelegate) :
Responder(parentResponder),
View(),
m_textField(parentResponder, nullptr, k_textFieldBufferSize, k_textFieldBufferSize, inputEventHandlerDelegate, textFieldDelegate, KDFont::LargeFont, 0.0f, 0.5f, KDColorBlack, KDColorWhite),
m_textField(parentResponder, nullptr, k_textFieldBufferSize, k_textFieldBufferSize, inputEventHandlerDelegate, textFieldDelegate, KDFont::LargeFont, 0.0f, 0.5f, Palette::Text, KDColorWhite),
m_layoutField(parentResponder, inputEventHandlerDelegate, layoutFieldDelegate)
{
// Initialize text field

View File

@@ -4,7 +4,7 @@
ExpressionTableCell::ExpressionTableCell(Layout layout) :
TableCell(layout),
m_labelExpressionView(0.0f, 0.5f, KDColorBlack, KDColorWhite)
m_labelExpressionView(0.0f, 0.5f, Palette::Text, KDColorWhite)
{
}

View File

@@ -1,4 +1,5 @@
#include <escher/key_view.h>
#include <escher/palette.h>
const uint8_t upMask[KeyView::k_keySize][KeyView::k_keySize] = {
{0xFF, 0xFF, 0xFF, 0x45, 0x45, 0xFF, 0xFF, 0xFF},
@@ -83,7 +84,7 @@ void KeyView::drawRect(KDContext * ctx, KDRect rect) const {
KDCoordinate width = bounds().width();
KDCoordinate height = bounds().height();
KDRect frame((width - k_keySize)/2, (height - k_keySize)/2, k_keySize, k_keySize);
ctx->blendRectWithMask(frame, KDColorBlack, mask(), s_keyWorkingBuffer);
ctx->blendRectWithMask(frame, Palette::Text, mask(), s_keyWorkingBuffer);
}
KDSize KeyView::minimalSizeForOptimalDisplay() const {

View File

@@ -12,7 +12,7 @@ static inline KDCoordinate minCoordinate(KDCoordinate x, KDCoordinate y) { retur
LayoutField::ContentView::ContentView() :
m_cursor(),
m_expressionView(0.0f, 0.5f, KDColorBlack, KDColorWhite),
m_expressionView(0.0f, 0.5f, Palette::Text, KDColorWhite),
m_cursorView(),
m_isEditing(false)
{

View File

@@ -4,7 +4,7 @@
MessageTableCell::MessageTableCell(I18n::Message label, const KDFont * font, Layout layout) :
TableCell(layout),
m_messageTextView(font, label, 0, 0.5, KDColorBlack, KDColorWhite)
m_messageTextView(font, label, 0, 0.5, Palette::Text, KDColorWhite)
{
}

View File

@@ -1,5 +1,6 @@
#include <escher/palette.h>
constexpr KDColor Palette::Text;
constexpr KDColor Palette::YellowDark;
constexpr KDColor Palette::YellowLight;
constexpr KDColor Palette::PurpleBright;

View File

@@ -1,8 +1,9 @@
#include <escher/text_cursor_view.h>
#include <escher/palette.h>
void TextCursorView::drawRect(KDContext * ctx, KDRect rect) const {
KDCoordinate height = bounds().height();
ctx->fillRect(KDRect(0, 0, 1, height), KDColorBlack);
ctx->fillRect(KDRect(0, 0, 1, height), Palette::Text);
}
KDSize TextCursorView::minimalSizeForOptimalDisplay() const {

View File

@@ -2,6 +2,7 @@
#define POINCARE_LAYOUT_NODE_H
#include <poincare/tree_node.h>
#include <escher/palette.h>
#include <kandinsky.h>
namespace Poincare {
@@ -60,7 +61,7 @@ public:
bool isIdenticalTo(Layout l);
// Rendering
void draw(KDContext * ctx, KDPoint p, KDColor expressionColor = KDColorBlack, KDColor backgroundColor = KDColorWhite);
void draw(KDContext * ctx, KDPoint p, KDColor expressionColor = Palette::Text, KDColor backgroundColor = KDColorWhite);
KDPoint origin();
KDPoint absoluteOrigin();
KDSize layoutSize();