mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps,escher,kandinsky,poincare,python] Replace every "grey" with "gray"
Change-Id: I60a232849dce90f70e6977b6024d6e9b1ce1b731
This commit is contained in:
committed by
Émilie Feral
parent
4331686818
commit
e27c668c40
@@ -25,7 +25,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::GreyDark, false);
|
||||
drawSegment(ctx, rect, 0.0f, 0.0f, m_complex->real(), m_complex->imag(), Palette::GrayDark, false);
|
||||
|
||||
/* Draw the partial ellipse indicating the angle θ
|
||||
* - the ellipse parameters are a = |real|/5 and b = |imag|/5,
|
||||
@@ -58,7 +58,7 @@ 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));
|
||||
}, ¶meters, &th, false, Palette::GreyDark, false);
|
||||
}, ¶meters, &th, false, Palette::GrayDark, false);
|
||||
|
||||
// Draw dashed segment to indicate real and imaginary
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, real, 0.0f, imag, Palette::Red, 1, 3);
|
||||
|
||||
@@ -10,7 +10,7 @@ void IllustrationCell::layoutSubviews(bool force) {
|
||||
}
|
||||
|
||||
void IllustrationCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
drawBorderOfRect(ctx, bounds(), Palette::GreyBright);
|
||||
drawBorderOfRect(ctx, bounds(), Palette::GrayBright);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ void TrigonometryGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
// 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::GreyDark, false);
|
||||
}, nullptr, nullptr, true, Palette::GrayDark, false);
|
||||
// Draw dashed segment to indicate sine and cosine
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, c, 0.0f, s, Palette::Red, 1, 3);
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, s, 0.0f, c, Palette::Red, 1, 3);
|
||||
|
||||
@@ -80,7 +80,7 @@ App::App(Snapshot * snapshot) :
|
||||
, snapshot->lockOnConsole()
|
||||
#endif
|
||||
),
|
||||
m_listFooter(&m_codeStackViewController, &m_menuController, &m_menuController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGrey, ButtonRowController::Size::Large),
|
||||
m_listFooter(&m_codeStackViewController, &m_menuController, &m_menuController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGray, ButtonRowController::Size::Large),
|
||||
m_menuController(&m_listFooter, this, snapshot->scriptStore(), &m_listFooter),
|
||||
m_codeStackViewController(&m_modalViewController, &m_listFooter),
|
||||
m_variableBoxController(snapshot->scriptStore())
|
||||
|
||||
@@ -31,7 +31,7 @@ PythonColorBlack = "Black color"
|
||||
PythonColorBlue = "Blue color"
|
||||
PythonColorBrown = "Brown color"
|
||||
PythonColorGreen = "Green color"
|
||||
PythonColorGrey = "Grey color"
|
||||
PythonColorGray = "Gray color"
|
||||
PythonColorOrange = "Orange color"
|
||||
PythonColorPink = "Pink color"
|
||||
PythonColorPurple = "Purple color"
|
||||
|
||||
@@ -31,7 +31,7 @@ PythonColorBlack = "Black color"
|
||||
PythonColorBlue = "Blue color"
|
||||
PythonColorBrown = "Brown color"
|
||||
PythonColorGreen = "Green color"
|
||||
PythonColorGrey = "Grey color"
|
||||
PythonColorGray = "Gray color"
|
||||
PythonColorOrange = "Orange color"
|
||||
PythonColorPink = "Pink color"
|
||||
PythonColorPurple = "Purple color"
|
||||
|
||||
@@ -31,7 +31,7 @@ PythonColorBlack = "Black color"
|
||||
PythonColorBlue = "Blue color"
|
||||
PythonColorBrown = "Brown color"
|
||||
PythonColorGreen = "Green color"
|
||||
PythonColorGrey = "Grey color"
|
||||
PythonColorGray = "Gray color"
|
||||
PythonColorOrange = "Orange color"
|
||||
PythonColorPink = "Pink color"
|
||||
PythonColorPurple = "Purple color"
|
||||
|
||||
@@ -31,7 +31,7 @@ PythonColorBlack = "Couleur noire"
|
||||
PythonColorBlue = "Couleur bleue"
|
||||
PythonColorBrown = "Couleur marron"
|
||||
PythonColorGreen = "Couleur verte"
|
||||
PythonColorGrey = "Couleur grise"
|
||||
PythonColorGray = "Couleur grise"
|
||||
PythonColorOrange = "Couleur orange"
|
||||
PythonColorPink = "Couleur rose"
|
||||
PythonColorPurple = "Couleur violette"
|
||||
|
||||
@@ -31,7 +31,7 @@ PythonColorBlack = "Colore nero"
|
||||
PythonColorBlue = "Colore blu"
|
||||
PythonColorBrown = "Colore marrone"
|
||||
PythonColorGreen = "Colore verde"
|
||||
PythonColorGrey = "Colore grigio"
|
||||
PythonColorGray = "Colore grigio"
|
||||
PythonColorOrange = "Colore arancione"
|
||||
PythonColorPink = "Colore rosa"
|
||||
PythonColorPurple = "Colore viola"
|
||||
|
||||
@@ -31,7 +31,7 @@ PythonColorBlack = "Zwarte kleur"
|
||||
PythonColorBlue = "Blauwe kleur"
|
||||
PythonColorBrown = "Bruine kleur"
|
||||
PythonColorGreen = "Groene kleur"
|
||||
PythonColorGrey = "Grijze kleur"
|
||||
PythonColorGray = "Grijze kleur"
|
||||
PythonColorOrange = "Oranje kleur"
|
||||
PythonColorPink = "Roze kleur"
|
||||
PythonColorPurple = "Paarse kleur"
|
||||
|
||||
@@ -31,7 +31,7 @@ PythonColorBlack = "Cor preta"
|
||||
PythonColorBlue = "Cor azul"
|
||||
PythonColorBrown = "Cor castanha"
|
||||
PythonColorGreen = "Cor verde"
|
||||
PythonColorGrey = "Cor cinzenta"
|
||||
PythonColorGray = "Cor cinzenta"
|
||||
PythonColorOrange = "Cor laranja"
|
||||
PythonColorPink = "Cor rosa"
|
||||
PythonColorPurple = "Cor roxa"
|
||||
|
||||
@@ -33,7 +33,7 @@ PythonCommandColorBlack = "'black'"
|
||||
PythonCommandColorBlue = "'blue'"
|
||||
PythonCommandColorBrown = "'brown'"
|
||||
PythonCommandColorGreen = "'green'"
|
||||
PythonCommandColorGrey = "'grey'"
|
||||
PythonCommandColorGray = "'gray'"
|
||||
PythonCommandColorOrange = "'orange'"
|
||||
PythonCommandColorPink = "'pink'"
|
||||
PythonCommandColorPurple = "'purple'"
|
||||
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
ConsoleLineView m_consoleLineView;
|
||||
};
|
||||
static KDColor textColor(ConsoleLine * line) {
|
||||
return line->isFromCurrentSession() ? KDColorBlack : Palette::GreyDark;
|
||||
return line->isFromCurrentSession() ? KDColorBlack : Palette::GrayDark;
|
||||
}
|
||||
MessageTextView m_promptView;
|
||||
ScrollableConsoleLineView m_scrollableView;
|
||||
|
||||
@@ -57,7 +57,7 @@ void EditorView::layoutSubviews(bool force) {
|
||||
/* EditorView::GutterView */
|
||||
|
||||
void EditorView::GutterView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor textColor = Palette::BlueishGrey;
|
||||
KDColor textColor = Palette::BlueishGray;
|
||||
KDColor backgroundColor = KDColor::RGB24(0xE4E6E7);
|
||||
|
||||
ctx->fillRect(rect, backgroundColor);
|
||||
|
||||
@@ -131,7 +131,7 @@ const ToolboxMessageTree MatplotlibPyplotModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorPink, I18n::Message::PythonColorPink, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorOrange, I18n::Message::PythonColorOrange, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorPurple, I18n::Message::PythonColorPurple, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGrey, I18n::Message::PythonColorGrey, false)
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGray, I18n::Message::PythonColorGray, false)
|
||||
};
|
||||
|
||||
const ToolboxMessageTree TurtleModuleChildren[] = {
|
||||
@@ -168,7 +168,7 @@ const ToolboxMessageTree TurtleModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorPink, I18n::Message::PythonColorPink, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorOrange, I18n::Message::PythonColorOrange, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorPurple, I18n::Message::PythonColorPurple, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGrey, I18n::Message::PythonColorGrey, false)
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGray, I18n::Message::PythonColorGray, false)
|
||||
};
|
||||
|
||||
const ToolboxMessageTree RandomModuleChildren[] = {
|
||||
@@ -332,7 +332,7 @@ const ToolboxMessageTree catalogChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGetrandbits, I18n::Message::PythonGetrandbits),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonTurtleCommandGoto, I18n::Message::PythonTurtleGoto),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGreen, I18n::Message::PythonColorGreen, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGrey, I18n::Message::PythonColorGrey, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGray, I18n::Message::PythonColorGray, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGrid, I18n::Message::PythonGrid),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonTurtleCommandHeading, I18n::Message::PythonTurtleHeading, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandHex, I18n::Message::PythonHex),
|
||||
|
||||
@@ -13,7 +13,7 @@ void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) cons
|
||||
// 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::GreyDark, backgroundColor);
|
||||
ctx->drawString(descriptionName, KDPoint(0, m_frame.height() - k_bottomMargin - k_font->glyphSize().height()), k_font, Palette::GrayDark, backgroundColor);
|
||||
}
|
||||
|
||||
// Draw the node name
|
||||
@@ -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::GreyDark, backgroundColor);
|
||||
ctx->drawString(sourceName, KDPoint(m_frame.width() - sourceNameSize.width(), nodeNameY), k_font, Palette::GrayDark, backgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ VariableBoxController::VariableBoxController(ScriptStore * scriptStore) :
|
||||
{
|
||||
for (int i = 0; i < k_scriptOriginsCount; i++) {
|
||||
m_subtitleCells[i].setBackgroundColor(Palette::WallScreen);
|
||||
m_subtitleCells[i].setTextColor(Palette::BlueishGrey);
|
||||
m_subtitleCells[i].setTextColor(Palette::BlueishGray);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ void App::Snapshot::tidy() {
|
||||
App::App(Snapshot * snapshot) :
|
||||
FunctionApp(snapshot, &m_inputViewController),
|
||||
m_listController(&m_listFooter, &m_listHeader, &m_listFooter, this),
|
||||
m_listFooter(&m_listHeader, &m_listController, &m_listController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGrey),
|
||||
m_listFooter(&m_listHeader, &m_listController, &m_listController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGray),
|
||||
m_listHeader(&m_listStackViewController, &m_listFooter, &m_listController),
|
||||
m_listStackViewController(&m_tabViewController, &m_listHeader),
|
||||
m_graphController(&m_graphAlternateEmptyViewController, this, snapshot->graphRange(), snapshot->cursor(), snapshot->indexFunctionSelectedByCursor(), snapshot->modelVersion(), snapshot->previousModelsVersions(), snapshot->rangeVersion(), snapshot->angleUnitVersion(), &m_graphHeader),
|
||||
|
||||
@@ -73,7 +73,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::GreyVeryDark, false);
|
||||
drawSegment(ctx, rect, minAbscissa, tangentParameterA*minAbscissa+tangentParameterB, maxAbscissa, tangentParameterA*maxAbscissa+tangentParameterB, Palette::GrayVeryDark, false);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -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::GreyDark;
|
||||
KDColor functionNameColor = function->isActive() ? function->color() : Palette::GrayDark;
|
||||
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() ? KDColorBlack : Palette::GreyDark;
|
||||
KDColor textColor = f->isActive() ? KDColorBlack : Palette::GrayDark;
|
||||
myCell->setTextColor(textColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -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::GreyBright;
|
||||
return Palette::GrayBright;
|
||||
}
|
||||
if (m_keyboardModel.testedKey() == key) {
|
||||
return KDColorBlue;
|
||||
|
||||
@@ -41,7 +41,7 @@ void CalculationCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), KDColorWhite);
|
||||
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::GreyMiddle);
|
||||
ctx->strokeRect(KDRect(2*k_margin+textSize.width(), 0, calculationCellWidth()+2*ResponderImageCell::k_outline, ImageCell::k_height+2*ResponderImageCell::k_outline), Palette::GrayMiddle);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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::GreyDark, Palette::WallScreen),
|
||||
m_titleView(KDFont::SmallFont, I18n::Message::ComputeProbability, 0.5f, 0.5f, Palette::GrayDark, Palette::WallScreen),
|
||||
m_selectableTableView(selectableTableView),
|
||||
m_distributionCurveView(distribution, calculation)
|
||||
{
|
||||
|
||||
@@ -59,10 +59,10 @@ void Cell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate height = bounds().height();
|
||||
KDColor backgroundColor = isHighlighted() ? Palette::Select : KDColorWhite;
|
||||
ctx->fillRect(KDRect(1, 1, width-2, height-1), backgroundColor);
|
||||
ctx->fillRect(KDRect(0, 0, width, 1), Palette::GreyBright);
|
||||
ctx->fillRect(KDRect(0, 1, 1, height-1), Palette::GreyBright);
|
||||
ctx->fillRect(KDRect(width-1, 1, 1, height-1), Palette::GreyBright);
|
||||
ctx->fillRect(KDRect(0, height-1, width, 1), Palette::GreyBright);
|
||||
ctx->fillRect(KDRect(0, 0, width, 1), Palette::GrayBright);
|
||||
ctx->fillRect(KDRect(0, 1, 1, height-1), Palette::GrayBright);
|
||||
ctx->fillRect(KDRect(width-1, 1, 1, height-1), Palette::GrayBright);
|
||||
ctx->fillRect(KDRect(0, height-1, width, 1), Palette::GrayBright);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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::GreyDark, Palette::WallScreen),
|
||||
m_titleView(KDFont::SmallFont, I18n::Message::ChooseDistribution, 0.5f, 0.5f, Palette::GrayDark, Palette::WallScreen),
|
||||
m_selectableTableView(selectableTableView)
|
||||
{}
|
||||
constexpr static KDCoordinate k_titleMargin = 8;
|
||||
|
||||
@@ -31,7 +31,7 @@ void DistributionCurveView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
if (m_distribution->isContinuous()) {
|
||||
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, m_distribution, nullptr, Palette::YellowDark, true, true, lowerBound, upperBound);
|
||||
} else {
|
||||
drawHistogram(ctx, rect, EvaluateAtAbscissa, m_distribution, nullptr, 0, 1, false, Palette::GreyMiddle, Palette::YellowDark, lowerBound, upperBound+0.5f);
|
||||
drawHistogram(ctx, rect, EvaluateAtAbscissa, m_distribution, nullptr, 0, 1, false, Palette::GrayMiddle, Palette::YellowDark, lowerBound, upperBound+0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Probability {
|
||||
|
||||
ParametersController::ContentView::ContentView(SelectableTableView * selectableTableView) :
|
||||
m_numberOfParameters(1),
|
||||
m_titleView(KDFont::SmallFont, I18n::Message::ChooseParameters, 0.5f, 0.5f, Palette::GreyDark, Palette::WallScreen),
|
||||
m_titleView(KDFont::SmallFont, I18n::Message::ChooseParameters, 0.5f, 0.5f, Palette::GrayDark, 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_selectableTableView(selectableTableView)
|
||||
|
||||
@@ -12,7 +12,7 @@ ResponderImageCell::ResponderImageCell(Responder * parentResponder, Distribution
|
||||
|
||||
void ResponderImageCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), KDColorWhite);
|
||||
ctx->strokeRect(KDRect(0, 0, ImageCell::k_width+2*k_outline, ImageCell::k_height+2*k_outline), Palette::GreyMiddle);
|
||||
ctx->strokeRect(KDRect(0, 0, ImageCell::k_width+2*k_outline, ImageCell::k_height+2*k_outline), Palette::GrayMiddle);
|
||||
}
|
||||
|
||||
KDSize ResponderImageCell::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -33,11 +33,11 @@ CalculationController::CalculationController(Responder * parentResponder, Button
|
||||
m_columnTitleCells[i].setParentResponder(&m_selectableTableView);
|
||||
}
|
||||
for (int i = 0; i < k_numberOfDoubleCalculationCells; i++) {
|
||||
m_doubleCalculationCells[i].setTextColor(Palette::GreyDark);
|
||||
m_doubleCalculationCells[i].setTextColor(Palette::GrayDark);
|
||||
m_doubleCalculationCells[i].setParentResponder(&m_selectableTableView);
|
||||
}
|
||||
for (int i = 0; i < k_numberOfCalculationCells;i++) {
|
||||
m_calculationCells[i].setTextColor(Palette::GreyDark);
|
||||
m_calculationCells[i].setTextColor(Palette::GrayDark);
|
||||
}
|
||||
for (int i = 0; i < k_maxNumberOfDisplayableRows; i++) {
|
||||
m_titleCells[i].setMessageFont(KDFont::SmallFont);
|
||||
|
||||
@@ -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::GreyDark : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GreyDark with graph/list_controller and statistics/store_controller
|
||||
mytitleCell->setColor(m_store->numberOfPairsOfSeries(seriesIndex) == 0 ? Palette::GrayDark : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GrayDark with graph/list_controller and statistics/store_controller
|
||||
char name[] = {isValuesColumn ? 'X' : 'Y', static_cast<char>('1' + seriesIndex), 0};
|
||||
mytitleCell->setText(name);
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ App::App(Snapshot * snapshot) :
|
||||
FunctionApp(snapshot, &m_inputViewController),
|
||||
m_sequenceContext(AppsContainer::sharedAppsContainer()->globalContext(), snapshot->functionStore()),
|
||||
m_listController(&m_listFooter, this, &m_listHeader, &m_listFooter),
|
||||
m_listFooter(&m_listHeader, &m_listController, &m_listController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGrey),
|
||||
m_listFooter(&m_listHeader, &m_listController, &m_listController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGray),
|
||||
m_listHeader(nullptr, &m_listFooter, &m_listController),
|
||||
m_listStackViewController(&m_tabViewController, &m_listHeader),
|
||||
m_graphController(&m_graphAlternateEmptyViewController, this, snapshot->functionStore(), snapshot->graphRange(), snapshot->cursor(), snapshot->indexFunctionSelectedByCursor(), snapshot->modelVersion(), snapshot->previousModelsVersions(), snapshot->rangeVersion(), snapshot->angleUnitVersion(), &m_graphHeader),
|
||||
|
||||
@@ -190,7 +190,7 @@ void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) {
|
||||
myCell->setLayout(sequence->secondInitialConditionName());
|
||||
}
|
||||
// Set the color
|
||||
KDColor nameColor = sequence->isActive() ? sequence->color() : Palette::GreyDark;
|
||||
KDColor nameColor = sequence->isActive() ? sequence->color() : Palette::GrayDark;
|
||||
myCell->setColor(nameColor);
|
||||
}
|
||||
|
||||
@@ -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 ? KDColorBlack : Palette::GrayDark;
|
||||
myCell->setTextColor(textColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,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::GreyDark);
|
||||
m_cells[i].setAccessoryTextColor(Palette::GrayDark);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
void reload() { layoutSubviews(); }
|
||||
static constexpr const KDFont * Font() { return KDFont::SmallFont; }
|
||||
static constexpr KDColor TextColor() { return KDColorBlack; }
|
||||
static constexpr KDColor BackgroundColor() { return Palette::GreyMiddle; }
|
||||
static constexpr KDColor BackgroundColor() { return Palette::GrayMiddle; }
|
||||
private:
|
||||
static constexpr KDCoordinate LineSpacing = 2;
|
||||
int numberOfSubviews() const override = 0;
|
||||
|
||||
@@ -35,7 +35,7 @@ void BufferTextViewWithTextField::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
|
||||
// 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::GreyMiddle);
|
||||
ctx->strokeRect(borderRect, Palette::GrayMiddle);
|
||||
}
|
||||
|
||||
void BufferTextViewWithTextField::didBecomeFirstResponder() {
|
||||
|
||||
@@ -8,15 +8,15 @@ ButtonWithSeparator::ButtonWithSeparator(Responder * parentResponder, I18n::Mess
|
||||
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::GreyBright);
|
||||
ctx->fillRect(KDRect(0, 0, width, k_lineThickness), Palette::GrayBright);
|
||||
ctx->fillRect(KDRect(0, k_lineThickness, width, k_margin-k_lineThickness), Palette::WallScreen);
|
||||
// Draw rectangle around cell
|
||||
ctx->fillRect(KDRect(0, k_margin, width, k_lineThickness), Palette::GreyBright);
|
||||
ctx->fillRect(KDRect(0, k_margin+k_lineThickness, k_lineThickness, height-k_margin), Palette::GreyBright);
|
||||
ctx->fillRect(KDRect(width-k_lineThickness, k_lineThickness+k_margin, k_lineThickness, height-k_margin), Palette::GreyBright);
|
||||
ctx->fillRect(KDRect(0, height-3*k_lineThickness, width, k_lineThickness), Palette::GreyWhite);
|
||||
ctx->fillRect(KDRect(0, height-2*k_lineThickness, width, k_lineThickness), Palette::GreyBright);
|
||||
ctx->fillRect(KDRect(k_lineThickness, height-k_lineThickness, width-2*k_lineThickness, k_lineThickness), Palette::GreyMiddle);
|
||||
ctx->fillRect(KDRect(0, k_margin, width, k_lineThickness), Palette::GrayBright);
|
||||
ctx->fillRect(KDRect(0, k_margin+k_lineThickness, k_lineThickness, height-k_margin), Palette::GrayBright);
|
||||
ctx->fillRect(KDRect(width-k_lineThickness, k_lineThickness+k_margin, k_lineThickness, height-k_margin), Palette::GrayBright);
|
||||
ctx->fillRect(KDRect(0, height-3*k_lineThickness, width, k_lineThickness), Palette::GrayWhite);
|
||||
ctx->fillRect(KDRect(0, height-2*k_lineThickness, width, k_lineThickness), Palette::GrayBright);
|
||||
ctx->fillRect(KDRect(k_lineThickness, height-k_lineThickness, width-2*k_lineThickness, k_lineThickness), Palette::GrayMiddle);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -536,8 +536,8 @@ void CurveView::drawArrow(KDContext * ctx, KDRect rect, float x, float y, float
|
||||
}
|
||||
|
||||
void CurveView::drawGrid(KDContext * ctx, KDRect rect) const {
|
||||
KDColor boldColor = Palette::GreyMiddle;
|
||||
KDColor lightColor = Palette::GreyWhite;
|
||||
KDColor boldColor = Palette::GrayMiddle;
|
||||
KDColor lightColor = Palette::GrayWhite;
|
||||
drawGridLines(ctx, rect, Axis::Vertical, m_curveViewRange->xGridUnit(), boldColor, lightColor);
|
||||
drawGridLines(ctx, rect, Axis::Horizontal, m_curveViewRange->yGridUnit(), boldColor, lightColor);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ 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_tempInteractiveRange.yAuto() ? Palette::GreyDark : KDColorBlack;
|
||||
KDColor yColor = m_tempInteractiveRange.yAuto() ? Palette::GrayDark : KDColorBlack;
|
||||
KDColor colors[k_numberOfTextCell+1] = {KDColorBlack, KDColorBlack, KDColorBlack, yColor, yColor};
|
||||
myCell->setTextColor(colors[index]);
|
||||
FloatParameterController::willDisplayCellForIndex(cell, index);
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Shared {
|
||||
|
||||
AbstractScrollableMultipleExpressionsView::ContentCell::ContentCell() :
|
||||
m_rightExpressionView(),
|
||||
m_approximateSign(k_font, k_defaultApproximateMessage, 0.5f, 0.5f, Palette::GreyVeryDark),
|
||||
m_approximateSign(k_font, k_defaultApproximateMessage, 0.5f, 0.5f, Palette::GrayVeryDark),
|
||||
m_centeredExpressionView(),
|
||||
m_selectedSubviewPosition(SubviewPosition::Center),
|
||||
m_displayCenter(true)
|
||||
@@ -48,7 +48,7 @@ void AbstractScrollableMultipleExpressionsView::ContentCell::setEven(bool even)
|
||||
|
||||
void AbstractScrollableMultipleExpressionsView::ContentCell::reloadTextColor() {
|
||||
if (displayCenter()) {
|
||||
m_rightExpressionView.setTextColor(Palette::GreyVeryDark);
|
||||
m_rightExpressionView.setTextColor(Palette::GrayVeryDark);
|
||||
} else {
|
||||
m_rightExpressionView.setTextColor(KDColorBlack);
|
||||
}
|
||||
|
||||
@@ -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::GreyMiddle),
|
||||
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_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::GreyMiddle);
|
||||
ctx->fillRect(bounds(), Palette::GrayMiddle);
|
||||
}
|
||||
|
||||
KDSize SumGraphController::LegendView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -86,7 +86,7 @@ ZoomParameterController::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::GreyBright);
|
||||
m_legends[i].setBackgroundColor(Palette::GrayBright);
|
||||
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};
|
||||
@@ -96,7 +96,7 @@ ZoomParameterController::ContentView::LegendView::LegendView()
|
||||
}
|
||||
|
||||
void ZoomParameterController::ContentView::LegendView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight), Palette::GreyBright);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight), Palette::GrayBright);
|
||||
}
|
||||
|
||||
int ZoomParameterController::ContentView::LegendView::numberOfSubviews() const {
|
||||
|
||||
@@ -48,7 +48,7 @@ App::App(Snapshot * snapshot) :
|
||||
m_intervalController(nullptr, this, snapshot->equationStore()),
|
||||
m_alternateEmptyViewController(nullptr, &m_solutionsController, &m_solutionsController),
|
||||
m_listController(&m_listFooter, snapshot->equationStore(), &m_listFooter),
|
||||
m_listFooter(&m_stackViewController, &m_listController, &m_listController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGrey, ButtonRowController::Size::Large),
|
||||
m_listFooter(&m_stackViewController, &m_listController, &m_listController, ButtonRowController::Position::Bottom, ButtonRowController::Style::EmbossedGray, ButtonRowController::Size::Large),
|
||||
m_stackViewController(&m_inputViewController, &m_listFooter),
|
||||
m_inputViewController(&m_modalViewController, &m_stackViewController, this, &m_listController, &m_listController)
|
||||
{
|
||||
|
||||
@@ -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::GreyWhite;
|
||||
KDColor boxColor = isMainViewSelected() ? m_selectedHistogramLightColor : Palette::GrayWhite;
|
||||
// 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::GreyDark;
|
||||
KDColor horizontalColor = isMainViewSelected() ? m_selectedHistogramColor : Palette::GrayDark;
|
||||
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,7 +83,7 @@ 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::GreyMiddle, k_quantileBarWidth);
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, calculations[k], lowBound, upBound, Palette::GrayMiddle, k_quantileBarWidth);
|
||||
}
|
||||
if (isMainViewSelected()) {
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, calculations[(int)*m_selectedQuantile], lowBound, upBound, Palette::YellowDark, k_quantileBarWidth);
|
||||
|
||||
@@ -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::GreyDark);
|
||||
m_calculationCells[i].setTextColor(Palette::GrayDark);
|
||||
}
|
||||
m_hideableCell.setHide(true);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class HistogramController;
|
||||
|
||||
class HistogramView : public Shared::HorizontallyLabeledCurveView {
|
||||
public:
|
||||
HistogramView(HistogramController * controller, Store * store, int series, Shared::BannerView * bannerView, KDColor selectedHistogramColor = Palette::Select, KDColor notSelectedHistogramColor = Palette::GreyMiddle, KDColor selectedBarColor = Palette::YellowDark);
|
||||
HistogramView(HistogramController * controller, Store * store, int series, Shared::BannerView * bannerView, KDColor selectedHistogramColor = Palette::Select, KDColor notSelectedHistogramColor = Palette::GrayMiddle, KDColor selectedBarColor = Palette::YellowDark);
|
||||
int series() const { return m_series; }
|
||||
void reload() override;
|
||||
void reloadSelectedBar();
|
||||
|
||||
@@ -49,7 +49,7 @@ void StoreController::willDisplayCellAtLocation(HighlightCell * cell, int i, int
|
||||
I18n::Message sizesMessages[] = {I18n::Message::Sizes1, I18n::Message::Sizes2, I18n::Message::Sizes3};
|
||||
mytitleCell->setText(I18n::translate(sizesMessages[seriesIndex]));
|
||||
}
|
||||
mytitleCell->setColor(m_store->numberOfPairsOfSeries(seriesIndex) == 0 ? Palette::GreyDark : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GreyDark with graph/list_controller
|
||||
mytitleCell->setColor(m_store->numberOfPairsOfSeries(seriesIndex) == 0 ? Palette::GrayDark : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GrayDark with graph/list_controller
|
||||
}
|
||||
|
||||
HighlightCell * StoreController::titleCells(int index) {
|
||||
|
||||
@@ -18,7 +18,7 @@ public:
|
||||
};
|
||||
enum class Style {
|
||||
PlainWhite,
|
||||
EmbossedGrey
|
||||
EmbossedGray
|
||||
};
|
||||
enum class Size {
|
||||
Small,
|
||||
|
||||
@@ -10,11 +10,11 @@ public:
|
||||
constexpr static KDColor YellowLight = KDColor::RGB24(0xffcc7b);
|
||||
constexpr static KDColor PurpleBright = KDColor::RGB24(0x656975);
|
||||
constexpr static KDColor PurpleDark = KDColor::RGB24(0x414147);
|
||||
constexpr static KDColor GreyWhite = KDColor::RGB24(0xf5f5f5);
|
||||
constexpr static KDColor GreyBright = KDColor::RGB24(0xececec);
|
||||
constexpr static KDColor GreyMiddle = KDColor::RGB24(0xd9d9d9);
|
||||
constexpr static KDColor GreyDark = KDColor::RGB24(0xa7a7a7);
|
||||
constexpr static KDColor GreyVeryDark = KDColor::RGB24(0x8c8c8c);
|
||||
constexpr static KDColor GrayWhite = KDColor::RGB24(0xf5f5f5);
|
||||
constexpr static KDColor GrayBright = KDColor::RGB24(0xececec);
|
||||
constexpr static KDColor GrayMiddle = KDColor::RGB24(0xd9d9d9);
|
||||
constexpr static KDColor GrayDark = KDColor::RGB24(0xa7a7a7);
|
||||
constexpr static KDColor GrayVeryDark = KDColor::RGB24(0x8c8c8c);
|
||||
constexpr static KDColor Select = KDColor::RGB24(0xd4d7e0);
|
||||
constexpr static KDColor SelectDark = KDColor::RGB24(0xb0b8d8);
|
||||
constexpr static KDColor WallScreen = KDColor::RGB24(0xf7f9fa);
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
constexpr static KDColor GreenLight = KDColor::RGB24(0x52db8f);
|
||||
constexpr static KDColor Brown = KDColor::RGB24(0x8d7350);
|
||||
constexpr static KDColor Purple = KDColor::RGB24(0x6e2d79);
|
||||
constexpr static KDColor BlueishGrey = KDColor::RGB24(0x919ea4);
|
||||
constexpr static KDColor BlueishGray = KDColor::RGB24(0x919ea4);
|
||||
constexpr static KDColor Cyan = KDColor::RGB24(0x00ffff);
|
||||
constexpr static KDColor DataColor[] = {Red, Blue, Green, YellowDark, Magenta, Turquoise, Pink, Orange};
|
||||
constexpr static KDColor DataColorLight[] = {RedLight, BlueLight, GreenLight, YellowLight};
|
||||
|
||||
@@ -10,10 +10,10 @@ constexpr uint8_t kMaxNumberOfStacks = 4;
|
||||
class StackViewController : public ViewController {
|
||||
public:
|
||||
StackViewController(Responder * parentResponder, ViewController * rootViewController,
|
||||
KDColor textColor = Palette::SubTab, KDColor backgroundColor = KDColorWhite, KDColor separatorColor = Palette::GreyBright);
|
||||
KDColor textColor = Palette::SubTab, KDColor backgroundColor = KDColorWhite, KDColor separatorColor = Palette::GrayBright);
|
||||
|
||||
/* Push creates a new StackView and adds it */
|
||||
void push(ViewController * vc, KDColor textColor = Palette::SubTab, KDColor backgroundColor = KDColorWhite, KDColor separatorColor = Palette::GreyBright);
|
||||
void push(ViewController * vc, KDColor textColor = Palette::SubTab, KDColor backgroundColor = KDColorWhite, KDColor separatorColor = Palette::GrayBright);
|
||||
void pop();
|
||||
|
||||
int depth() const { return m_numberOfChildren; }
|
||||
@@ -28,7 +28,7 @@ public:
|
||||
private:
|
||||
class Frame {
|
||||
public:
|
||||
Frame(ViewController * viewController = nullptr, KDColor textColor = Palette::SubTab, KDColor backgroundColor = KDColorWhite, KDColor separatorColor = Palette::GreyBright) :
|
||||
Frame(ViewController * viewController = nullptr, KDColor textColor = Palette::SubTab, KDColor backgroundColor = KDColorWhite, KDColor separatorColor = Palette::GrayBright) :
|
||||
m_viewController(viewController),
|
||||
m_textColor(textColor),
|
||||
m_backgroundColor(backgroundColor),
|
||||
|
||||
@@ -72,7 +72,7 @@ void ButtonRowController::ContentView::layoutSubviews(bool force) {
|
||||
KDCoordinate widthMargin = 0;
|
||||
KDCoordinate buttonHeightMargin = 0;
|
||||
KDCoordinate buttonHeight = rowHeight;
|
||||
if (m_style == Style::EmbossedGrey) {
|
||||
if (m_style == Style::EmbossedGray) {
|
||||
KDCoordinate totalButtonWidth = 0;
|
||||
for (int i = 0; i < nbOfButtons; i++) {
|
||||
Button * button = buttonAtIndex(i);
|
||||
@@ -96,28 +96,28 @@ void ButtonRowController::ContentView::layoutSubviews(bool force) {
|
||||
void ButtonRowController::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
if (numberOfButtons() == 0) {
|
||||
if (m_position == Position::Top) {
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), 1), Palette::GreyWhite);
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), 1), Palette::GrayWhite);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (m_style == Style::PlainWhite) {
|
||||
if (m_position == Position::Top) {
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_plainStyleHeight), KDColorWhite);
|
||||
ctx->fillRect(KDRect(0, k_plainStyleHeight, bounds().width(), 1), Palette::GreyWhite);
|
||||
ctx->fillRect(KDRect(0, k_plainStyleHeight, bounds().width(), 1), Palette::GrayWhite);
|
||||
} else {
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight, bounds().width(), k_plainStyleHeight), KDColorWhite);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight-1, bounds().width(), 1), Palette::GreyWhite);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - k_plainStyleHeight-1, bounds().width(), 1), Palette::GrayWhite);
|
||||
}
|
||||
return;
|
||||
}
|
||||
int buttonHeight = m_size == Size::Small ? k_embossedStyleHeightSmall : k_embossedStyleHeightLarge;
|
||||
int buttonMargin = m_size == Size::Small ? k_embossedStyleHeightMarginSmall : k_embossedStyleHeightMarginLarge;
|
||||
if (m_position == Position::Top) {
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), buttonHeight), Palette::GreyWhite);
|
||||
ctx->fillRect(KDRect(0, buttonHeight, bounds().width(), 1), Palette::GreyMiddle);
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), buttonHeight), Palette::GrayWhite);
|
||||
ctx->fillRect(KDRect(0, buttonHeight, bounds().width(), 1), Palette::GrayMiddle);
|
||||
} else {
|
||||
ctx->fillRect(KDRect(0, bounds().height() - buttonHeight, bounds().width(), buttonHeight), Palette::GreyWhite);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - buttonHeight-1, bounds().width(), 1), Palette::GreyMiddle);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - buttonHeight, bounds().width(), buttonHeight), Palette::GrayWhite);
|
||||
ctx->fillRect(KDRect(0, bounds().height() - buttonHeight-1, bounds().width(), 1), Palette::GrayMiddle);
|
||||
}
|
||||
KDCoordinate y0 = m_position == Position::Top ? buttonMargin-1 : bounds().height()-buttonHeight+buttonMargin-1;
|
||||
KDCoordinate y1 = m_position == Position::Top ? buttonHeight-buttonMargin-2 : bounds().height()-buttonMargin;
|
||||
@@ -132,12 +132,12 @@ void ButtonRowController::ContentView::drawRect(KDContext * ctx, KDRect rect) co
|
||||
for (int i = 0; i < numberOfButtons(); i++) {
|
||||
Button * button = buttonAtIndex(i);
|
||||
KDCoordinate buttonWidth = button->minimalSizeForOptimalDisplay().width();
|
||||
ctx->fillRect(KDRect(currentXOrigin, y0, 1, y1-y0+1), Palette::GreyMiddle);
|
||||
ctx->fillRect(KDRect(currentXOrigin-1, y0, 1, y1-y0+2), Palette::GreyDark);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y0, buttonWidth+2, 1), Palette::GreyMiddle);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y1, buttonWidth+2, 1), Palette::GreyMiddle);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y1+1, buttonWidth+2, 1), Palette::GreyDark);
|
||||
ctx->fillRect(KDRect(currentXOrigin+1+buttonWidth, y0, 1, y1-y0+1), Palette::GreyMiddle);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y0, 1, y1-y0+1), Palette::GrayMiddle);
|
||||
ctx->fillRect(KDRect(currentXOrigin-1, y0, 1, y1-y0+2), Palette::GrayDark);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y0, buttonWidth+2, 1), Palette::GrayMiddle);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y1, buttonWidth+2, 1), Palette::GrayMiddle);
|
||||
ctx->fillRect(KDRect(currentXOrigin, y1+1, buttonWidth+2, 1), Palette::GrayDark);
|
||||
ctx->fillRect(KDRect(currentXOrigin+1+buttonWidth, y0, 1, y1-y0+1), Palette::GrayMiddle);
|
||||
currentXOrigin += buttonWidth + widthMargin;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ void ExpressionField::layoutSubviews(bool force) {
|
||||
|
||||
void ExpressionField::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
// Draw the separator
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), Palette::GreyMiddle);
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), Palette::GrayMiddle);
|
||||
}
|
||||
|
||||
bool ExpressionField::handleEvent(Ion::Events::Event event) {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
ExpressionTableCellWithExpression::ExpressionTableCellWithExpression(Responder * parentResponder) :
|
||||
ExpressionTableCell(parentResponder, Layout::HorizontalLeftOverlap),
|
||||
m_accessoryExpressionView(this, k_horizontalMargin, 0, 1.0f, 0.5f, Palette::GreyDark, KDColorWhite)
|
||||
m_accessoryExpressionView(this, k_horizontalMargin, 0, 1.0f, 0.5f, Palette::GrayDark, KDColorWhite)
|
||||
{}
|
||||
|
||||
View * ExpressionTableCellWithExpression::accessoryView() const {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
ExpressionTableCellWithPointer::ExpressionTableCellWithPointer(Responder * parentResponder, I18n::Message accessoryMessage, Layout layout) :
|
||||
ExpressionTableCell(parentResponder, layout),
|
||||
m_accessoryView(KDFont::SmallFont, accessoryMessage, 0.0f, 0.5f, Palette::GreyDark, KDColorWhite)
|
||||
m_accessoryView(KDFont::SmallFont, accessoryMessage, 0.0f, 0.5f, Palette::GrayDark, KDColorWhite)
|
||||
{
|
||||
if (layout != Layout::Vertical) {
|
||||
m_accessoryView.setAlignment(1.0f, 0.5f);
|
||||
|
||||
@@ -48,7 +48,7 @@ void GaugeView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor gaugeIndicatorWorkingBuffer[GaugeView::k_indicatorDiameter*GaugeView::k_indicatorDiameter];
|
||||
|
||||
ctx->fillRect(KDRect(k_indicatorDiameter/2, (height-k_thickness)/2, width*m_level, k_thickness), Palette::YellowDark);
|
||||
ctx->fillRect(KDRect(k_indicatorDiameter/2+width*m_level, (height-k_thickness)/2, width*(1.0f-m_level), k_thickness), Palette::GreyDark);
|
||||
ctx->fillRect(KDRect(k_indicatorDiameter/2+width*m_level, (height-k_thickness)/2, width*(1.0f-m_level), k_thickness), Palette::GrayDark);
|
||||
KDRect frame(width*m_level, (height-k_indicatorDiameter)/2, k_indicatorDiameter, k_indicatorDiameter);
|
||||
ctx->blendRectWithMask(frame, Palette::YellowDark, (const uint8_t *)gaugeIndicatorMask, gaugeIndicatorWorkingBuffer);
|
||||
}
|
||||
|
||||
@@ -43,9 +43,9 @@ bool LayoutField::ContentView::setEditing(bool isEditing) {
|
||||
|
||||
void LayoutField::ContentView::useInsertionCursor() {
|
||||
if (m_insertionCursor.isDefined()) {
|
||||
m_cursor.layout().removeGreySquaresFromAllMatrixAncestors();
|
||||
m_cursor.layout().removeGraySquaresFromAllMatrixAncestors();
|
||||
m_cursor = m_insertionCursor;
|
||||
m_cursor.layout().addGreySquaresToAllMatrixAncestors();
|
||||
m_cursor.layout().addGraySquaresToAllMatrixAncestors();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ void LayoutField::ContentView::deleteSelection() {
|
||||
void LayoutField::ContentView::updateInsertionCursor() {
|
||||
if (!m_insertionCursor.isDefined()) {
|
||||
Layout l = m_cursor.layout();
|
||||
if (l.type() == LayoutNode::Type::EmptyLayout && static_cast<EmptyLayout &>(l).color() == EmptyLayoutNode::Color::Grey) {
|
||||
if (l.type() == LayoutNode::Type::EmptyLayout && static_cast<EmptyLayout &>(l).color() == EmptyLayoutNode::Color::Gray) {
|
||||
// Don't set m_insertionCursor pointing to a layout which might disappear
|
||||
return;
|
||||
}
|
||||
@@ -335,7 +335,7 @@ CodePoint LayoutField::XNTCodePoint(CodePoint defaultXNTCodePoint) {
|
||||
}
|
||||
|
||||
void LayoutField::putCursorRightOfLayout() {
|
||||
m_contentView.cursor()->layout().removeGreySquaresFromAllMatrixAncestors();
|
||||
m_contentView.cursor()->layout().removeGraySquaresFromAllMatrixAncestors();
|
||||
m_contentView.cursor()->showEmptyLayoutIfNeeded();
|
||||
m_contentView.setCursor(LayoutCursor(m_contentView.expressionView()->layout(), LayoutCursor::Position::Right));
|
||||
}
|
||||
@@ -448,11 +448,11 @@ bool LayoutField::handleEvent(Ion::Events::Event event) {
|
||||
Layout p = selectStart->parent();
|
||||
assert(p == selectEnd->parent());
|
||||
assert(p.type() == LayoutNode::Type::HorizontalLayout);
|
||||
removedSquares = p.removeGreySquaresFromAllMatrixChildren();
|
||||
removedSquares = p.removeGraySquaresFromAllMatrixChildren();
|
||||
} else {
|
||||
removedSquares = selectStart->removeGreySquaresFromAllMatrixChildren();
|
||||
removedSquares = selectStart->removeGraySquaresFromAllMatrixChildren();
|
||||
}
|
||||
shouldRecomputeLayout = m_contentView.cursor()->layout().removeGreySquaresFromAllMatrixChildren() || removedSquares || shouldRecomputeLayout;
|
||||
shouldRecomputeLayout = m_contentView.cursor()->layout().removeGraySquaresFromAllMatrixChildren() || removedSquares || shouldRecomputeLayout;
|
||||
}
|
||||
} else if (privateHandleEvent(event, &shouldScrollAndRedraw)) {
|
||||
if (!shouldScrollAndRedraw) {
|
||||
@@ -751,7 +751,7 @@ void LayoutField::insertLayoutAtCursor(Layout layoutR, Poincare::Expression corr
|
||||
}
|
||||
|
||||
// Handle matrices
|
||||
cursor->layout().addGreySquaresToAllMatrixAncestors();
|
||||
cursor->layout().addGraySquaresToAllMatrixAncestors();
|
||||
|
||||
// Handle empty layouts
|
||||
cursor->hideEmptyLayoutIfNeeded();
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
MessageTableCellWithChevronAndBuffer::MessageTableCellWithChevronAndBuffer(const KDFont * labelFont, const KDFont * subAccessoryFont) :
|
||||
MessageTableCellWithChevron((I18n::Message)0, labelFont),
|
||||
m_subAccessoryView(subAccessoryFont, 1.0f, 0.5f, Palette::GreyDark)
|
||||
m_subAccessoryView(subAccessoryFont, 1.0f, 0.5f, Palette::GrayDark)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
MessageTableCellWithChevronAndExpression::MessageTableCellWithChevronAndExpression(I18n::Message message, const KDFont * font) :
|
||||
MessageTableCellWithChevron(message, font),
|
||||
m_subtitleView(1.0f, 0.5f, Palette::GreyDark)
|
||||
m_subtitleView(1.0f, 0.5f, Palette::GrayDark)
|
||||
{
|
||||
m_subtitleView.setHorizontalMargin(Metric::ExpressionViewHorizontalMargin);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
MessageTableCellWithChevronAndMessage::MessageTableCellWithChevronAndMessage(const KDFont * labelFont, const KDFont * contentFont) :
|
||||
MessageTableCellWithChevron((I18n::Message)0, labelFont),
|
||||
m_subtitleView(contentFont, (I18n::Message)0, 1.0f, 0.5f, Palette::GreyDark)
|
||||
m_subtitleView(contentFont, (I18n::Message)0, 1.0f, 0.5f, Palette::GrayDark)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
MessageTableCellWithExpression::MessageTableCellWithExpression(I18n::Message message, const KDFont * font) :
|
||||
MessageTableCell(message, font),
|
||||
m_subtitleView(1.0f, 0.5f, Palette::GreyDark)
|
||||
m_subtitleView(1.0f, 0.5f, Palette::GrayDark)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ void ModalViewEmptyController::ModalViewEmptyView::setMessages(I18n::Message * m
|
||||
|
||||
void ModalViewEmptyController::ModalViewEmptyView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), k_backgroundColor);
|
||||
drawBorderOfRect(ctx, bounds(), Palette::GreyBright);
|
||||
drawBorderOfRect(ctx, bounds(), Palette::GrayBright);
|
||||
}
|
||||
|
||||
int ModalViewEmptyController::ModalViewEmptyView::numberOfSubviews() const {
|
||||
|
||||
@@ -5,11 +5,11 @@ constexpr KDColor Palette::YellowDark;
|
||||
constexpr KDColor Palette::YellowLight;
|
||||
constexpr KDColor Palette::PurpleBright;
|
||||
constexpr KDColor Palette::PurpleDark;
|
||||
constexpr KDColor Palette::GreyWhite;
|
||||
constexpr KDColor Palette::GreyBright;
|
||||
constexpr KDColor Palette::GreyMiddle;
|
||||
constexpr KDColor Palette::GreyDark;
|
||||
constexpr KDColor Palette::GreyVeryDark;
|
||||
constexpr KDColor Palette::GrayWhite;
|
||||
constexpr KDColor Palette::GrayBright;
|
||||
constexpr KDColor Palette::GrayMiddle;
|
||||
constexpr KDColor Palette::GrayDark;
|
||||
constexpr KDColor Palette::GrayVeryDark;
|
||||
constexpr KDColor Palette::Select;
|
||||
constexpr KDColor Palette::SelectDark;
|
||||
constexpr KDColor Palette::WallScreen;
|
||||
@@ -29,7 +29,7 @@ constexpr KDColor Palette::GreenLight;
|
||||
constexpr KDColor Palette::Brown;
|
||||
constexpr KDColor Palette::Purple;
|
||||
constexpr KDColor Palette::Cyan;
|
||||
constexpr KDColor Palette::BlueishGrey;
|
||||
constexpr KDColor Palette::BlueishGray;
|
||||
constexpr KDColor Palette::DataColor[];
|
||||
constexpr KDColor Palette::DataColorLight[];
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ extern "C" {
|
||||
|
||||
ScrollViewIndicator::ScrollViewIndicator() :
|
||||
View(),
|
||||
m_color(Palette::GreyDark),
|
||||
m_color(Palette::GrayDark),
|
||||
m_margin(Metric::CommonTopMargin)
|
||||
{
|
||||
}
|
||||
@@ -17,7 +17,7 @@ ScrollViewBar::ScrollViewBar() :
|
||||
ScrollViewIndicator(),
|
||||
m_offset(0),
|
||||
m_visibleLength(0),
|
||||
m_trackColor(Palette::GreyMiddle)
|
||||
m_trackColor(Palette::GrayMiddle)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ void SwitchView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate switchHalfHeight = k_switchHeight/2;
|
||||
KDColor switchWorkingBuffer[SwitchView::k_switchWidth*SwitchView::k_switchHeight];
|
||||
|
||||
KDColor mainColor = m_state ? Palette::YellowDark : Palette::GreyDark;
|
||||
KDColor mainColor = m_state ? Palette::YellowDark : Palette::GrayDark;
|
||||
KDRect frame(width - k_switchWidth, heightCenter -switchHalfHeight, k_switchWidth, k_switchHeight);
|
||||
ctx->blendRectWithMask(frame, mainColor, (const uint8_t *)switchMask, switchWorkingBuffer);
|
||||
KDCoordinate onOffX = width - (m_state ? k_onOffSize : k_switchWidth);
|
||||
|
||||
@@ -166,5 +166,5 @@ void TableCell::layoutSubviews(bool force) {
|
||||
void TableCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor backColor = isHighlighted() ? Palette::Select : backgroundColor();
|
||||
drawInnerRect(ctx, bounds(), backColor);
|
||||
drawBorderOfRect(ctx, bounds(), Palette::GreyBright);
|
||||
drawBorderOfRect(ctx, bounds(), Palette::GrayBright);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ void Toolbox::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
MessageTableCellWithMessage * myCell = (MessageTableCellWithMessage *)cell;
|
||||
myCell->setMessage(messageTree->label());
|
||||
myCell->setAccessoryMessage(messageTree->text());
|
||||
myCell->setAccessoryTextColor(Palette::GreyDark);
|
||||
myCell->setAccessoryTextColor(Palette::GrayDark);
|
||||
return;
|
||||
}
|
||||
MessageTableCell * myCell = (MessageTableCell *)cell;
|
||||
|
||||
@@ -204,10 +204,10 @@ int main(int argc, char * argv[]) {
|
||||
fprintf(sourceFile, "static constexpr KDCoordinate glyphWidth = %d;\n\n", glyph_width);
|
||||
fprintf(sourceFile, "static constexpr KDCoordinate glyphHeight = %d;\n\n", glyph_height);
|
||||
|
||||
int greyscaleBitsPerPixel = 4;
|
||||
int grayscaleBitsPerPixel = 4;
|
||||
|
||||
int sizeOfUncompressedGlyphBuffer = glyph_width * glyph_height * greyscaleBitsPerPixel/8;
|
||||
ENSURE(8*sizeOfUncompressedGlyphBuffer == glyph_width * glyph_height * greyscaleBitsPerPixel, "Error: the glyph size (%dx%d@%dbpp) cannot fit in an integral number of bytes", glyph_width, glyph_height, greyscaleBitsPerPixel);
|
||||
int sizeOfUncompressedGlyphBuffer = glyph_width * glyph_height * grayscaleBitsPerPixel/8;
|
||||
ENSURE(8*sizeOfUncompressedGlyphBuffer == glyph_width * glyph_height * grayscaleBitsPerPixel, "Error: the glyph size (%dx%d@%dbpp) cannot fit in an integral number of bytes", glyph_width, glyph_height, grayscaleBitsPerPixel);
|
||||
uint8_t * uncompressedGlyphBuffer = (uint8_t *)malloc(sizeOfUncompressedGlyphBuffer);
|
||||
|
||||
uint16_t glyphDataOffset[NumberOfCodePoints+1];
|
||||
@@ -225,9 +225,9 @@ int main(int argc, char * argv[]) {
|
||||
for (int x = 0; x < glyph_width; x++) {
|
||||
pixel_t * pixel = (bitmap_image.pixels + (y+characterY)*bitmap_image.width + (x+characterX));
|
||||
|
||||
uint8_t greyscaleValue = (0xFF - pixel->green) >> (8 - greyscaleBitsPerPixel);
|
||||
accumulator = (accumulator << greyscaleBitsPerPixel) | greyscaleValue;
|
||||
if (numberOfValuesAccumulated++ == (8/greyscaleBitsPerPixel)-1) {
|
||||
uint8_t grayscaleValue = (0xFF - pixel->green) >> (8 - grayscaleBitsPerPixel);
|
||||
accumulator = (accumulator << grayscaleBitsPerPixel) | grayscaleValue;
|
||||
if (numberOfValuesAccumulated++ == (8/grayscaleBitsPerPixel)-1) {
|
||||
uncompressedGlyphBuffer[uncompressedGlyphBufferIndex++] = accumulator;
|
||||
accumulator = 0;
|
||||
numberOfValuesAccumulated = 0;
|
||||
@@ -261,7 +261,7 @@ int main(int argc, char * argv[]) {
|
||||
size_t initialDataSize = NumberOfCodePoints * glyph_width * glyph_height;
|
||||
|
||||
fprintf(sourceFile, "/* Rasterized = %5zu bytes (%d glyphs x %d pixels)\n", initialDataSize, NumberOfCodePoints, glyph_width*glyph_height);
|
||||
fprintf(sourceFile, " * Downsampled = %5lu bytes (1/%d of rasterized)\n", initialDataSize*greyscaleBitsPerPixel/8, 8/greyscaleBitsPerPixel);
|
||||
fprintf(sourceFile, " * Downsampled = %5lu bytes (1/%d of rasterized)\n", initialDataSize*grayscaleBitsPerPixel/8, 8/grayscaleBitsPerPixel);
|
||||
fprintf(sourceFile, " * Compressed = %5zu bytes (%.2f%% of rasterized) */\n", finalDataSize, 100.0*finalDataSize/initialDataSize);
|
||||
|
||||
fprintf(sourceFile, "static constexpr uint8_t glyphData[%d] = {", lastOffset);
|
||||
|
||||
@@ -42,10 +42,10 @@ public:
|
||||
public:
|
||||
GlyphBuffer() {} // Don't initialize either buffer
|
||||
KDColor * colorBuffer() { return m_colors; }
|
||||
uint8_t * greyscaleBuffer() { return m_greyscales; }
|
||||
uint8_t * secondaryGreyscaleBuffer() { return m_greyscales + k_maxGlyphPixelCount; }
|
||||
uint8_t * grayscaleBuffer() { return m_grayscales; }
|
||||
uint8_t * secondaryGrayscaleBuffer() { return m_grayscales + k_maxGlyphPixelCount; }
|
||||
private:
|
||||
uint8_t m_greyscales[2*k_maxGlyphPixelCount];
|
||||
uint8_t m_grayscales[2*k_maxGlyphPixelCount];
|
||||
KDColor m_colors[k_maxGlyphPixelCount];
|
||||
};
|
||||
|
||||
@@ -62,8 +62,8 @@ public:
|
||||
static constexpr GlyphIndex IndexForReplacementCharacterCodePoint = 133;
|
||||
GlyphIndex indexForCodePoint(CodePoint c) const;
|
||||
|
||||
void setGlyphGreyscalesForCodePoint(CodePoint codePoint, GlyphBuffer * glyphBuffer) const;
|
||||
void accumulateGlyphGreyscalesForCodePoint(CodePoint codePoint, GlyphBuffer * glyphBuffer) const;
|
||||
void setGlyphGrayscalesForCodePoint(CodePoint codePoint, GlyphBuffer * glyphBuffer) const;
|
||||
void accumulateGlyphGrayscalesForCodePoint(CodePoint codePoint, GlyphBuffer * glyphBuffer) const;
|
||||
|
||||
using RenderPalette = KDPalette<(1<<k_bitsPerPixel)>;
|
||||
void colorizeGlyphBuffer(const RenderPalette * renderPalette, GlyphBuffer * glyphBuffer) const;
|
||||
@@ -76,7 +76,7 @@ public:
|
||||
constexpr KDFont(size_t tableLength, const CodePointIndexPair * table, KDCoordinate glyphWidth, KDCoordinate glyphHeight, const uint16_t * glyphDataOffset, const uint8_t * data) :
|
||||
m_tableLength(tableLength), m_table(table), m_glyphSize(glyphWidth, glyphHeight), m_glyphDataOffset(glyphDataOffset), m_data(data) { }
|
||||
private:
|
||||
void fetchGreyscaleGlyphAtIndex(GlyphIndex index, uint8_t * greyscaleBuffer) const;
|
||||
void fetchGrayscaleGlyphAtIndex(GlyphIndex index, uint8_t * grayscaleBuffer) const;
|
||||
|
||||
const uint8_t * compressedGlyphData(GlyphIndex index) const {
|
||||
return m_data + m_glyphDataOffset[index];
|
||||
|
||||
@@ -35,10 +35,10 @@ KDPoint KDContext::pushOrPullString(const char * text, KDPoint p, const KDFont *
|
||||
codePoint = decoder.nextCodePoint();
|
||||
} else {
|
||||
assert(!codePoint.isCombining());
|
||||
font->setGlyphGreyscalesForCodePoint(codePoint, &glyphBuffer);
|
||||
font->setGlyphGrayscalesForCodePoint(codePoint, &glyphBuffer);
|
||||
codePoint = decoder.nextCodePoint();
|
||||
while (codePoint.isCombining()) {
|
||||
font->accumulateGlyphGreyscalesForCodePoint(codePoint, &glyphBuffer);
|
||||
font->accumulateGlyphGrayscalesForCodePoint(codePoint, &glyphBuffer);
|
||||
codePointPointer = decoder.stringPosition();
|
||||
codePoint = decoder.nextCodePoint();
|
||||
}
|
||||
|
||||
@@ -33,51 +33,51 @@ KDSize KDFont::stringSizeUntil(const char * text, const char * limit) const {
|
||||
return stringSize;
|
||||
}
|
||||
|
||||
void KDFont::setGlyphGreyscalesForCodePoint(CodePoint codePoint, GlyphBuffer * glyphBuffer) const {
|
||||
fetchGreyscaleGlyphAtIndex(indexForCodePoint(codePoint), glyphBuffer->greyscaleBuffer());
|
||||
void KDFont::setGlyphGrayscalesForCodePoint(CodePoint codePoint, GlyphBuffer * glyphBuffer) const {
|
||||
fetchGrayscaleGlyphAtIndex(indexForCodePoint(codePoint), glyphBuffer->grayscaleBuffer());
|
||||
}
|
||||
|
||||
void KDFont::accumulateGlyphGreyscalesForCodePoint(CodePoint codePoint, GlyphBuffer * glyphBuffer) const {
|
||||
uint8_t * greyscaleBuffer = glyphBuffer->greyscaleBuffer();
|
||||
uint8_t * accumulationGreyscaleBuffer = glyphBuffer->secondaryGreyscaleBuffer();
|
||||
fetchGreyscaleGlyphAtIndex(indexForCodePoint(codePoint), accumulationGreyscaleBuffer);
|
||||
void KDFont::accumulateGlyphGrayscalesForCodePoint(CodePoint codePoint, GlyphBuffer * glyphBuffer) const {
|
||||
uint8_t * grayscaleBuffer = glyphBuffer->grayscaleBuffer();
|
||||
uint8_t * accumulationGrayscaleBuffer = glyphBuffer->secondaryGrayscaleBuffer();
|
||||
fetchGrayscaleGlyphAtIndex(indexForCodePoint(codePoint), accumulationGrayscaleBuffer);
|
||||
for (int i=0; i<m_glyphSize.width()*m_glyphSize.height(); i++) {
|
||||
greyscaleBuffer[i] |= accumulationGreyscaleBuffer[i];
|
||||
grayscaleBuffer[i] |= accumulationGrayscaleBuffer[i];
|
||||
}
|
||||
}
|
||||
|
||||
void KDFont::fetchGreyscaleGlyphAtIndex(KDFont::GlyphIndex index, uint8_t * greyscaleBuffer) const {
|
||||
void KDFont::fetchGrayscaleGlyphAtIndex(KDFont::GlyphIndex index, uint8_t * grayscaleBuffer) const {
|
||||
Ion::decompress(
|
||||
compressedGlyphData(index),
|
||||
greyscaleBuffer,
|
||||
grayscaleBuffer,
|
||||
compressedGlyphDataSize(index),
|
||||
m_glyphSize.width() * m_glyphSize.height() * k_bitsPerPixel/8
|
||||
);
|
||||
}
|
||||
|
||||
void KDFont::colorizeGlyphBuffer(const RenderPalette * renderPalette, GlyphBuffer * glyphBuffer) const {
|
||||
/* Since a greyscale value is smaller than a color value (see assertion), we
|
||||
* can store the temporary greyscale values in the output pixel buffer.
|
||||
/* Since a grayscale value is smaller than a color value (see assertion), we
|
||||
* can store the temporary grayscale values in the output pixel buffer.
|
||||
* What's great is that now, if we fill the pixel buffer right-to-left with
|
||||
* colors derived from the temporary greyscale values, we will never overwrite
|
||||
* colors derived from the temporary grayscale values, we will never overwrite
|
||||
* the remaining grayscale values since those are smaller. So we can avoid a
|
||||
* separate buffer for the temporary greyscale values. */
|
||||
* separate buffer for the temporary grayscale values. */
|
||||
assert(k_bitsPerPixel < 8*sizeof(KDColor));
|
||||
|
||||
uint8_t * greyscaleBuffer = glyphBuffer->greyscaleBuffer();
|
||||
uint8_t * grayscaleBuffer = glyphBuffer->grayscaleBuffer();
|
||||
KDColor * colorBuffer = glyphBuffer->colorBuffer();
|
||||
|
||||
uint8_t mask = (0xFF >> (8-k_bitsPerPixel));
|
||||
int pixelIndex = m_glyphSize.width() * m_glyphSize.height() - 1; // Let's start at the final pixel
|
||||
int greyscaleByteIndex = pixelIndex * k_bitsPerPixel / 8;
|
||||
int grayscaleByteIndex = pixelIndex * k_bitsPerPixel / 8;
|
||||
while (pixelIndex >= 0) {
|
||||
assert(greyscaleByteIndex == pixelIndex * k_bitsPerPixel / 8);
|
||||
uint8_t greyscaleByte = greyscaleBuffer[greyscaleByteIndex--]; // We consume a greyscale byte...
|
||||
assert(grayscaleByteIndex == pixelIndex * k_bitsPerPixel / 8);
|
||||
uint8_t grayscaleByte = grayscaleBuffer[grayscaleByteIndex--]; // We consume a grayscale byte...
|
||||
for (int j=0; j<8/k_bitsPerPixel; j++) { // .. and we'll output 8/k_bits pixels
|
||||
uint8_t greyscale = greyscaleByte & mask;
|
||||
greyscaleByte = greyscaleByte >> k_bitsPerPixel;
|
||||
uint8_t grayscale = grayscaleByte & mask;
|
||||
grayscaleByte = grayscaleByte >> k_bitsPerPixel;
|
||||
assert(pixelIndex >= 0);
|
||||
colorBuffer[pixelIndex--] = renderPalette->colorAtIndex(greyscale);
|
||||
colorBuffer[pixelIndex--] = renderPalette->colorAtIndex(grayscale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class EmptyLayoutNode /*final*/ : public LayoutNode {
|
||||
public:
|
||||
enum class Color {
|
||||
Yellow,
|
||||
Grey
|
||||
Gray
|
||||
};
|
||||
|
||||
// Layout
|
||||
|
||||
@@ -60,9 +60,9 @@ public:
|
||||
|
||||
// Layout modification
|
||||
void deleteBeforeCursor(LayoutCursor * cursor) { return node()->deleteBeforeCursor(cursor); }
|
||||
bool removeGreySquaresFromAllMatrixAncestors() { return node()->removeGreySquaresFromAllMatrixAncestors(); }
|
||||
bool removeGreySquaresFromAllMatrixChildren() { return node()->removeGreySquaresFromAllMatrixChildren(); }
|
||||
bool addGreySquaresToAllMatrixAncestors() { return node()->addGreySquaresToAllMatrixAncestors(); }
|
||||
bool removeGraySquaresFromAllMatrixAncestors() { return node()->removeGraySquaresFromAllMatrixAncestors(); }
|
||||
bool removeGraySquaresFromAllMatrixChildren() { return node()->removeGraySquaresFromAllMatrixChildren(); }
|
||||
bool addGraySquaresToAllMatrixAncestors() { return node()->addGraySquaresToAllMatrixAncestors(); }
|
||||
Layout layoutToPointWhenInserting(Expression * correspondingExpression) {
|
||||
// Pointer to correspondingExpr because expression.h includes layout.h
|
||||
assert(correspondingExpression != nullptr);
|
||||
|
||||
@@ -103,9 +103,9 @@ public:
|
||||
|
||||
// Other
|
||||
virtual LayoutNode * layoutToPointWhenInserting(Expression * correspondingExpression);
|
||||
bool removeGreySquaresFromAllMatrixAncestors();
|
||||
bool removeGreySquaresFromAllMatrixChildren();
|
||||
bool addGreySquaresToAllMatrixAncestors();
|
||||
bool removeGraySquaresFromAllMatrixAncestors();
|
||||
bool removeGraySquaresFromAllMatrixChildren();
|
||||
bool addGraySquaresToAllMatrixAncestors();
|
||||
/* A layout has text if it is not empty and it is not an horizontal layout
|
||||
* with no child or with one child with no text. */
|
||||
virtual bool hasText() const { return true; }
|
||||
@@ -173,7 +173,7 @@ private:
|
||||
int * resultScore,
|
||||
bool forSelection);
|
||||
virtual void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) = 0;
|
||||
void changeGreySquaresOfAllMatrixRelatives(bool add, bool ancestors, bool * changedSquares);
|
||||
void changeGraySquaresOfAllMatrixRelatives(bool add, bool ancestors, bool * changedSquares);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ public:
|
||||
Type type() const override { return Type::MatrixLayout; }
|
||||
|
||||
// MatrixLayoutNode
|
||||
void addGreySquares();
|
||||
void removeGreySquares();
|
||||
void addGraySquares();
|
||||
void removeGraySquares();
|
||||
|
||||
// LayoutNode
|
||||
void moveCursorLeft(LayoutCursor * cursor, bool * shouldRecomputeLayout, bool forSelection) override;
|
||||
@@ -50,7 +50,7 @@ private:
|
||||
void newRowOrColumnAtIndex(int index);
|
||||
bool isRowEmpty(int index) const;
|
||||
bool isColumnEmpty(int index) const;
|
||||
bool hasGreySquares() const;
|
||||
bool hasGraySquares() const;
|
||||
|
||||
// LayoutNode
|
||||
void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed) override;
|
||||
@@ -64,9 +64,9 @@ public:
|
||||
static MatrixLayout Builder() { return TreeHandle::NAryBuilder<MatrixLayout, MatrixLayoutNode>(); }
|
||||
static MatrixLayout Builder(Layout l1, Layout l2, Layout l3, Layout l4);
|
||||
|
||||
bool hasGreySquares() const { return node()->hasGreySquares(); }
|
||||
void addGreySquares() { node()->addGreySquares(); }
|
||||
void removeGreySquares() { node()->removeGreySquares(); }
|
||||
bool hasGraySquares() const { return node()->hasGraySquares(); }
|
||||
void addGraySquares() { node()->addGraySquares(); }
|
||||
void removeGraySquares() { node()->removeGraySquares(); }
|
||||
private:
|
||||
MatrixLayoutNode * node() const { return static_cast<MatrixLayoutNode *>(Layout::node()); }
|
||||
};
|
||||
|
||||
@@ -68,7 +68,7 @@ void EmptyLayoutNode::moveCursorVertically(VerticalDirection direction, LayoutCu
|
||||
bool EmptyLayoutNode::willAddSibling(LayoutCursor * cursor, LayoutNode * sibling, bool moveCursor) {
|
||||
EmptyLayout thisRef(this);
|
||||
Layout siblingRef(sibling); // Create the reference now, as the node might be moved
|
||||
if (m_color == Color::Grey) {
|
||||
if (m_color == Color::Gray) {
|
||||
/* The parent is a MatrixLayout, and the current empty row or column is
|
||||
* being filled in, so add a new empty row or column. */
|
||||
LayoutNode * parentNode = parent();
|
||||
@@ -88,7 +88,7 @@ bool EmptyLayoutNode::willAddSibling(LayoutCursor * cursor, LayoutNode * sibling
|
||||
|
||||
void EmptyLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
|
||||
if (m_isVisible) {
|
||||
KDColor fillColor = m_color == Color::Yellow ? Palette::YellowDark : Palette::GreyBright;
|
||||
KDColor fillColor = m_color == Color::Yellow ? Palette::YellowDark : Palette::GrayBright;
|
||||
ctx->fillRect(KDRect(p.x()+(m_margins ? k_marginWidth : 0), p.y()+(m_margins ? k_marginHeight : 0), width(), height()), fillColor);
|
||||
ctx->fillRect(KDRect(p.x()+(m_margins ? k_marginWidth : 0), p.y()+(m_margins ? k_marginHeight : 0), width(), height()), fillColor);
|
||||
}
|
||||
|
||||
@@ -150,9 +150,9 @@ void LayoutCursor::addEmptyExponentialLayout() {
|
||||
void LayoutCursor::addEmptyMatrixLayout() {
|
||||
MatrixLayout matrixLayout = MatrixLayout::Builder(
|
||||
EmptyLayout::Builder(EmptyLayoutNode::Color::Yellow),
|
||||
EmptyLayout::Builder(EmptyLayoutNode::Color::Grey),
|
||||
EmptyLayout::Builder(EmptyLayoutNode::Color::Grey),
|
||||
EmptyLayout::Builder(EmptyLayoutNode::Color::Grey));
|
||||
EmptyLayout::Builder(EmptyLayoutNode::Color::Gray),
|
||||
EmptyLayout::Builder(EmptyLayoutNode::Color::Gray),
|
||||
EmptyLayout::Builder(EmptyLayoutNode::Color::Gray));
|
||||
m_layout.addSibling(this, matrixLayout, false);
|
||||
m_layout = matrixLayout.childAtIndex(0);
|
||||
m_position = Position::Right;
|
||||
@@ -432,7 +432,7 @@ void LayoutCursor::selectUpDown(bool up, bool * shouldRecomputeLayout, Layout *
|
||||
* position). This ancestor will be the added selection.
|
||||
*
|
||||
* The current layout might have been detached from its parent, for instance
|
||||
* if it was a grey empty layout of a matrix and the cursor move exited this
|
||||
* if it was a gray empty layout of a matrix and the cursor move exited this
|
||||
* matrix. In this case, use the layout parent (it should still be attached to
|
||||
* the main layout). */
|
||||
|
||||
|
||||
@@ -118,21 +118,21 @@ LayoutNode * LayoutNode::layoutToPointWhenInserting(Expression * correspondingEx
|
||||
return numberOfChildren() > 0 ? childAtIndex(0) : this;
|
||||
}
|
||||
|
||||
bool LayoutNode::removeGreySquaresFromAllMatrixAncestors() {
|
||||
bool LayoutNode::removeGraySquaresFromAllMatrixAncestors() {
|
||||
bool result = false;
|
||||
changeGreySquaresOfAllMatrixRelatives(false, true, &result);
|
||||
changeGraySquaresOfAllMatrixRelatives(false, true, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool LayoutNode::removeGreySquaresFromAllMatrixChildren() {
|
||||
bool LayoutNode::removeGraySquaresFromAllMatrixChildren() {
|
||||
bool result = false;
|
||||
changeGreySquaresOfAllMatrixRelatives(false, false, &result);
|
||||
changeGraySquaresOfAllMatrixRelatives(false, false, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
bool LayoutNode::addGreySquaresToAllMatrixAncestors() {
|
||||
bool LayoutNode::addGraySquaresToAllMatrixAncestors() {
|
||||
bool result = false;
|
||||
changeGreySquaresOfAllMatrixRelatives(true, true, &result);
|
||||
changeGraySquaresOfAllMatrixRelatives(true, true, &result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ void LayoutNode::moveCursorInDescendantsVertically(VerticalDirection direction,
|
||||
// If there is a valid result
|
||||
Layout resultRef(childResult);
|
||||
if ((*childResultPtr) != nullptr) {
|
||||
*shouldRecomputeLayout = childResult->addGreySquaresToAllMatrixAncestors();
|
||||
*shouldRecomputeLayout = childResult->addGraySquaresToAllMatrixAncestors();
|
||||
// WARNING: Do not use "this" afterwards
|
||||
}
|
||||
cursor->setLayout(resultRef);
|
||||
@@ -260,36 +260,36 @@ void LayoutNode::scoreCursorInDescendantsVertically (
|
||||
}
|
||||
}
|
||||
|
||||
bool addRemoveGreySquaresInLayoutIfNeeded(bool add, Layout * l) {
|
||||
bool addRemoveGraySquaresInLayoutIfNeeded(bool add, Layout * l) {
|
||||
if (l->type() != LayoutNode::Type::MatrixLayout) {
|
||||
return false;
|
||||
}
|
||||
if (add) {
|
||||
static_cast<MatrixLayoutNode *>(l->node())->addGreySquares();
|
||||
static_cast<MatrixLayoutNode *>(l->node())->addGraySquares();
|
||||
} else {
|
||||
static_cast<MatrixLayoutNode *>(l->node())->removeGreySquares();
|
||||
static_cast<MatrixLayoutNode *>(l->node())->removeGraySquares();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void LayoutNode::changeGreySquaresOfAllMatrixRelatives(bool add, bool ancestors, bool * changedSquares) {
|
||||
void LayoutNode::changeGraySquaresOfAllMatrixRelatives(bool add, bool ancestors, bool * changedSquares) {
|
||||
if (!ancestors) {
|
||||
// If in children, we also change the squares for this
|
||||
{
|
||||
Layout thisLayout = Layout(this);
|
||||
if (addRemoveGreySquaresInLayoutIfNeeded(add, &thisLayout)) {
|
||||
if (addRemoveGraySquaresInLayoutIfNeeded(add, &thisLayout)) {
|
||||
*changedSquares = true;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < numberOfChildren(); i++) {
|
||||
/* We cannot use "for l : children()", as the node addresses might change,
|
||||
* especially the iterator stopping address. */
|
||||
childAtIndex(i)->changeGreySquaresOfAllMatrixRelatives(add, false, changedSquares);
|
||||
childAtIndex(i)->changeGraySquaresOfAllMatrixRelatives(add, false, changedSquares);
|
||||
}
|
||||
} else {
|
||||
Layout currentAncestor = Layout(parent());
|
||||
while (!currentAncestor.isUninitialized()) {
|
||||
if (addRemoveGreySquaresInLayoutIfNeeded(add, ¤tAncestor)) {
|
||||
if (addRemoveGraySquaresInLayoutIfNeeded(add, ¤tAncestor)) {
|
||||
*changedSquares = true;
|
||||
}
|
||||
currentAncestor = currentAncestor.parent();
|
||||
|
||||
@@ -10,16 +10,16 @@ namespace Poincare {
|
||||
|
||||
// MatrixLayoutNode
|
||||
|
||||
void MatrixLayoutNode::addGreySquares() {
|
||||
if (!hasGreySquares()) {
|
||||
void MatrixLayoutNode::addGraySquares() {
|
||||
if (!hasGraySquares()) {
|
||||
Layout thisRef(this);
|
||||
addEmptyRow(EmptyLayoutNode::Color::Grey);
|
||||
addEmptyColumn(EmptyLayoutNode::Color::Grey);
|
||||
addEmptyRow(EmptyLayoutNode::Color::Gray);
|
||||
addEmptyColumn(EmptyLayoutNode::Color::Gray);
|
||||
}
|
||||
}
|
||||
|
||||
void MatrixLayoutNode::removeGreySquares() {
|
||||
if (hasGreySquares()) {
|
||||
void MatrixLayoutNode::removeGraySquares() {
|
||||
if (hasGraySquares()) {
|
||||
deleteRowAtIndex(m_numberOfRows - 1);
|
||||
deleteColumnAtIndex(m_numberOfColumns - 1);
|
||||
}
|
||||
@@ -33,10 +33,10 @@ void MatrixLayoutNode::moveCursorLeft(LayoutCursor * cursor, bool * shouldRecomp
|
||||
&& cursor->position() == LayoutCursor::Position::Left
|
||||
&& childIsLeftOfGrid(childIndex))
|
||||
{
|
||||
/* Case: Left of a child on the left of the grid. Remove the grey squares of
|
||||
/* Case: Left of a child on the left of the grid. Remove the gray squares of
|
||||
* the grid, then go left of the grid. */
|
||||
assert(hasGreySquares());
|
||||
removeGreySquares();
|
||||
assert(hasGraySquares());
|
||||
removeGraySquares();
|
||||
*shouldRecomputeLayout = true;
|
||||
cursor->setLayoutNode(this);
|
||||
return;
|
||||
@@ -44,10 +44,10 @@ void MatrixLayoutNode::moveCursorLeft(LayoutCursor * cursor, bool * shouldRecomp
|
||||
if (cursor->layoutNode() == this
|
||||
&& cursor->position() == LayoutCursor::Position::Right)
|
||||
{
|
||||
/* Case: Right. Add the grey squares to the matrix, then move to the bottom
|
||||
* right non empty nor grey child. */
|
||||
assert(!hasGreySquares());
|
||||
addGreySquares();
|
||||
/* Case: Right. Add the gray squares to the matrix, then move to the bottom
|
||||
* right non empty nor gray child. */
|
||||
assert(!hasGraySquares());
|
||||
addGraySquares();
|
||||
*shouldRecomputeLayout = true;
|
||||
LayoutNode * lastChild = childAtIndex((m_numberOfColumns-1)*(m_numberOfRows-1));
|
||||
cursor->setLayoutNode(lastChild);
|
||||
@@ -60,9 +60,9 @@ void MatrixLayoutNode::moveCursorRight(LayoutCursor * cursor, bool * shouldRecom
|
||||
if (cursor->layoutNode() == this
|
||||
&& cursor->position() == LayoutCursor::Position::Left)
|
||||
{
|
||||
// Case: Left. Add grey squares to the matrix, then go to its first entry.
|
||||
assert(!hasGreySquares());
|
||||
addGreySquares();
|
||||
// Case: Left. Add gray squares to the matrix, then go to its first entry.
|
||||
assert(!hasGraySquares());
|
||||
addGraySquares();
|
||||
*shouldRecomputeLayout = true;
|
||||
assert(m_numberOfColumns*m_numberOfRows >= 1);
|
||||
cursor->setLayoutNode(childAtIndex(0));
|
||||
@@ -73,10 +73,10 @@ void MatrixLayoutNode::moveCursorRight(LayoutCursor * cursor, bool * shouldRecom
|
||||
&& cursor->position() == LayoutCursor::Position::Right
|
||||
&& childIsRightOfGrid(childIndex))
|
||||
{
|
||||
/* Case: Right of a child on the right of the grid. Remove the grey squares
|
||||
/* Case: Right of a child on the right of the grid. Remove the gray squares
|
||||
* of the grid, then go right of the grid. */
|
||||
assert(hasGreySquares());
|
||||
removeGreySquares();
|
||||
assert(hasGraySquares());
|
||||
removeGraySquares();
|
||||
*shouldRecomputeLayout = true;
|
||||
cursor->setLayoutNode(this);
|
||||
return;
|
||||
@@ -149,7 +149,7 @@ int MatrixLayoutNode::serialize(char * buffer, int bufferSize, Preferences::Prin
|
||||
}
|
||||
|
||||
// Serialize the vectors
|
||||
int maxColumnIndex = hasGreySquares() ? m_numberOfColumns - 2 : m_numberOfColumns - 1;
|
||||
int maxColumnIndex = hasGraySquares() ? m_numberOfColumns - 2 : m_numberOfColumns - 1;
|
||||
for (int i = minRowIndex; i <= maxRowIndex; i++) {
|
||||
numberOfChar += SerializationHelper::CodePoint(buffer + numberOfChar, bufferSize - numberOfChar, '[');
|
||||
if (numberOfChar >= bufferSize-1) { return bufferSize-1;}
|
||||
@@ -183,7 +183,7 @@ KDPoint MatrixLayoutNode::positionOfChild(LayoutNode * l) {
|
||||
|
||||
void MatrixLayoutNode::moveCursorVertically(VerticalDirection direction, LayoutCursor * cursor, bool * shouldRecomputeLayout, bool equivalentPositionVisited, bool forSelection) {
|
||||
MatrixLayout thisRef = MatrixLayout(this);
|
||||
bool shouldRemoveGreySquares = false;
|
||||
bool shouldRemoveGraySquares = false;
|
||||
int firstIndex = direction == VerticalDirection::Up ? 0 : numberOfChildren() - m_numberOfColumns;
|
||||
int lastIndex = direction == VerticalDirection::Up ? m_numberOfColumns : numberOfChildren();
|
||||
int i = firstIndex;
|
||||
@@ -192,16 +192,16 @@ void MatrixLayoutNode::moveCursorVertically(VerticalDirection direction, LayoutC
|
||||
break;
|
||||
}
|
||||
if (cursor->layout().node()->hasAncestor(l, true)) {
|
||||
// The cursor is leaving the matrix, so remove the grey squares.
|
||||
shouldRemoveGreySquares = true;
|
||||
// The cursor is leaving the matrix, so remove the gray squares.
|
||||
shouldRemoveGraySquares = true;
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
GridLayoutNode::moveCursorVertically(direction, cursor, shouldRecomputeLayout, equivalentPositionVisited, forSelection);
|
||||
if (cursor->isDefined() && shouldRemoveGreySquares) {
|
||||
assert(thisRef.hasGreySquares());
|
||||
thisRef.removeGreySquares();
|
||||
if (cursor->isDefined() && shouldRemoveGraySquares) {
|
||||
assert(thisRef.hasGraySquares());
|
||||
thisRef.removeGraySquares();
|
||||
*shouldRecomputeLayout = true;
|
||||
}
|
||||
}
|
||||
@@ -214,7 +214,7 @@ void MatrixLayoutNode::newRowOrColumnAtIndex(int index) {
|
||||
int correspondingRow = rowAtChildIndex(index);
|
||||
if (childIsRightOfGrid(index)) {
|
||||
assert(m_numberOfRows >= 2);
|
||||
// Color the grey EmptyLayouts of the column in yellow.
|
||||
// Color the gray EmptyLayouts of the column in yellow.
|
||||
int correspondingColumn = m_numberOfColumns - 1;
|
||||
int childIndex = correspondingColumn;
|
||||
int maxIndex = (m_numberOfRows - 2)*m_numberOfColumns+correspondingColumn;
|
||||
@@ -234,12 +234,12 @@ void MatrixLayoutNode::newRowOrColumnAtIndex(int index) {
|
||||
}
|
||||
childIndex++;
|
||||
}
|
||||
// Add a column of grey EmptyLayouts on the right.
|
||||
addEmptyColumn(EmptyLayoutNode::Color::Grey);
|
||||
// Add a column of gray EmptyLayouts on the right.
|
||||
addEmptyColumn(EmptyLayoutNode::Color::Gray);
|
||||
}
|
||||
if (shouldAddNewRow) {
|
||||
assert(m_numberOfColumns >= 2);
|
||||
// Color the grey EmptyLayouts of the row in yellow.
|
||||
// Color the gray EmptyLayouts of the row in yellow.
|
||||
int childIndex = correspondingRow * m_numberOfColumns;
|
||||
int maxIndex = correspondingRow * m_numberOfColumns + m_numberOfColumns - 2;
|
||||
for (LayoutNode * lastLayoutOfColumn : childrenFromIndex(correspondingRow*m_numberOfColumns)) {
|
||||
@@ -256,8 +256,8 @@ void MatrixLayoutNode::newRowOrColumnAtIndex(int index) {
|
||||
}
|
||||
childIndex++;
|
||||
}
|
||||
// Add a row of grey EmptyLayouts at the bottom.
|
||||
addEmptyRow(EmptyLayoutNode::Color::Grey);
|
||||
// Add a row of gray EmptyLayouts at the bottom.
|
||||
addEmptyRow(EmptyLayoutNode::Color::Gray);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,14 +291,14 @@ bool MatrixLayoutNode::isColumnEmpty(int index) const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MatrixLayoutNode::hasGreySquares() const {
|
||||
bool MatrixLayoutNode::hasGraySquares() const {
|
||||
if (numberOfChildren() == 0) {
|
||||
return false;
|
||||
}
|
||||
LayoutNode * lastChild = const_cast<MatrixLayoutNode *>(this)->childAtIndex(m_numberOfRows * m_numberOfColumns - 1);
|
||||
if (lastChild->isEmpty()
|
||||
&& lastChild->type() != Type::HorizontalLayout
|
||||
&& (static_cast<EmptyLayoutNode *>(lastChild))->color() == EmptyLayoutNode::Color::Grey)
|
||||
&& (static_cast<EmptyLayoutNode *>(lastChild))->color() == EmptyLayoutNode::Color::Gray)
|
||||
{
|
||||
assert(isRowEmpty(m_numberOfRows - 1));
|
||||
assert(isColumnEmpty(m_numberOfColumns - 1));
|
||||
|
||||
@@ -201,10 +201,10 @@ KDColor MicroPython::Color::Parse(mp_obj_t input, Mode mode){
|
||||
NamedColor("pink", Palette::Pink),
|
||||
NamedColor("orange", Palette::Orange),
|
||||
NamedColor("purple", Palette::Purple),
|
||||
NamedColor("grey", Palette::GreyDark),
|
||||
NamedColor("gray", Palette::GrayDark),
|
||||
NamedColor("cyan", Palette::Cyan),
|
||||
NamedColor("magenta", Palette::Magenta)
|
||||
};
|
||||
};
|
||||
for (NamedColor p : pairs) {
|
||||
if (strcmp(p.name(), color) == 0) {
|
||||
return p.color();
|
||||
@@ -220,12 +220,12 @@ KDColor MicroPython::Color::Parse(mp_obj_t input, Mode mode){
|
||||
return KDColor::RGB24(colorInt);
|
||||
}
|
||||
|
||||
mp_float_t greyLevel = mp_obj_float_get(mp_parse_num_decimal(color, strlen(color), false, false, NULL));
|
||||
if (greyLevel >= 0.0 && greyLevel <= 1.0) {
|
||||
uint8_t color = maxColorIntensity * (float) greyLevel;
|
||||
mp_float_t grayLevel = mp_obj_float_get(mp_parse_num_decimal(color, strlen(color), false, false, NULL));
|
||||
if (grayLevel >= 0.0 && grayLevel <= 1.0) {
|
||||
uint8_t color = maxColorIntensity * (float) grayLevel;
|
||||
return KDColor::RGB888(color, color, color);
|
||||
}
|
||||
mp_raise_ValueError("Grey levels are between 0.0 and 1.0");
|
||||
mp_raise_ValueError("Gray levels are between 0.0 and 1.0");
|
||||
} else if(mp_obj_is_int(input)) {
|
||||
mp_raise_TypeError("Int are not colors");
|
||||
//See https://github.com/numworks/epsilon/issues/1533#issuecomment-618443492
|
||||
|
||||
Reference in New Issue
Block a user