mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Compare commits
2 Commits
upsilon-de
...
upsilon-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2abc1d116a | ||
|
|
63d1e0ee4e |
@@ -66,8 +66,8 @@ private:
|
|||||||
bool updateAlphaLock();
|
bool updateAlphaLock();
|
||||||
|
|
||||||
static I18n::Message k_promptMessages[];
|
static I18n::Message k_promptMessages[];
|
||||||
static KDColor k_promptFGColors[];
|
static KDColor const * k_promptFGColors[];
|
||||||
static KDColor k_promptBGColors[];
|
static KDColor const * k_promptBGColors[];
|
||||||
static int k_promptNumberOfMessages;
|
static int k_promptNumberOfMessages;
|
||||||
AppsWindow m_window;
|
AppsWindow m_window;
|
||||||
EmptyBatteryWindow m_emptyBatteryWindow;
|
EmptyBatteryWindow m_emptyBatteryWindow;
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ I18n::Message AppsContainer::k_promptMessages[] = {
|
|||||||
I18n::Message::BetaVersionMessage6};
|
I18n::Message::BetaVersionMessage6};
|
||||||
|
|
||||||
KDColor AppsContainer::k_promptFGColors[] = {
|
KDColor AppsContainer::k_promptFGColors[] = {
|
||||||
KDColorBlack,
|
&KDColorBlack,
|
||||||
KDColorBlack,
|
&KDColorBlack,
|
||||||
KDColorBlack,
|
&KDColorBlack,
|
||||||
KDColorBlack,
|
&KDColorBlack,
|
||||||
KDColorWhite,
|
&KDColorWhite,
|
||||||
KDColorBlack,
|
&KDColorBlack,
|
||||||
KDColorBlack,
|
&KDColorBlack,
|
||||||
Palette::AccentText};
|
*Palette::AccentText};
|
||||||
|
|
||||||
KDColor AppsContainer::k_promptBGColors[] = {
|
KDColor AppsContainer::k_promptBGColors[] = {
|
||||||
KDColorWhite,
|
KDColorWhite,
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
I18n::Message AppsContainer::k_promptMessages[] = {};
|
I18n::Message AppsContainer::k_promptMessages[] = {};
|
||||||
|
|
||||||
KDColor AppsContainer::k_promptFGColors[] = {};
|
KDColor const * AppsContainer::k_promptFGColors[] = {};
|
||||||
KDColor AppsContainer::k_promptBGColors[] = {};
|
KDColor const * AppsContainer::k_promptBGColors[] = {};
|
||||||
|
|
||||||
int AppsContainer::k_promptNumberOfMessages = 0;
|
int AppsContainer::k_promptNumberOfMessages = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,15 @@ I18n::Message AppsContainer::k_promptMessages[] = {
|
|||||||
I18n::Message::UpdateMessage3,
|
I18n::Message::UpdateMessage3,
|
||||||
I18n::Message::UpdateMessage4};
|
I18n::Message::UpdateMessage4};
|
||||||
|
|
||||||
KDColor AppsContainer::k_promptFGColors[] = {
|
KDColor const * AppsContainer::k_promptFGColors[] = {
|
||||||
KDColorBlack,
|
&KDColorBlack,
|
||||||
KDColorBlack,
|
&KDColorBlack,
|
||||||
KDColorBlack,
|
&KDColorBlack,
|
||||||
KDColorWhite,
|
&KDColorWhite,
|
||||||
KDColorBlack,
|
&KDColorBlack,
|
||||||
Palette::AccentText};
|
*Palette::AccentText};
|
||||||
|
|
||||||
KDColor AppsContainer::k_promptBGColors[] = {
|
KDColor const * AppsContainer::k_promptBGColors[] = {
|
||||||
KDColorWhite,
|
KDColorWhite,
|
||||||
KDColorWhite,
|
KDColorWhite,
|
||||||
KDColorWhite,
|
KDColorWhite,
|
||||||
|
|||||||
Submodule apps/atomic updated: 69f7a06ba5...ffafaaf311
@@ -60,43 +60,43 @@ void BatteryView::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
*'content' depends on the charge */
|
*'content' depends on the charge */
|
||||||
|
|
||||||
// Draw the left part
|
// Draw the left part
|
||||||
ctx->fillRect(KDRect(0, 0, k_elementWidth, k_batteryHeight), Palette::Battery);
|
ctx->fillRect(KDRect(0, 0, k_elementWidth, k_batteryHeight), *Palette::Battery);
|
||||||
|
|
||||||
// Draw the middle part
|
// Draw the middle part
|
||||||
constexpr KDCoordinate batteryInsideX = k_elementWidth+k_separatorThickness;
|
constexpr KDCoordinate batteryInsideX = k_elementWidth+k_separatorThickness;
|
||||||
constexpr KDCoordinate batteryInsideWidth = k_batteryWidth-3*k_elementWidth-2*k_separatorThickness;
|
constexpr KDCoordinate batteryInsideWidth = k_batteryWidth-3*k_elementWidth-2*k_separatorThickness;
|
||||||
if (m_isCharging) {
|
if (m_isCharging) {
|
||||||
// Charging: Yellow background with flash
|
// Charging: Yellow background with flash
|
||||||
ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), Palette::BatteryInCharge);
|
ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), *Palette::BatteryInCharge);
|
||||||
KDRect frame((k_batteryWidth-k_flashWidth)/2, 0, k_flashWidth, k_flashHeight);
|
KDRect frame((k_batteryWidth-k_flashWidth)/2, 0, k_flashWidth, k_flashHeight);
|
||||||
KDColor flashWorkingBuffer[BatteryView::k_flashHeight*BatteryView::k_flashWidth];
|
KDColor flashWorkingBuffer[BatteryView::k_flashHeight*BatteryView::k_flashWidth];
|
||||||
ctx->blendRectWithMask(frame, Palette::Battery, (const uint8_t *)flashMask, flashWorkingBuffer);
|
ctx->blendRectWithMask(frame, *Palette::Battery, (const uint8_t *)flashMask, flashWorkingBuffer);
|
||||||
} else if (m_chargeState == Ion::Battery::Charge::LOW) {
|
} else if (m_chargeState == Ion::Battery::Charge::LOW) {
|
||||||
assert(!m_isPlugged);
|
assert(!m_isPlugged);
|
||||||
// Low: Quite empty battery
|
// Low: Quite empty battery
|
||||||
ctx->fillRect(KDRect(batteryInsideX, 0, 2*k_elementWidth, k_batteryHeight), Palette::BatteryLow);
|
ctx->fillRect(KDRect(batteryInsideX, 0, 2*k_elementWidth, k_batteryHeight), *Palette::BatteryLow);
|
||||||
ctx->fillRect(KDRect(3*k_elementWidth+k_separatorThickness, 0, k_batteryWidth-5*k_elementWidth-2*k_separatorThickness, k_batteryHeight), KDColor::blend(Palette::Toolbar, Palette::Battery, 128));
|
ctx->fillRect(KDRect(3*k_elementWidth+k_separatorThickness, 0, k_batteryWidth-5*k_elementWidth-2*k_separatorThickness, k_batteryHeight), KDColor::blend(*Palette::Toolbar, *Palette::Battery, 128));
|
||||||
} else if (m_chargeState == Ion::Battery::Charge::SOMEWHERE_INBETWEEN) {
|
} else if (m_chargeState == Ion::Battery::Charge::SOMEWHERE_INBETWEEN) {
|
||||||
assert(!m_isPlugged);
|
assert(!m_isPlugged);
|
||||||
// Middle: Half full battery
|
// Middle: Half full battery
|
||||||
constexpr KDCoordinate middleChargeWidth = batteryInsideWidth/2;
|
constexpr KDCoordinate middleChargeWidth = batteryInsideWidth/2;
|
||||||
ctx->fillRect(KDRect(batteryInsideX, 0, middleChargeWidth, k_batteryHeight), Palette::Battery);
|
ctx->fillRect(KDRect(batteryInsideX, 0, middleChargeWidth, k_batteryHeight), *Palette::Battery);
|
||||||
ctx->fillRect(KDRect(batteryInsideX+middleChargeWidth, 0, middleChargeWidth, k_batteryHeight), KDColor::blend(Palette::Toolbar, Palette::Battery, 128));
|
ctx->fillRect(KDRect(batteryInsideX+middleChargeWidth, 0, middleChargeWidth, k_batteryHeight), KDColor::blend(*Palette::Toolbar, *Palette::Battery, 128));
|
||||||
} else {
|
} else {
|
||||||
assert(m_chargeState == Ion::Battery::Charge::FULL);
|
assert(m_chargeState == Ion::Battery::Charge::FULL);
|
||||||
// Full but not plugged: Full battery
|
// Full but not plugged: Full battery
|
||||||
ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), Palette::Battery);
|
ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), *Palette::Battery);
|
||||||
if (m_isPlugged) {
|
if (m_isPlugged) {
|
||||||
// Plugged and full: Full battery with tick
|
// Plugged and full: Full battery with tick
|
||||||
KDRect frame((k_batteryWidth-k_tickWidth)/2, (k_batteryHeight-k_tickHeight)/2, k_tickWidth, k_tickHeight);
|
KDRect frame((k_batteryWidth-k_tickWidth)/2, (k_batteryHeight-k_tickHeight)/2, k_tickWidth, k_tickHeight);
|
||||||
KDColor tickWorkingBuffer[BatteryView::k_tickHeight*BatteryView::k_tickWidth];
|
KDColor tickWorkingBuffer[BatteryView::k_tickHeight*BatteryView::k_tickWidth];
|
||||||
ctx->blendRectWithMask(frame, Palette::Toolbar, (const uint8_t *)tickMask, tickWorkingBuffer);
|
ctx->blendRectWithMask(frame, *Palette::Toolbar, (const uint8_t *)tickMask, tickWorkingBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the right part
|
// Draw the right part
|
||||||
ctx->fillRect(KDRect(k_batteryWidth-2*k_elementWidth, 0, k_elementWidth, k_batteryHeight), Palette::Battery);
|
ctx->fillRect(KDRect(k_batteryWidth-2*k_elementWidth, 0, k_elementWidth, k_batteryHeight), *Palette::Battery);
|
||||||
ctx->fillRect(KDRect(k_batteryWidth-k_elementWidth, (k_batteryHeight-k_capHeight)/2, k_elementWidth, k_capHeight), Palette::Battery);
|
ctx->fillRect(KDRect(k_batteryWidth-k_elementWidth, (k_batteryHeight-k_capHeight)/2, k_elementWidth, k_capHeight), *Palette::Battery);
|
||||||
}
|
}
|
||||||
|
|
||||||
KDSize BatteryView::minimalSizeForOptimalDisplay() const {
|
KDSize BatteryView::minimalSizeForOptimalDisplay() const {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ ComplexGraphView::ComplexGraphView(ComplexModel * complexModel) :
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(rect, Palette::BackgroundApps);
|
ctx->fillRect(rect, *Palette::BackgroundApps);
|
||||||
|
|
||||||
// Draw grid, axes and graduations
|
// Draw grid, axes and graduations
|
||||||
drawGrid(ctx, rect);
|
drawGrid(ctx, rect);
|
||||||
@@ -26,7 +26,7 @@ void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
|
|
||||||
assert(!std::isnan(real) && !std::isnan(imag) && !std::isinf(real) && !std::isinf(imag));
|
assert(!std::isnan(real) && !std::isnan(imag) && !std::isinf(real) && !std::isinf(imag));
|
||||||
// Draw the segment from the origin to the dot (real, imag)
|
// Draw the segment from the origin to the dot (real, imag)
|
||||||
drawSegment(ctx, rect, 0.0f, 0.0f, m_complex->real(), m_complex->imag(), Palette::SecondaryText, false);
|
drawSegment(ctx, rect, 0.0f, 0.0f, m_complex->real(), m_complex->imag(), *Palette::SecondaryText, false);
|
||||||
|
|
||||||
/* Draw the partial ellipse indicating the angle θ
|
/* Draw the partial ellipse indicating the angle θ
|
||||||
* - the ellipse parameters are a = |real|/5 and b = |imag|/5,
|
* - the ellipse parameters are a = |real|/5 and b = |imag|/5,
|
||||||
@@ -59,27 +59,27 @@ void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
float a = parameters.real();
|
float a = parameters.real();
|
||||||
float b = parameters.imag();
|
float b = parameters.imag();
|
||||||
return Poincare::Coordinate2D<float>(a*std::cos(t*th), b*std::sin(t*th));
|
return Poincare::Coordinate2D<float>(a*std::cos(t*th), b*std::sin(t*th));
|
||||||
}, ¶meters, &th, false, Palette::SecondaryText, false);
|
}, ¶meters, &th, false, *Palette::SecondaryText, false);
|
||||||
|
|
||||||
// Draw dashed segment to indicate real and imaginary
|
// Draw dashed segment to indicate real and imaginary
|
||||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, real, 0.0f, imag, Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, real, 0.0f, imag, *Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, imag, 0.0f, real, Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, imag, 0.0f, real, *Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||||
|
|
||||||
// Draw complex position on the plan
|
// Draw complex position on the plan
|
||||||
drawDot(ctx, rect, real, imag, Palette::CalculationTrigoAndComplexForeground, Size::Large);
|
drawDot(ctx, rect, real, imag, *Palette::CalculationTrigoAndComplexForeground, Size::Large);
|
||||||
|
|
||||||
// Draw labels
|
// Draw labels
|
||||||
// 're(z)' label
|
// 're(z)' label
|
||||||
drawLabel(ctx, rect, real, 0.0f, "re(z)", Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, imag >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After);
|
drawLabel(ctx, rect, real, 0.0f, "re(z)", *Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, imag >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After);
|
||||||
// 'im(z)' label
|
// 'im(z)' label
|
||||||
drawLabel(ctx, rect, 0.0f, imag, "im(z)", Palette::CalculationTrigoAndComplexForeground, real >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None);
|
drawLabel(ctx, rect, 0.0f, imag, "im(z)", *Palette::CalculationTrigoAndComplexForeground, real >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None);
|
||||||
// '|z|' label, the relative horizontal position of this label depends on the quadrant
|
// '|z|' label, the relative horizontal position of this label depends on the quadrant
|
||||||
CurveView::RelativePosition verticalPosition = real*imag < 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After;
|
CurveView::RelativePosition verticalPosition = real*imag < 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After;
|
||||||
if (real == 0.0f) {
|
if (real == 0.0f) {
|
||||||
// Edge case: pure imaginary
|
// Edge case: pure imaginary
|
||||||
verticalPosition = CurveView::RelativePosition::None;
|
verticalPosition = CurveView::RelativePosition::None;
|
||||||
}
|
}
|
||||||
drawLabel(ctx, rect, real/2.0f, imag/2.0f, "|z|", Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, verticalPosition);
|
drawLabel(ctx, rect, real/2.0f, imag/2.0f, "|z|", *Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, verticalPosition);
|
||||||
// 'arg(z)' label, the absolute and relative horizontal/vertical positions of this label depends on the quadrant
|
// 'arg(z)' label, the absolute and relative horizontal/vertical positions of this label depends on the quadrant
|
||||||
CurveView::RelativePosition horizontalPosition = real >= 0.0f ? CurveView::RelativePosition::After : CurveView::RelativePosition::None;
|
CurveView::RelativePosition horizontalPosition = real >= 0.0f ? CurveView::RelativePosition::After : CurveView::RelativePosition::None;
|
||||||
verticalPosition = imag >= 0.0f ? CurveView::RelativePosition::After : CurveView::RelativePosition::Before;
|
verticalPosition = imag >= 0.0f ? CurveView::RelativePosition::After : CurveView::RelativePosition::Before;
|
||||||
@@ -88,7 +88,7 @@ void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
* and for the left half plan, we position the label at the half angle. The
|
* and for the left half plan, we position the label at the half angle. The
|
||||||
* relative position is chosen accordingly. */
|
* relative position is chosen accordingly. */
|
||||||
float anglePositionRatio = real >= 0.0f ? 0.0f : 0.5f;
|
float anglePositionRatio = real >= 0.0f ? 0.0f : 0.5f;
|
||||||
drawLabel(ctx, rect, a*std::cos(anglePositionRatio*th), b*std::sin(anglePositionRatio*th), "arg(z)", Palette::CalculationTrigoAndComplexForeground, horizontalPosition, verticalPosition);
|
drawLabel(ctx, rect, a*std::cos(anglePositionRatio*th), b*std::sin(anglePositionRatio*th), "arg(z)", *Palette::CalculationTrigoAndComplexForeground, horizontalPosition, verticalPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ void ExpressionWithEqualSignView::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
// Do not color the whole background to avoid coloring behind the equal symbol
|
// Do not color the whole background to avoid coloring behind the equal symbol
|
||||||
KDSize expressionSize = ExpressionView::minimalSizeForOptimalDisplay();
|
KDSize expressionSize = ExpressionView::minimalSizeForOptimalDisplay();
|
||||||
ctx->fillRect(KDRect(0, 0, expressionSize), m_backgroundColor);
|
ctx->fillRect(KDRect(0, 0, expressionSize), m_backgroundColor);
|
||||||
m_layout.draw(ctx, drawingOrigin(), m_textColor, m_backgroundColor, m_selectionStart, m_selectionEnd, Palette::Select);
|
m_layout.draw(ctx, drawingOrigin(), m_textColor, m_backgroundColor, m_selectionStart, m_selectionEnd, *Palette::Select);
|
||||||
}
|
}
|
||||||
|
|
||||||
View * ExpressionWithEqualSignView::subviewAtIndex(int index) {
|
View * ExpressionWithEqualSignView::subviewAtIndex(int index) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace Calculation {
|
|||||||
class ExpressionWithEqualSignView : public ExpressionView {
|
class ExpressionWithEqualSignView : public ExpressionView {
|
||||||
public:
|
public:
|
||||||
ExpressionWithEqualSignView() :
|
ExpressionWithEqualSignView() :
|
||||||
m_equalSign(KDFont::LargeFont, I18n::Message::Equal, 0.5f, 0.5f, Palette::PrimaryText)
|
m_equalSign(KDFont::LargeFont, I18n::Message::Equal, 0.5f, 0.5f, *Palette::PrimaryText)
|
||||||
{}
|
{}
|
||||||
KDSize minimalSizeForOptimalDisplay() const override;
|
KDSize minimalSizeForOptimalDisplay() const override;
|
||||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ void IllustrationCell::layoutSubviews(bool force) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IllustrationCell::drawRect(KDContext * ctx, KDRect rect) const {
|
void IllustrationCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
drawBorderOfRect(ctx, bounds(), Palette::ListCellBorder);
|
drawBorderOfRect(ctx, bounds(), *Palette::ListCellBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ void ListController::InnerListController::didBecomeFirstResponder() {
|
|||||||
/* List Controller */
|
/* List Controller */
|
||||||
|
|
||||||
ListController::ListController(EditExpressionController * editExpressionController, SelectableTableViewDelegate * delegate) :
|
ListController::ListController(EditExpressionController * editExpressionController, SelectableTableViewDelegate * delegate) :
|
||||||
StackViewController(nullptr, &m_listController, Palette::ToolboxHeaderText, Palette::ToolboxHeaderBackground, Palette::ToolboxHeaderBorder),
|
StackViewController(nullptr, &m_listController, *Palette::ToolboxHeaderText, *Palette::ToolboxHeaderBackground, *Palette::ToolboxHeaderBorder),
|
||||||
m_listController(this, delegate),
|
m_listController(this, delegate),
|
||||||
m_editExpressionController(editExpressionController)
|
m_editExpressionController(editExpressionController)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
static constexpr KDCoordinate k_margin = Metric::CommonSmallMargin;
|
static constexpr KDCoordinate k_margin = Metric::CommonSmallMargin;
|
||||||
ScrollableThreeExpressionsView(Responder * parentResponder) : Shared::AbstractScrollableMultipleExpressionsView(parentResponder, &m_contentCell), m_contentCell() {
|
ScrollableThreeExpressionsView(Responder * parentResponder) : Shared::AbstractScrollableMultipleExpressionsView(parentResponder, &m_contentCell), m_contentCell() {
|
||||||
setMargins(k_margin, k_margin, k_margin, k_margin); // Left Right margins are already added by TableCell
|
setMargins(k_margin, k_margin, k_margin, k_margin); // Left Right margins are already added by TableCell
|
||||||
setBackgroundColor(Palette::BackgroundApps);
|
setBackgroundColor(*Palette::BackgroundApps);
|
||||||
}
|
}
|
||||||
void resetMemoization();
|
void resetMemoization();
|
||||||
void setCalculation(Calculation * calculation, bool canChangeDisplayOutput);
|
void setCalculation(Calculation * calculation, bool canChangeDisplayOutput);
|
||||||
@@ -28,7 +28,7 @@ private:
|
|||||||
class ContentCell : public Shared::AbstractScrollableMultipleExpressionsView::ContentCell {
|
class ContentCell : public Shared::AbstractScrollableMultipleExpressionsView::ContentCell {
|
||||||
public:
|
public:
|
||||||
ContentCell() : m_leftExpressionView() {}
|
ContentCell() : m_leftExpressionView() {}
|
||||||
KDColor backgroundColor() const override { return Palette::BackgroundApps; }
|
KDColor backgroundColor() const override { return *Palette::BackgroundApps; }
|
||||||
void setEven(bool even) override { return; }
|
void setEven(bool even) override { return; }
|
||||||
ExpressionView * leftExpressionView() const override { return const_cast<ExpressionWithEqualSignView *>(&m_leftExpressionView); }
|
ExpressionView * leftExpressionView() const override { return const_cast<ExpressionWithEqualSignView *>(&m_leftExpressionView); }
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -15,24 +15,24 @@ TrigonometryGraphView::TrigonometryGraphView(TrigonometryModel * model) :
|
|||||||
void TrigonometryGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
void TrigonometryGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
float s = std::sin(m_model->angle());
|
float s = std::sin(m_model->angle());
|
||||||
float c = std::cos(m_model->angle());
|
float c = std::cos(m_model->angle());
|
||||||
ctx->fillRect(rect, Palette::BackgroundApps);
|
ctx->fillRect(rect, *Palette::BackgroundApps);
|
||||||
drawGrid(ctx, rect);
|
drawGrid(ctx, rect);
|
||||||
drawAxes(ctx, rect);
|
drawAxes(ctx, rect);
|
||||||
// Draw the circle
|
// Draw the circle
|
||||||
drawCurve(ctx, rect, 0.0f, 2.0f*M_PI, M_PI/180.0f, [](float t, void * model, void * context) {
|
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));
|
return Poincare::Coordinate2D<float>(std::cos(t), std::sin(t));
|
||||||
}, nullptr, nullptr, true, Palette::SecondaryText, false);
|
}, nullptr, nullptr, true, *Palette::SecondaryText, false);
|
||||||
// Draw dashed segment to indicate sine and cosine
|
// Draw dashed segment to indicate sine and cosine
|
||||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, c, 0.0f, s, Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, c, 0.0f, s, *Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, s, 0.0f, c, Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, s, 0.0f, c, *Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||||
// Draw angle position on the circle
|
// Draw angle position on the circle
|
||||||
drawDot(ctx, rect, c, s, Palette::CalculationTrigoAndComplexForeground, Size::Large);
|
drawDot(ctx, rect, c, s, *Palette::CalculationTrigoAndComplexForeground, Size::Large);
|
||||||
// Draw graduations
|
// Draw graduations
|
||||||
drawLabelsAndGraduations(ctx, rect, Axis::Vertical, false, true);
|
drawLabelsAndGraduations(ctx, rect, Axis::Vertical, false, true);
|
||||||
drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, true);
|
drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, true);
|
||||||
// Draw labels
|
// Draw labels
|
||||||
drawLabel(ctx, rect, 0.0f, s, "sin(θ)", Palette::CalculationTrigoAndComplexForeground, c >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None);
|
drawLabel(ctx, rect, 0.0f, s, "sin(θ)", *Palette::CalculationTrigoAndComplexForeground, c >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None);
|
||||||
drawLabel(ctx, rect, c, 0.0f, "cos(θ)", Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, s >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After);
|
drawLabel(ctx, rect, c, 0.0f, "cos(θ)", *Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, s >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ void HistoryViewCell::reloadSubviewHighlight() {
|
|||||||
m_ellipsis.setHighlighted(false);
|
m_ellipsis.setHighlighted(false);
|
||||||
if (isHighlighted()) {
|
if (isHighlighted()) {
|
||||||
if (m_dataSource->selectedSubviewType() == HistoryViewCellDataSource::SubviewType::Input) {
|
if (m_dataSource->selectedSubviewType() == HistoryViewCellDataSource::SubviewType::Input) {
|
||||||
m_inputView.setExpressionBackgroundColor(Palette::Select);
|
m_inputView.setExpressionBackgroundColor(*Palette::Select);
|
||||||
} else if (m_dataSource->selectedSubviewType() == HistoryViewCellDataSource::SubviewType::Output) {
|
} else if (m_dataSource->selectedSubviewType() == HistoryViewCellDataSource::SubviewType::Output) {
|
||||||
m_scrollableOutputView.evenOddCell()->setHighlighted(true);
|
m_scrollableOutputView.evenOddCell()->setHighlighted(true);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ public:
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
Poincare::Layout layout() const override;
|
Poincare::Layout layout() const override;
|
||||||
KDColor backgroundColor() const override { return m_even ? Palette::CalculationBackgroundEven : Palette::CalculationBackgroundOdd; }
|
KDColor backgroundColor() const override { return m_even ? *Palette::CalculationBackgroundEven : *Palette::CalculationBackgroundOdd; }
|
||||||
void resetMemoization();
|
void resetMemoization();
|
||||||
void setCalculation(Calculation * calculation, bool expanded, bool canChangeDisplayOutput = false);
|
void setCalculation(Calculation * calculation, bool expanded, bool canChangeDisplayOutput = false);
|
||||||
int numberOfSubviews() const override { return 2 + displayedEllipsis(); }
|
int numberOfSubviews() const override { return 2 + displayedEllipsis(); }
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ ConsoleController::ConsoleController(Responder * parentResponder, App * pythonDe
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
m_selectableTableView.setMargins(0, Metric::CommonRightMargin, 0, Metric::TitleBarExternHorizontalMargin);
|
m_selectableTableView.setMargins(0, Metric::CommonRightMargin, 0, Metric::TitleBarExternHorizontalMargin);
|
||||||
m_selectableTableView.setBackgroundColor(Palette::CodeBackground);
|
m_selectableTableView.setBackgroundColor(*Palette::CodeBackground);
|
||||||
m_editCell.setPrompt(sStandardPromptText);
|
m_editCell.setPrompt(sStandardPromptText);
|
||||||
for (int i = 0; i < k_numberOfLineCells; i++) {
|
for (int i = 0; i < k_numberOfLineCells; i++) {
|
||||||
m_cells[i].setParentResponder(&m_selectableTableView);
|
m_cells[i].setParentResponder(&m_selectableTableView);
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ void ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::setLine(Consol
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::drawRect(KDContext * ctx, KDRect rect) const {
|
void ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(bounds(), Palette::CodeBackground);
|
ctx->fillRect(bounds(), *Palette::CodeBackground);
|
||||||
ctx->drawString(m_line->text(), KDPointZero, GlobalPreferences::sharedGlobalPreferences()->font(), textColor(m_line), isHighlighted()? Palette::Select : Palette::BackgroundApps);
|
ctx->drawString(m_line->text(), KDPointZero, GlobalPreferences::sharedGlobalPreferences()->font(), textColor(m_line), isHighlighted()? *Palette::Select : *Palette::BackgroundApps);
|
||||||
}
|
}
|
||||||
|
|
||||||
KDSize ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::minimalSizeForOptimalDisplay() const {
|
KDSize ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::minimalSizeForOptimalDisplay() const {
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ private:
|
|||||||
ConsoleLineView m_consoleLineView;
|
ConsoleLineView m_consoleLineView;
|
||||||
};
|
};
|
||||||
static KDColor textColor(ConsoleLine * line) {
|
static KDColor textColor(ConsoleLine * line) {
|
||||||
return line->isFromCurrentSession() ? Palette::CodeText : Palette::SecondaryText;
|
return line->isFromCurrentSession() ? *Palette::CodeText : *Palette::SecondaryText;
|
||||||
}
|
}
|
||||||
MessageTextView m_promptView;
|
MessageTextView m_promptView;
|
||||||
ScrollableConsoleLineView m_scrollableView;
|
ScrollableConsoleLineView m_scrollableView;
|
||||||
|
|||||||
@@ -57,8 +57,8 @@ void EditorView::layoutSubviews(bool force) {
|
|||||||
/* EditorView::GutterView */
|
/* EditorView::GutterView */
|
||||||
|
|
||||||
void EditorView::GutterView::drawRect(KDContext * ctx, KDRect rect) const {
|
void EditorView::GutterView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
KDColor textColor = Palette::PrimaryText;
|
KDColor textColor = *Palette::PrimaryText;
|
||||||
KDColor backgroundColor = Palette::CodeGutterViewBackground;
|
KDColor backgroundColor = *Palette::CodeGutterViewBackground;
|
||||||
|
|
||||||
ctx->fillRect(rect, backgroundColor);
|
ctx->fillRect(rect, backgroundColor);
|
||||||
|
|
||||||
|
|||||||
@@ -14,22 +14,12 @@ extern "C" {
|
|||||||
|
|
||||||
namespace Code {
|
namespace Code {
|
||||||
|
|
||||||
constexpr KDColor CommentColor = Palette::CodeComment;
|
|
||||||
constexpr KDColor NumberColor = Palette::CodeNumber;
|
|
||||||
constexpr KDColor KeywordColor = Palette::CodeKeyword;
|
|
||||||
// constexpr KDColor BuiltinColor = KDColor::RGB24(0x0086B3);
|
|
||||||
constexpr KDColor OperatorColor = Palette::CodeOperator;
|
|
||||||
constexpr KDColor StringColor = Palette::CodeString;
|
|
||||||
constexpr KDColor BackgroundColor = Palette::CodeBackground;
|
|
||||||
constexpr KDColor HighlightColor = Palette::CodeBackgroundSelected;
|
|
||||||
constexpr KDColor AutocompleteColor = KDColor::RGB24(0xC6C6C6); // TODO Palette change
|
|
||||||
|
|
||||||
static inline KDColor TokenColor(mp_token_kind_t tokenKind) {
|
static inline KDColor TokenColor(mp_token_kind_t tokenKind) {
|
||||||
if (tokenKind == MP_TOKEN_STRING) {
|
if (tokenKind == MP_TOKEN_STRING) {
|
||||||
return StringColor;
|
return *Palette::CodeString;
|
||||||
}
|
}
|
||||||
if (tokenKind == MP_TOKEN_INTEGER || tokenKind == MP_TOKEN_FLOAT_OR_IMAG) {
|
if (tokenKind == MP_TOKEN_INTEGER || tokenKind == MP_TOKEN_FLOAT_OR_IMAG) {
|
||||||
return NumberColor;
|
return *Palette::CodeNumber;
|
||||||
}
|
}
|
||||||
static_assert(MP_TOKEN_ELLIPSIS + 1 == MP_TOKEN_KW_FALSE
|
static_assert(MP_TOKEN_ELLIPSIS + 1 == MP_TOKEN_KW_FALSE
|
||||||
&& MP_TOKEN_KW_FALSE + 1 == MP_TOKEN_KW_NONE
|
&& MP_TOKEN_KW_FALSE + 1 == MP_TOKEN_KW_NONE
|
||||||
@@ -69,7 +59,7 @@ static inline KDColor TokenColor(mp_token_kind_t tokenKind) {
|
|||||||
&& MP_TOKEN_KW_YIELD + 1 == MP_TOKEN_OP_TILDE,
|
&& MP_TOKEN_KW_YIELD + 1 == MP_TOKEN_OP_TILDE,
|
||||||
"MP_TOKEN order changed, so Code::PythonTextArea::TokenColor might need to change too.");
|
"MP_TOKEN order changed, so Code::PythonTextArea::TokenColor might need to change too.");
|
||||||
if (tokenKind >= MP_TOKEN_KW_FALSE && tokenKind <= MP_TOKEN_KW_YIELD) {
|
if (tokenKind >= MP_TOKEN_KW_FALSE && tokenKind <= MP_TOKEN_KW_YIELD) {
|
||||||
return KeywordColor;
|
return *Palette::CodeKeyword;
|
||||||
}
|
}
|
||||||
static_assert(MP_TOKEN_OP_TILDE + 1 == MP_TOKEN_OP_LESS
|
static_assert(MP_TOKEN_OP_TILDE + 1 == MP_TOKEN_OP_LESS
|
||||||
&& MP_TOKEN_OP_LESS + 1 == MP_TOKEN_OP_MORE
|
&& MP_TOKEN_OP_LESS + 1 == MP_TOKEN_OP_MORE
|
||||||
@@ -121,9 +111,9 @@ static inline KDColor TokenColor(mp_token_kind_t tokenKind) {
|
|||||||
|| tokenKind == MP_TOKEN_DEL_EQUAL
|
|| tokenKind == MP_TOKEN_DEL_EQUAL
|
||||||
|| tokenKind == MP_TOKEN_DEL_MINUS_MORE)
|
|| tokenKind == MP_TOKEN_DEL_MINUS_MORE)
|
||||||
{
|
{
|
||||||
return OperatorColor;
|
return *Palette::CodeOperator;
|
||||||
}
|
}
|
||||||
return Palette::CodeText;
|
return *Palette::CodeText;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline size_t TokenLength(mp_lexer_t * lex, const char * tokenPosition) {
|
static inline size_t TokenLength(mp_lexer_t * lex, const char * tokenPosition) {
|
||||||
@@ -216,7 +206,7 @@ void PythonTextArea::ContentView::unloadSyntaxHighlighter() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PythonTextArea::ContentView::clearRect(KDContext * ctx, KDRect rect) const {
|
void PythonTextArea::ContentView::clearRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(rect, BackgroundColor);
|
ctx->fillRect(rect, *Palette::CodeBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define LOG_DRAWING 0
|
#define LOG_DRAWING 0
|
||||||
@@ -246,11 +236,11 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
|||||||
fromColumn,
|
fromColumn,
|
||||||
spacesStart,
|
spacesStart,
|
||||||
std::min(text + byteLength, firstNonSpace) - spacesStart,
|
std::min(text + byteLength, firstNonSpace) - spacesStart,
|
||||||
StringColor,
|
*Palette::CodeString,
|
||||||
BackgroundColor,
|
*Palette::CodeBackground,
|
||||||
selectionStart,
|
selectionStart,
|
||||||
selectionEnd,
|
selectionEnd,
|
||||||
HighlightColor);
|
*Palette::CodeBackgroundSelected);
|
||||||
}
|
}
|
||||||
if (UTF8Helper::CodePointIs(firstNonSpace, UCodePointNull)) {
|
if (UTF8Helper::CodePointIs(firstNonSpace, UCodePointNull)) {
|
||||||
return;
|
return;
|
||||||
@@ -276,17 +266,17 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
|||||||
UTF8Helper::GlyphOffsetAtCodePoint(text, tokenEnd),
|
UTF8Helper::GlyphOffsetAtCodePoint(text, tokenEnd),
|
||||||
tokenEnd,
|
tokenEnd,
|
||||||
std::min(text + byteLength, tokenFrom) - tokenEnd,
|
std::min(text + byteLength, tokenFrom) - tokenEnd,
|
||||||
StringColor,
|
*Palette::CodeString,
|
||||||
BackgroundColor,
|
*Palette::CodeBackground,
|
||||||
selectionStart,
|
selectionStart,
|
||||||
selectionEnd,
|
selectionEnd,
|
||||||
HighlightColor);
|
*Palette::CodeBackgroundSelected);
|
||||||
}
|
}
|
||||||
tokenLength = TokenLength(lex, tokenFrom);
|
tokenLength = TokenLength(lex, tokenFrom);
|
||||||
tokenEnd = tokenFrom + tokenLength;
|
tokenEnd = tokenFrom + tokenLength;
|
||||||
|
|
||||||
// If the token is being autocompleted, use DefaultColor
|
// If the token is being autocompleted, use DefaultColor
|
||||||
KDColor color = (tokenFrom <= autocompleteStart && autocompleteStart < tokenEnd) ? Palette::CodeText : TokenColor(lex->tok_kind);
|
KDColor color = (tokenFrom <= autocompleteStart && autocompleteStart < tokenEnd) ? *Palette::CodeText : TokenColor(lex->tok_kind);
|
||||||
|
|
||||||
LOG_DRAW("Draw \"%.*s\" for token %d\n", tokenLength, tokenFrom, lex->tok_kind);
|
LOG_DRAW("Draw \"%.*s\" for token %d\n", tokenLength, tokenFrom, lex->tok_kind);
|
||||||
drawStringAt(ctx, line,
|
drawStringAt(ctx, line,
|
||||||
@@ -294,10 +284,10 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
|||||||
tokenFrom,
|
tokenFrom,
|
||||||
tokenLength,
|
tokenLength,
|
||||||
color,
|
color,
|
||||||
BackgroundColor,
|
*Palette::CodeBackground,
|
||||||
selectionStart,
|
selectionStart,
|
||||||
selectionEnd,
|
selectionEnd,
|
||||||
HighlightColor);
|
*Palette::CodeBackgroundSelected);
|
||||||
|
|
||||||
mp_lexer_to_next(lex);
|
mp_lexer_to_next(lex);
|
||||||
LOG_DRAW("Pop token %d\n", lex->tok_kind);
|
LOG_DRAW("Pop token %d\n", lex->tok_kind);
|
||||||
@@ -305,18 +295,18 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
|||||||
|
|
||||||
tokenFrom += tokenLength;
|
tokenFrom += tokenLength;
|
||||||
|
|
||||||
// Even if the token is being autocompleted, use CommentColor
|
// Even if the token is being autocompleted, use *Palette::CodeComment
|
||||||
if (tokenFrom < text + byteLength) {
|
if (tokenFrom < text + byteLength) {
|
||||||
LOG_DRAW("Draw comment \"%.*s\" from %d\n", byteLength - (tokenFrom - text), firstNonSpace, tokenFrom);
|
LOG_DRAW("Draw comment \"%.*s\" from %d\n", byteLength - (tokenFrom - text), firstNonSpace, tokenFrom);
|
||||||
drawStringAt(ctx, line,
|
drawStringAt(ctx, line,
|
||||||
UTF8Helper::GlyphOffsetAtCodePoint(text, tokenFrom),
|
UTF8Helper::GlyphOffsetAtCodePoint(text, tokenFrom),
|
||||||
tokenFrom,
|
tokenFrom,
|
||||||
text + byteLength - tokenFrom,
|
text + byteLength - tokenFrom,
|
||||||
CommentColor,
|
*Palette::CodeComment,
|
||||||
BackgroundColor,
|
*Palette::CodeBackground,
|
||||||
selectionStart,
|
selectionStart,
|
||||||
selectionEnd,
|
selectionEnd,
|
||||||
HighlightColor);
|
*Palette::CodeBackgroundSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
mp_lexer_free(lex);
|
mp_lexer_free(lex);
|
||||||
@@ -332,11 +322,11 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
|||||||
UTF8Helper::GlyphOffsetAtCodePoint(text, autocompleteStart),
|
UTF8Helper::GlyphOffsetAtCodePoint(text, autocompleteStart),
|
||||||
autocompleteStart,
|
autocompleteStart,
|
||||||
std::min(text + byteLength, m_autocompletionEnd) - autocompleteStart,
|
std::min(text + byteLength, m_autocompletionEnd) - autocompleteStart,
|
||||||
AutocompleteColor,
|
KDColor::RGB24(0xC6C6C6),
|
||||||
BackgroundColor,
|
*Palette::CodeBackground,
|
||||||
nullptr,
|
nullptr,
|
||||||
nullptr,
|
nullptr,
|
||||||
HighlightColor);
|
*Palette::CodeBackgroundSelected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ namespace Code {
|
|||||||
|
|
||||||
SandboxController::SandboxController(Responder * parentResponder) :
|
SandboxController::SandboxController(Responder * parentResponder) :
|
||||||
ViewController(parentResponder),
|
ViewController(parentResponder),
|
||||||
m_solidColorView(Palette::CodeBackground)
|
m_solidColorView(*Palette::CodeBackground)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ constexpr char ScriptNodeCell::k_parentheses[];
|
|||||||
constexpr char ScriptNodeCell::k_parenthesesWithEmpty[];
|
constexpr char ScriptNodeCell::k_parenthesesWithEmpty[];
|
||||||
|
|
||||||
void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) const {
|
void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
const KDColor backgroundColor = isHighlighted()? Palette::CodeBackgroundSelected : Palette::CodeBackground;
|
const KDColor backgroundColor = isHighlighted()? *Palette::CodeBackgroundSelected : *Palette::CodeBackground;
|
||||||
|
|
||||||
// If it exists, draw the description name.
|
// If it exists, draw the description name.
|
||||||
const char * descriptionName = m_scriptNode->description();
|
const char * descriptionName = m_scriptNode->description();
|
||||||
if (descriptionName != nullptr) {
|
if (descriptionName != nullptr) {
|
||||||
ctx->drawString(descriptionName, KDPoint(0, m_frame.height() - k_bottomMargin - k_font->glyphSize().height()), k_font, Palette::GrayDark, backgroundColor);
|
ctx->drawString(descriptionName, KDPoint(0, m_frame.height() - k_bottomMargin - k_font->glyphSize().height()), k_font, *Palette::GrayDark, backgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the node name
|
// Draw the node name
|
||||||
@@ -21,10 +21,10 @@ void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) cons
|
|||||||
const int nodeNameLength = m_scriptNode->nameLength();
|
const int nodeNameLength = m_scriptNode->nameLength();
|
||||||
KDSize nameSize = k_font->stringSize(nodeName, nodeNameLength);
|
KDSize nameSize = k_font->stringSize(nodeName, nodeNameLength);
|
||||||
const KDCoordinate nodeNameY = k_topMargin;
|
const KDCoordinate nodeNameY = k_topMargin;
|
||||||
ctx->drawString(nodeName, KDPoint(0, nodeNameY), k_font, Palette::PrimaryText, backgroundColor, nodeNameLength);
|
ctx->drawString(nodeName, KDPoint(0, nodeNameY), k_font, *Palette::PrimaryText, backgroundColor, nodeNameLength);
|
||||||
// If it is needed, draw the parentheses
|
// If it is needed, draw the parentheses
|
||||||
if (m_scriptNode->type() == ScriptNode::Type::WithParentheses) {
|
if (m_scriptNode->type() == ScriptNode::Type::WithParentheses) {
|
||||||
ctx->drawString(ScriptNodeCell::k_parentheses, KDPoint(nameSize.width(), nodeNameY), k_font, Palette::PrimaryText, backgroundColor);
|
ctx->drawString(ScriptNodeCell::k_parentheses, KDPoint(nameSize.width(), nodeNameY), k_font, *Palette::PrimaryText, backgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If it exists, draw the source name. If it did not fit, we would have put
|
/* If it exists, draw the source name. If it did not fit, we would have put
|
||||||
@@ -32,7 +32,7 @@ void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) cons
|
|||||||
const char * sourceName = m_scriptNode->nodeSourceName();
|
const char * sourceName = m_scriptNode->nodeSourceName();
|
||||||
if (sourceName != nullptr) {
|
if (sourceName != nullptr) {
|
||||||
KDSize sourceNameSize = k_font->stringSize(sourceName);
|
KDSize sourceNameSize = k_font->stringSize(sourceName);
|
||||||
ctx->drawString(sourceName, KDPoint(m_frame.width() - sourceNameSize.width(), nodeNameY), k_font, Palette::CodeText, backgroundColor);
|
ctx->drawString(sourceName, KDPoint(m_frame.width() - sourceNameSize.width(), nodeNameY), k_font, *Palette::CodeText, backgroundColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ void ScriptParameterController::willDisplayCellForIndex(HighlightCell * cell, in
|
|||||||
MessageTableCellWithBuffer * myCell = (MessageTableCellWithBuffer *)cell;
|
MessageTableCellWithBuffer * myCell = (MessageTableCellWithBuffer *)cell;
|
||||||
GetScriptSize(myCell);
|
GetScriptSize(myCell);
|
||||||
myCell->setAccessoryFont(KDFont::SmallFont);
|
myCell->setAccessoryFont(KDFont::SmallFont);
|
||||||
myCell->setAccessoryTextColor(Palette::SecondaryText);
|
myCell->setAccessoryTextColor(*Palette::SecondaryText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ namespace Code {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void toolboxIonKeys::toolboxIonView::drawRect(KDContext * ctx, KDRect rect) const {
|
void toolboxIonKeys::toolboxIonView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(rect, Palette::WallScreen);
|
ctx->fillRect(rect, *Palette::WallScreen);
|
||||||
ctx->strokeRect(rect, Palette::ListCellBorder);
|
ctx->strokeRect(rect, *Palette::ListCellBorder);
|
||||||
ctx->drawString(I18n::translate(I18n::Message::PressAKey),KDPoint(rect.left()+80, rect.top()+20),KDFont::LargeFont,Palette::PrimaryText,Palette::WallScreen);
|
ctx->drawString(I18n::translate(I18n::Message::PressAKey),KDPoint(rect.left()+80, rect.top()+20),KDFont::LargeFont,*Palette::PrimaryText,*Palette::WallScreen);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ VariableBoxController::VariableBoxController(ScriptStore * scriptStore) :
|
|||||||
m_importedNodesCount(0)
|
m_importedNodesCount(0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < k_scriptOriginsCount; i++) {
|
for (int i = 0; i < k_scriptOriginsCount; i++) {
|
||||||
m_subtitleCells[i].setBackgroundColor(Palette::WallScreen);
|
m_subtitleCells[i].setBackgroundColor(*Palette::WallScreen);
|
||||||
m_subtitleCells[i].setTextColor(Palette::SecondaryText);
|
m_subtitleCells[i].setTextColor(*Palette::SecondaryText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
16
apps/external/main_controller.cpp
vendored
16
apps/external/main_controller.cpp
vendored
@@ -90,40 +90,40 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
|||||||
#if defined(DEVICE_N0100) && !defined(EXTERNAL_BUILTIN)
|
#if defined(DEVICE_N0100) && !defined(EXTERNAL_BUILTIN)
|
||||||
if(index == 0){
|
if(index == 0){
|
||||||
myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible));
|
myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible));
|
||||||
myTextCell->setTextColor(Palette::Red);
|
myTextCell->setTextColor(*Palette::Red);
|
||||||
} else {
|
} else {
|
||||||
myTextCell->setText(I18n::translate(I18n::Message::WithN0100));
|
myTextCell->setText(I18n::translate(I18n::Message::WithN0100));
|
||||||
myTextCell->setTextColor(Palette::Red);
|
myTextCell->setTextColor(*Palette::Red);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if(index == k_numberOfCells-1){
|
if(index == k_numberOfCells-1){
|
||||||
myTextCell->setText(I18n::translate(I18n::Message::URL));
|
myTextCell->setText(I18n::translate(I18n::Message::URL));
|
||||||
myTextCell->setTextColor(Palette::AccentText);
|
myTextCell->setTextColor(*Palette::AccentText);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(index == k_numberOfCells-2){
|
if(index == k_numberOfCells-2){
|
||||||
myTextCell->setText(I18n::translate(I18n::Message::GetMoreAppsAt));
|
myTextCell->setText(I18n::translate(I18n::Message::GetMoreAppsAt));
|
||||||
myTextCell->setTextColor(Palette::AccentText);
|
myTextCell->setTextColor(*Palette::AccentText);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(index == 0 && numberOfFiles() == 0){
|
if(index == 0 && numberOfFiles() == 0){
|
||||||
myTextCell->setText(I18n::translate(I18n::Message::NoAppsInstalled));
|
myTextCell->setText(I18n::translate(I18n::Message::NoAppsInstalled));
|
||||||
myTextCell->setTextColor(Palette::Red);
|
myTextCell->setTextColor(*Palette::Red);
|
||||||
}
|
}
|
||||||
if(numberOfFiles() > 0){
|
if(numberOfFiles() > 0){
|
||||||
if(fileAtIndex(index, f)) {
|
if(fileAtIndex(index, f)) {
|
||||||
myTextCell->setText(f.name);
|
myTextCell->setText(f.name);
|
||||||
myTextCell->setTextColor(f.isExecutable ? Palette::PrimaryText : Palette::Palette::SecondaryText);
|
myTextCell->setTextColor(f.isExecutable ? *Palette::PrimaryText : *Palette::Palette::SecondaryText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
if(index == 0){
|
if(index == 0){
|
||||||
myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible));
|
myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible));
|
||||||
myTextCell->setTextColor(Palette::Red);
|
myTextCell->setTextColor(*Palette::Red);
|
||||||
} else {
|
} else {
|
||||||
myTextCell->setText(I18n::translate(I18n::Message::WithSimulator));
|
myTextCell->setText(I18n::translate(I18n::Message::WithSimulator));
|
||||||
myTextCell->setTextColor(Palette::Red);
|
myTextCell->setTextColor(*Palette::Red);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
2
apps/external/pointer_text_table_cell.cpp
vendored
2
apps/external/pointer_text_table_cell.cpp
vendored
@@ -19,7 +19,7 @@ const char * PointerTextTableCell::text() const {
|
|||||||
|
|
||||||
void PointerTextTableCell::setHighlighted(bool highlight) {
|
void PointerTextTableCell::setHighlighted(bool highlight) {
|
||||||
HighlightCell::setHighlighted(highlight);
|
HighlightCell::setHighlighted(highlight);
|
||||||
KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||||
m_pointerTextView.setBackgroundColor(backgroundColor);
|
m_pointerTextView.setBackgroundColor(backgroundColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
// To represent the tangent, we draw segment from and to abscissas at the extremity of the drawn rect
|
// 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 minAbscissa = pixelToFloat(Axis::Horizontal, rect.left());
|
||||||
float maxAbscissa = pixelToFloat(Axis::Horizontal, rect.right());
|
float maxAbscissa = pixelToFloat(Axis::Horizontal, rect.right());
|
||||||
drawSegment(ctx, rect, minAbscissa, tangentParameterA*minAbscissa+tangentParameterB, maxAbscissa, tangentParameterA*maxAbscissa+tangentParameterB, Palette::GraphTangent, false);
|
drawSegment(ctx, rect, minAbscissa, tangentParameterA*minAbscissa+tangentParameterB, maxAbscissa, tangentParameterA*maxAbscissa+tangentParameterB, *Palette::GraphTangent, false);
|
||||||
}
|
}
|
||||||
} else if (type == Shared::ContinuousFunction::PlotType::Polar) {
|
} else if (type == Shared::ContinuousFunction::PlotType::Polar) {
|
||||||
// Polar
|
// Polar
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) {
|
|||||||
// Set name and color if the name is not being edited
|
// Set name and color if the name is not being edited
|
||||||
ExpiringPointer<ContinuousFunction> function = modelStore()->modelForRecord(modelStore()->recordAtIndex(j));
|
ExpiringPointer<ContinuousFunction> function = modelStore()->modelForRecord(modelStore()->recordAtIndex(j));
|
||||||
setFunctionNameInTextField(function, titleCell->textField());
|
setFunctionNameInTextField(function, titleCell->textField());
|
||||||
KDColor functionNameColor = function->isActive() ? function->color() : Palette::SecondaryText;
|
KDColor functionNameColor = function->isActive() ? function->color() : *Palette::SecondaryText;
|
||||||
titleCell->setColor(functionNameColor);
|
titleCell->setColor(functionNameColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -178,7 +178,7 @@ void ListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int
|
|||||||
Shared::FunctionListController::willDisplayExpressionCellAtIndex(cell, j);
|
Shared::FunctionListController::willDisplayExpressionCellAtIndex(cell, j);
|
||||||
FunctionExpressionCell * myCell = (FunctionExpressionCell *)cell;
|
FunctionExpressionCell * myCell = (FunctionExpressionCell *)cell;
|
||||||
ExpiringPointer<ContinuousFunction> f = modelStore()->modelForRecord(modelStore()->recordAtIndex(j));
|
ExpiringPointer<ContinuousFunction> f = modelStore()->modelForRecord(modelStore()->recordAtIndex(j));
|
||||||
KDColor textColor = f->isActive() ? Palette::PrimaryText : Palette::SecondaryText;
|
KDColor textColor = f->isActive() ? *Palette::PrimaryText : *Palette::SecondaryText;
|
||||||
myCell->setTextColor(textColor);
|
myCell->setTextColor(textColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ public:
|
|||||||
const KDFont * size = KDFont::LargeFont,
|
const KDFont * size = KDFont::LargeFont,
|
||||||
float horizontalAlignment = 0.0f,
|
float horizontalAlignment = 0.0f,
|
||||||
float verticalAlignment = 0.5f,
|
float verticalAlignment = 0.5f,
|
||||||
KDColor textColor = Palette::PrimaryText,
|
KDColor textColor = *Palette::PrimaryText,
|
||||||
KDColor backgroundColor = Palette::BackgroundHard) :
|
KDColor backgroundColor = *Palette::BackgroundHard) :
|
||||||
TextFieldWithExtension(extensionLength, parentResponder, textBuffer, textBufferSize, draftTextBufferSize, inputEventHandlerDelegate, delegate, size, horizontalAlignment, verticalAlignment, textColor, backgroundColor) {}
|
TextFieldWithExtension(extensionLength, parentResponder, textBuffer, textBufferSize, draftTextBufferSize, inputEventHandlerDelegate, delegate, size, horizontalAlignment, verticalAlignment, textColor, backgroundColor) {}
|
||||||
void setDraftTextBufferSize(size_t size) { m_contentView.setDraftTextBufferSize(size); }
|
void setDraftTextBufferSize(size_t size) { m_contentView.setDraftTextBufferSize(size); }
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const uint8_t arrowDownMask[10][9] = {
|
|||||||
|
|
||||||
ArrowView::ArrowView() :
|
ArrowView::ArrowView() :
|
||||||
m_directionIsUp(true),
|
m_directionIsUp(true),
|
||||||
m_color(Palette::PrimaryText)
|
m_color(*Palette::PrimaryText)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ void ArrowView::setColor(KDColor color) {
|
|||||||
|
|
||||||
void ArrowView::drawRect(KDContext * ctx, KDRect rect) const {
|
void ArrowView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
KDColor arrowWorkingBuffer[10*9];
|
KDColor arrowWorkingBuffer[10*9];
|
||||||
ctx->fillRect(bounds(), Palette::BackgroundHard);
|
ctx->fillRect(bounds(), *Palette::BackgroundHard);
|
||||||
KDCoordinate startLine = m_directionIsUp ? k_arrowHeight : 0;
|
KDCoordinate startLine = m_directionIsUp ? k_arrowHeight : 0;
|
||||||
KDCoordinate startArrow = m_directionIsUp ? 0 : bounds().height()-k_arrowHeight;
|
KDCoordinate startArrow = m_directionIsUp ? 0 : bounds().height()-k_arrowHeight;
|
||||||
ctx->fillRect(KDRect((Ion::Display::Width-k_arrowThickness)/2, startLine, k_arrowThickness, bounds().height()-k_arrowHeight), m_color);
|
ctx->fillRect(KDRect((Ion::Display::Width-k_arrowThickness)/2, startLine, k_arrowThickness, bounds().height()-k_arrowHeight), m_color);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ void KeyboardView::drawKey(int keyIndex, KDContext * ctx, KDRect rect) const {
|
|||||||
|
|
||||||
KDColor KeyboardView::keyColor(Ion::Keyboard::Key key) const {
|
KDColor KeyboardView::keyColor(Ion::Keyboard::Key key) const {
|
||||||
if (!m_keyboardModel.belongsToTestedKeysSubset(key)) {
|
if (!m_keyboardModel.belongsToTestedKeysSubset(key)) {
|
||||||
return Palette::ListCellBorder;
|
return *Palette::ListCellBorder;
|
||||||
}
|
}
|
||||||
if (m_keyboardModel.testedKey() == key) {
|
if (m_keyboardModel.testedKey() == key) {
|
||||||
return KDColorBlue;
|
return KDColorBlue;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace Home {
|
|||||||
|
|
||||||
AppCell::AppCell() :
|
AppCell::AppCell() :
|
||||||
HighlightCell(),
|
HighlightCell(),
|
||||||
m_nameView(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::HomeCellText, Palette::HomeCellBackground),
|
m_nameView(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, *Palette::HomeCellText, *Palette::HomeCellBackground),
|
||||||
m_backgroundView(nullptr),
|
m_backgroundView(nullptr),
|
||||||
m_visible(true), m_external_app(false)
|
m_visible(true), m_external_app(false)
|
||||||
{
|
{
|
||||||
@@ -39,7 +39,7 @@ void AppCell::setExtAppDescriptor(const char* name, const uint8_t *icon, size_t
|
|||||||
m_iconView.setImage(icon, iconLength);
|
m_iconView.setImage(icon, iconLength);
|
||||||
m_iconView.setImage(nullptr);
|
m_iconView.setImage(nullptr);
|
||||||
m_nameView.setText(name);
|
m_nameView.setText(name);
|
||||||
m_nameView.setTextColor(Palette::HomeCellTextExternal);
|
m_nameView.setTextColor(*Palette::HomeCellTextExternal);
|
||||||
m_nameView.setMessage(I18n::Message::Default);
|
m_nameView.setMessage(I18n::Message::Default);
|
||||||
layoutSubviews();
|
layoutSubviews();
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ void AppCell::setExtAppDescriptor(const char* name, const Image* icon) {
|
|||||||
m_iconView.setImage(icon);
|
m_iconView.setImage(icon);
|
||||||
m_iconView.setImage(nullptr, 0);
|
m_iconView.setImage(nullptr, 0);
|
||||||
m_nameView.setText(name);
|
m_nameView.setText(name);
|
||||||
m_nameView.setTextColor(Palette::HomeCellTextExternal);
|
m_nameView.setTextColor(*Palette::HomeCellTextExternal);
|
||||||
m_nameView.setMessage(I18n::Message::Default);
|
m_nameView.setMessage(I18n::Message::Default);
|
||||||
layoutSubviews();
|
layoutSubviews();
|
||||||
}
|
}
|
||||||
@@ -59,7 +59,7 @@ void AppCell::setAppDescriptor(::App::Descriptor * descriptor) {
|
|||||||
m_iconView.setImage(descriptor->icon());
|
m_iconView.setImage(descriptor->icon());
|
||||||
m_iconView.setImage(nullptr, 0);
|
m_iconView.setImage(nullptr, 0);
|
||||||
m_nameView.setMessage(descriptor->name());
|
m_nameView.setMessage(descriptor->name());
|
||||||
m_nameView.setTextColor(Palette::HomeCellText);
|
m_nameView.setTextColor(*Palette::HomeCellText);
|
||||||
m_nameView.setText(nullptr);
|
m_nameView.setText(nullptr);
|
||||||
layoutSubviews();
|
layoutSubviews();
|
||||||
}
|
}
|
||||||
@@ -76,8 +76,8 @@ void AppCell::setBackgroundView(const BackgroundView * backgroundView) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void AppCell::reloadCell() {
|
void AppCell::reloadCell() {
|
||||||
m_nameView.setTextColor(isHighlighted() ? (m_external_app ? Palette::HomeCellTextExternalActive : Palette::HomeCellTextActive) : (m_external_app ? Palette::HomeCellTextExternal : Palette::HomeCellText));
|
m_nameView.setTextColor(isHighlighted() ? (m_external_app ? *Palette::HomeCellTextExternalActive : *Palette::HomeCellTextActive) : (m_external_app ? *Palette::HomeCellTextExternal : *Palette::HomeCellText));
|
||||||
m_nameView.setBackgroundColor(isHighlighted() ? Palette::HomeCellBackgroundActive : Palette::HomeCellBackground);
|
m_nameView.setBackgroundColor(isHighlighted() ? *Palette::HomeCellBackgroundActive : *Palette::HomeCellBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ Controller::Controller(Responder * parentResponder, SelectableTableViewDataSourc
|
|||||||
m_cells[i].setBackgroundView(m_view.backgroundView());
|
m_cells[i].setBackgroundView(m_view.backgroundView());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_view.backgroundView()->setDefaultColor(Palette::HomeBackground);
|
m_view.backgroundView()->setDefaultColor(*Palette::HomeBackground);
|
||||||
|
|
||||||
|
|
||||||
#ifdef HOME_DISPLAY_EXTERNALS
|
#ifdef HOME_DISPLAY_EXTERNALS
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const uint8_t lockMask[LockView::k_lockHeight][LockView::k_lockWidth] = {
|
|||||||
void LockView::drawRect(KDContext * ctx, KDRect rect) const {
|
void LockView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
KDRect frame((bounds().width() - k_lockWidth)/2, (bounds().height()-k_lockHeight)/2, k_lockWidth, k_lockHeight);
|
KDRect frame((bounds().width() - k_lockWidth)/2, (bounds().height()-k_lockHeight)/2, k_lockWidth, k_lockHeight);
|
||||||
KDColor lockWorkingBuffer[LockView::k_lockHeight*LockView::k_lockWidth];
|
KDColor lockWorkingBuffer[LockView::k_lockHeight*LockView::k_lockWidth];
|
||||||
ctx->blendRectWithMask(frame, Palette::ToolbarText, (const uint8_t *)lockMask, lockWorkingBuffer);
|
ctx->blendRectWithMask(frame, *Palette::ToolbarText, (const uint8_t *)lockMask, lockWorkingBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
KDSize LockView::minimalSizeForOptimalDisplay() const {
|
KDSize LockView::minimalSizeForOptimalDisplay() const {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
MathVariableBoxEmptyController::MathVariableBoxEmptyView::MathVariableBoxEmptyView() :
|
MathVariableBoxEmptyController::MathVariableBoxEmptyView::MathVariableBoxEmptyView() :
|
||||||
ModalViewEmptyView(),
|
ModalViewEmptyView(),
|
||||||
m_layoutExample(0.5f, 0.5f, Palette::PrimaryText, Palette::WallScreen)
|
m_layoutExample(0.5f, 0.5f, *Palette::PrimaryText, *Palette::WallScreen)
|
||||||
{
|
{
|
||||||
initMessageViews();
|
initMessageViews();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ LogoView::LogoView() :
|
|||||||
}
|
}
|
||||||
|
|
||||||
void LogoView::drawRect(KDContext * ctx, KDRect rect) const {
|
void LogoView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(bounds(), Palette::BackgroundHard);
|
ctx->fillRect(bounds(), *Palette::BackgroundHard);
|
||||||
}
|
}
|
||||||
|
|
||||||
int LogoView::numberOfSubviews() const {
|
int LogoView::numberOfSubviews() const {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
namespace OnBoarding {
|
namespace OnBoarding {
|
||||||
|
|
||||||
PromptController::MessageViewWithSkip::MessageViewWithSkip(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages) :
|
PromptController::MessageViewWithSkip::MessageViewWithSkip(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages) :
|
||||||
MessageView(messages, fgcolors, bgcolors, numberOfMessages),
|
MessageView(messages, fgcolors, bgcolors, numberOfMessages),
|
||||||
m_skipView(KDFont::SmallFont, I18n::Message::Skip, 1.0f, 0.5f),
|
m_skipView(KDFont::SmallFont, I18n::Message::Skip, 1.0f, 0.5f),
|
||||||
m_okView()
|
m_okView()
|
||||||
@@ -42,7 +42,7 @@ void PromptController::MessageViewWithSkip::layoutSubviews(bool force) {
|
|||||||
m_okView.setFrame(KDRect(width - okSize.width()-k_okMargin, height-okSize.height()-k_okMargin, okSize), force);
|
m_okView.setFrame(KDRect(width - okSize.width()-k_okMargin, height-okSize.height()-k_okMargin, okSize), force);
|
||||||
}
|
}
|
||||||
|
|
||||||
PromptController::PromptController(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages) :
|
PromptController::PromptController(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages) :
|
||||||
ViewController(nullptr),
|
ViewController(nullptr),
|
||||||
m_messageViewWithSkip(messages, fgcolors, bgcolors, numberOfMessages)
|
m_messageViewWithSkip(messages, fgcolors, bgcolors, numberOfMessages)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ namespace OnBoarding {
|
|||||||
|
|
||||||
class PromptController : public ViewController {
|
class PromptController : public ViewController {
|
||||||
public:
|
public:
|
||||||
PromptController(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages);
|
PromptController(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages);
|
||||||
View * view() override { return &m_messageViewWithSkip; }
|
View * view() override { return &m_messageViewWithSkip; }
|
||||||
bool handleEvent(Ion::Events::Event event) override;
|
bool handleEvent(Ion::Events::Event event) override;
|
||||||
private:
|
private:
|
||||||
class MessageViewWithSkip : public MessageView {
|
class MessageViewWithSkip : public MessageView {
|
||||||
public:
|
public:
|
||||||
MessageViewWithSkip(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages);
|
MessageViewWithSkip(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages);
|
||||||
protected:
|
protected:
|
||||||
int numberOfSubviews() const override;
|
int numberOfSubviews() const override;
|
||||||
View * subviewAtIndex(int index) override;
|
View * subviewAtIndex(int index) override;
|
||||||
|
|||||||
@@ -85,11 +85,11 @@ App::App(Snapshot * snapshot) :
|
|||||||
{
|
{
|
||||||
switch (snapshot->activePage()) {
|
switch (snapshot->activePage()) {
|
||||||
case Snapshot::Page::Parameters:
|
case Snapshot::Page::Parameters:
|
||||||
m_stackViewController.push(&m_parametersController, Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder);
|
m_stackViewController.push(&m_parametersController, *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder);
|
||||||
break;
|
break;
|
||||||
case Snapshot::Page::Calculations:
|
case Snapshot::Page::Calculations:
|
||||||
m_stackViewController.push(&m_parametersController, Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder);
|
m_stackViewController.push(&m_parametersController, *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder);
|
||||||
m_stackViewController.push(&m_calculationController, Palette::BannerSecondText, Palette::BannerSecondBackground, Palette::BannerSecondBorder);
|
m_stackViewController.push(&m_calculationController, *Palette::BannerSecondText, *Palette::BannerSecondBackground, *Palette::BannerSecondBorder);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,10 +38,10 @@ KDSize CalculationCell::minimalSizeForOptimalDisplay() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CalculationCell::drawRect(KDContext * ctx, KDRect rect) const {
|
void CalculationCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(bounds(), Palette::BackgroundHard);
|
ctx->fillRect(bounds(), *Palette::BackgroundHard);
|
||||||
if (m_isResponder) {
|
if (m_isResponder) {
|
||||||
KDSize textSize = m_text.minimalSizeForOptimalDisplay();
|
KDSize textSize = m_text.minimalSizeForOptimalDisplay();
|
||||||
ctx->strokeRect(KDRect(2*k_margin+textSize.width(), 0, calculationCellWidth()+2*ResponderImageCell::k_outline, ImageCell::k_height+2*ResponderImageCell::k_outline), Palette::ProbabilityCellBorder);
|
ctx->strokeRect(KDRect(2*k_margin+textSize.width(), 0, calculationCellWidth()+2*ResponderImageCell::k_outline, ImageCell::k_height+2*ResponderImageCell::k_outline), *Palette::ProbabilityCellBorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Probability {
|
|||||||
constexpr int CalculationController::k_titleBufferSize;
|
constexpr int CalculationController::k_titleBufferSize;
|
||||||
|
|
||||||
CalculationController::ContentView::ContentView(SelectableTableView * selectableTableView, Distribution * distribution, Calculation * calculation) :
|
CalculationController::ContentView::ContentView(SelectableTableView * selectableTableView, Distribution * distribution, Calculation * calculation) :
|
||||||
m_titleView(KDFont::SmallFont, I18n::Message::ComputeProbability, 0.5f, 0.5f, Palette::SecondaryText, Palette::BackgroundApps),
|
m_titleView(KDFont::SmallFont, I18n::Message::ComputeProbability, 0.5f, 0.5f, *Palette::SecondaryText, *Palette::BackgroundApps),
|
||||||
m_selectableTableView(selectableTableView),
|
m_selectableTableView(selectableTableView),
|
||||||
m_distributionCurveView(distribution, calculation)
|
m_distributionCurveView(distribution, calculation)
|
||||||
{
|
{
|
||||||
@@ -68,7 +68,7 @@ CalculationController::CalculationController(Responder * parentResponder, InputE
|
|||||||
m_selectableTableView.setMargins(k_tableMargin);
|
m_selectableTableView.setMargins(k_tableMargin);
|
||||||
m_selectableTableView.setVerticalCellOverlap(0);
|
m_selectableTableView.setVerticalCellOverlap(0);
|
||||||
m_selectableTableView.setDecoratorType(ScrollView::Decorator::Type::None);
|
m_selectableTableView.setDecoratorType(ScrollView::Decorator::Type::None);
|
||||||
m_selectableTableView.setBackgroundColor(Palette::BackgroundHard);
|
m_selectableTableView.setBackgroundColor(*Palette::BackgroundHard);
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < k_numberOfCalculationCells; i++) {
|
for (int i = 0; i < k_numberOfCalculationCells; i++) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace Probability {
|
|||||||
|
|
||||||
Cell::Cell() :
|
Cell::Cell() :
|
||||||
HighlightCell(),
|
HighlightCell(),
|
||||||
m_labelView(KDFont::LargeFont, (I18n::Message)0, 0, 0.5, Palette::PrimaryText, Palette::BackgroundHard),
|
m_labelView(KDFont::LargeFont, (I18n::Message)0, 0, 0.5, *Palette::PrimaryText, *Palette::BackgroundHard),
|
||||||
m_icon(nullptr),
|
m_icon(nullptr),
|
||||||
m_focusedIcon(nullptr)
|
m_focusedIcon(nullptr)
|
||||||
{
|
{
|
||||||
@@ -36,7 +36,7 @@ void Cell::layoutSubviews(bool force) {
|
|||||||
|
|
||||||
void Cell::reloadCell() {
|
void Cell::reloadCell() {
|
||||||
HighlightCell::reloadCell();
|
HighlightCell::reloadCell();
|
||||||
KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||||
m_labelView.setBackgroundColor(backgroundColor);
|
m_labelView.setBackgroundColor(backgroundColor);
|
||||||
if (isHighlighted()) {
|
if (isHighlighted()) {
|
||||||
m_iconView.setImage(m_focusedIcon);
|
m_iconView.setImage(m_focusedIcon);
|
||||||
@@ -57,12 +57,12 @@ void Cell::setImage(const Image * image, const Image * focusedImage) {
|
|||||||
void Cell::drawRect(KDContext * ctx, KDRect rect) const {
|
void Cell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
KDCoordinate width = bounds().width();
|
KDCoordinate width = bounds().width();
|
||||||
KDCoordinate height = bounds().height();
|
KDCoordinate height = bounds().height();
|
||||||
KDColor backgroundColor = isHighlighted() ? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
KDColor backgroundColor = isHighlighted() ? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||||
ctx->fillRect(KDRect(1, 1, width-2, height-1), backgroundColor);
|
ctx->fillRect(KDRect(1, 1, width-2, height-1), backgroundColor);
|
||||||
ctx->fillRect(KDRect(0, 0, width, 1), Palette::ProbabilityCellBorder);
|
ctx->fillRect(KDRect(0, 0, width, 1), *Palette::ProbabilityCellBorder);
|
||||||
ctx->fillRect(KDRect(0, 1, 1, height-1), Palette::ProbabilityCellBorder);
|
ctx->fillRect(KDRect(0, 1, 1, height-1), *Palette::ProbabilityCellBorder);
|
||||||
ctx->fillRect(KDRect(width-1, 1, 1, height-1), Palette::ProbabilityCellBorder);
|
ctx->fillRect(KDRect(width-1, 1, 1, height-1), *Palette::ProbabilityCellBorder);
|
||||||
ctx->fillRect(KDRect(0, height-1, width, 1), Palette::ProbabilityCellBorder);
|
ctx->fillRect(KDRect(0, height-1, width, 1), *Palette::ProbabilityCellBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ bool Probability::DistributionController::handleEvent(Ion::Events::Event event)
|
|||||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
|
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
|
||||||
StackViewController * stack = (StackViewController *)parentResponder();
|
StackViewController * stack = (StackViewController *)parentResponder();
|
||||||
setDistributionAccordingToIndex(selectedRow());
|
setDistributionAccordingToIndex(selectedRow());
|
||||||
stack->push(m_parametersController, Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder);
|
stack->push(m_parametersController, *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ private:
|
|||||||
class ContentView : public View {
|
class ContentView : public View {
|
||||||
public:
|
public:
|
||||||
ContentView(SelectableTableView * selectableTableView) :
|
ContentView(SelectableTableView * selectableTableView) :
|
||||||
m_titleView(KDFont::SmallFont, I18n::Message::ChooseDistribution, 0.5f, 0.5f, Palette::SecondaryText, Palette::BackgroundApps),
|
m_titleView(KDFont::SmallFont, I18n::Message::ChooseDistribution, 0.5f, 0.5f, *Palette::SecondaryText, *Palette::BackgroundApps),
|
||||||
m_selectableTableView(selectableTableView)
|
m_selectableTableView(selectableTableView)
|
||||||
{}
|
{}
|
||||||
constexpr static KDCoordinate k_titleMargin = 8;
|
constexpr static KDCoordinate k_titleMargin = 8;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ using namespace Shared;
|
|||||||
|
|
||||||
namespace Probability {
|
namespace Probability {
|
||||||
|
|
||||||
constexpr KDColor DistributionCurveView::k_backgroundColor;
|
KDColor const * DistributionCurveView::k_backgroundColor = Palette::BackgroundApps;
|
||||||
|
|
||||||
void DistributionCurveView::reload() {
|
void DistributionCurveView::reload() {
|
||||||
CurveView::reload();
|
CurveView::reload();
|
||||||
@@ -16,9 +16,9 @@ void DistributionCurveView::reload() {
|
|||||||
void DistributionCurveView::drawRect(KDContext * ctx, KDRect rect) const {
|
void DistributionCurveView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
float lowerBound = m_calculation->lowerBound();
|
float lowerBound = m_calculation->lowerBound();
|
||||||
float upperBound = m_calculation->upperBound();
|
float upperBound = m_calculation->upperBound();
|
||||||
ctx->fillRect(bounds(), k_backgroundColor);
|
ctx->fillRect(bounds(), *k_backgroundColor);
|
||||||
drawAxis(ctx, rect, Axis::Horizontal);
|
drawAxis(ctx, rect, Axis::Horizontal);
|
||||||
drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, false, false, 0, k_backgroundColor);
|
drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, false, false, 0, *k_backgroundColor);
|
||||||
if (m_distribution->type() == Distribution::Type::Normal) {
|
if (m_distribution->type() == Distribution::Type::Normal) {
|
||||||
/* Special case for the normal distribution, which has always the same curve
|
/* Special case for the normal distribution, which has always the same curve
|
||||||
* We indicate the pixels from and to which we color under the curve, not
|
* We indicate the pixels from and to which we color under the curve, not
|
||||||
@@ -29,9 +29,9 @@ void DistributionCurveView::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_distribution->isContinuous()) {
|
if (m_distribution->isContinuous()) {
|
||||||
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, m_distribution, nullptr, Palette::ProbabilityCurve, true, true, lowerBound, upperBound);
|
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, m_distribution, nullptr, *Palette::ProbabilityCurve, true, true, lowerBound, upperBound);
|
||||||
} else {
|
} else {
|
||||||
drawHistogram(ctx, rect, EvaluateAtAbscissa, m_distribution, nullptr, 0, 1, false, Palette::ProbabilityHistogramBar, Palette::ProbabilityCurve, lowerBound, upperBound+0.5f);
|
drawHistogram(ctx, rect, EvaluateAtAbscissa, m_distribution, nullptr, 0, 1, false, *Palette::ProbabilityHistogramBar, *Palette::ProbabilityCurve, lowerBound, upperBound+0.5f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ void DistributionCurveView::drawStandardNormal(KDContext * ctx, KDRect rect, flo
|
|||||||
// Draw a centered reduced normal curve
|
// Draw a centered reduced normal curve
|
||||||
NormalDistribution n;
|
NormalDistribution n;
|
||||||
constCastedThis->setCurveViewRange(&n);
|
constCastedThis->setCurveViewRange(&n);
|
||||||
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, &n, nullptr, Palette::ProbabilityCurve, true, true, pixelToFloat(Axis::Horizontal, colorLowerBoundPixel), pixelToFloat(Axis::Horizontal, colorUpperBoundPixel));
|
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, &n, nullptr, *Palette::ProbabilityCurve, true, true, pixelToFloat(Axis::Horizontal, colorLowerBoundPixel), pixelToFloat(Axis::Horizontal, colorUpperBoundPixel));
|
||||||
|
|
||||||
// Put back the previous curve view range
|
// Put back the previous curve view range
|
||||||
constCastedThis->setCurveViewRange(previousRange);
|
constCastedThis->setCurveViewRange(previousRange);
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
static float EvaluateAtAbscissa(float abscissa, void * model, void * context);
|
static float EvaluateAtAbscissa(float abscissa, void * model, void * context);
|
||||||
static Poincare::Coordinate2D<float> EvaluateXYAtAbscissa(float abscissa, void * model, void * context);
|
static Poincare::Coordinate2D<float> EvaluateXYAtAbscissa(float abscissa, void * model, void * context);
|
||||||
static constexpr KDColor k_backgroundColor = Palette::BackgroundApps;
|
static KDColor const * k_backgroundColor;
|
||||||
void drawStandardNormal(KDContext * ctx, KDRect rect, float colorLowerBound, float colorUpperBound) const;
|
void drawStandardNormal(KDContext * ctx, KDRect rect, float colorLowerBound, float colorUpperBound) const;
|
||||||
char m_labels[k_maxNumberOfXLabels][k_labelBufferMaxSize];
|
char m_labels[k_maxNumberOfXLabels][k_labelBufferMaxSize];
|
||||||
Distribution * m_distribution;
|
Distribution * m_distribution;
|
||||||
|
|||||||
@@ -8,16 +8,16 @@ namespace Probability {
|
|||||||
|
|
||||||
ParametersController::ContentView::ContentView(SelectableTableView * selectableTableView) :
|
ParametersController::ContentView::ContentView(SelectableTableView * selectableTableView) :
|
||||||
m_numberOfParameters(1),
|
m_numberOfParameters(1),
|
||||||
m_titleView(KDFont::SmallFont, I18n::Message::ChooseParameters, 0.5f, 0.5f, Palette::SecondaryText, Palette::BackgroundApps),
|
m_titleView(KDFont::SmallFont, I18n::Message::ChooseParameters, 0.5f, 0.5f, *Palette::SecondaryText, *Palette::BackgroundApps),
|
||||||
m_firstParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps),
|
m_firstParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps),
|
||||||
m_secondParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps),
|
m_secondParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps),
|
||||||
m_selectableTableView(selectableTableView)
|
m_selectableTableView(selectableTableView)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParametersController::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
void ParametersController::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
int tableHeight = m_selectableTableView->minimalSizeForOptimalDisplay().height();
|
int tableHeight = m_selectableTableView->minimalSizeForOptimalDisplay().height();
|
||||||
ctx->fillRect(KDRect(0, tableHeight, bounds().width(), bounds().height() - tableHeight), Palette::BackgroundApps);
|
ctx->fillRect(KDRect(0, tableHeight, bounds().width(), bounds().height() - tableHeight), *Palette::BackgroundApps);
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageTextView * ParametersController::ContentView::parameterDefinitionAtIndex(int index) {
|
MessageTextView * ParametersController::ContentView::parameterDefinitionAtIndex(int index) {
|
||||||
@@ -161,7 +161,7 @@ bool ParametersController::textFieldDidFinishEditing(TextField * textField, cons
|
|||||||
|
|
||||||
void ParametersController::buttonAction() {
|
void ParametersController::buttonAction() {
|
||||||
StackViewController * stack = stackController();
|
StackViewController * stack = stackController();
|
||||||
stack->push(m_calculationController, Palette::BannerSecondText, Palette::BannerSecondBackground, Palette::BannerSecondBorder);
|
stack->push(m_calculationController, *Palette::BannerSecondText, *Palette::BannerSecondBackground, *Palette::BannerSecondBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ ResponderImageCell::ResponderImageCell(Responder * parentResponder, Distribution
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ResponderImageCell::drawRect(KDContext * ctx, KDRect rect) const {
|
void ResponderImageCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(bounds(), Palette::BackgroundHard);
|
ctx->fillRect(bounds(), *Palette::BackgroundHard);
|
||||||
ctx->strokeRect(KDRect(0, 0, ImageCell::k_width+2*k_outline, ImageCell::k_height+2*k_outline), Palette::ProbabilityCellBorder);
|
ctx->strokeRect(KDRect(0, 0, ImageCell::k_width+2*k_outline, ImageCell::k_height+2*k_outline), *Palette::ProbabilityCellBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
KDSize ResponderImageCell::minimalSizeForOptimalDisplay() const {
|
KDSize ResponderImageCell::minimalSizeForOptimalDisplay() const {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ void ReadBookController::loadPosition() {
|
|||||||
else {
|
else {
|
||||||
m_readerView.setBookSave({
|
m_readerView.setBookSave({
|
||||||
0,
|
0,
|
||||||
Palette::PrimaryText
|
*Palette::PrimaryText
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -243,7 +243,7 @@ void WordWrapTextView::setBookSave(BookSave save) {
|
|||||||
bool WordWrapTextView::updateTextColorForward(const char * colorStart) const {
|
bool WordWrapTextView::updateTextColorForward(const char * colorStart) const {
|
||||||
|
|
||||||
if (*(colorStart + 1) == '\\') {
|
if (*(colorStart + 1) == '\\') {
|
||||||
m_textColor = Palette::PrimaryText;
|
m_textColor = *Palette::PrimaryText;
|
||||||
return (*(colorStart + 3) == '%' || *(colorStart + 4) == '%');
|
return (*(colorStart + 3) == '%' || *(colorStart + 4) == '%');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,56 +254,56 @@ bool WordWrapTextView::updateTextColorForward(const char * colorStart) const {
|
|||||||
{
|
{
|
||||||
case 'r':
|
case 'r':
|
||||||
if (*(colorStart+2) == 'l') {
|
if (*(colorStart+2) == 'l') {
|
||||||
m_textColor = Palette::RedLight;
|
m_textColor = *Palette::RedLight;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_textColor = Palette::Red;
|
m_textColor = *Palette::Red;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
m_textColor = Palette::Magenta;
|
m_textColor = *Palette::Magenta;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
m_textColor = Palette::Turquoise;
|
m_textColor = *Palette::Turquoise;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
if (*(colorStart+2) == 'k') {
|
if (*(colorStart+2) == 'k') {
|
||||||
m_textColor = Palette::Pink;
|
m_textColor = *Palette::Pink;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
else if (*(colorStart+2) == 'p') {
|
else if (*(colorStart+2) == 'p') {
|
||||||
m_textColor = Palette::Purple;
|
m_textColor = *Palette::Purple;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
if (*(colorStart+2) == 'r') {
|
if (*(colorStart+2) == 'r') {
|
||||||
m_textColor = Palette::Brown;
|
m_textColor = *Palette::Brown;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
if (*(colorStart+2) == 'l') {
|
if (*(colorStart+2) == 'l') {
|
||||||
m_textColor = Palette::BlueLight;
|
m_textColor = *Palette::BlueLight;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_textColor = Palette::Blue;
|
m_textColor = *Palette::Blue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
m_textColor = Palette::Orange;
|
m_textColor = *Palette::Orange;
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
if (*(colorStart+2) == 'l') {
|
if (*(colorStart+2) == 'l') {
|
||||||
m_textColor = Palette::GreenLight;
|
m_textColor = *Palette::GreenLight;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_textColor = Palette::Green;
|
m_textColor = *Palette::Green;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
m_textColor = Palette::Cyan;
|
m_textColor = *Palette::Cyan;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -330,56 +330,56 @@ bool WordWrapTextView::updateTextColorBackward(const char * colorStart) const {
|
|||||||
{
|
{
|
||||||
case 'r':
|
case 'r':
|
||||||
if (*(colorStart+2) == 'l') {
|
if (*(colorStart+2) == 'l') {
|
||||||
m_textColor = Palette::RedLight;
|
m_textColor = *Palette::RedLight;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_textColor = Palette::Red;
|
m_textColor = *Palette::Red;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
m_textColor = Palette::Magenta;
|
m_textColor = *Palette::Magenta;
|
||||||
break;
|
break;
|
||||||
case 't':
|
case 't':
|
||||||
m_textColor = Palette::Turquoise;
|
m_textColor = *Palette::Turquoise;
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
if (*(colorStart+2) == 'k') {
|
if (*(colorStart+2) == 'k') {
|
||||||
m_textColor = Palette::Pink;
|
m_textColor = *Palette::Pink;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
else if (*(colorStart+2) == 'p') {
|
else if (*(colorStart+2) == 'p') {
|
||||||
m_textColor = Palette::Purple;
|
m_textColor = *Palette::Purple;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'b':
|
case 'b':
|
||||||
if (*(colorStart+2) == 'r') {
|
if (*(colorStart+2) == 'r') {
|
||||||
m_textColor = Palette::Brown;
|
m_textColor = *Palette::Brown;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
if (*(colorStart+2) == 'l') {
|
if (*(colorStart+2) == 'l') {
|
||||||
m_textColor = Palette::BlueLight;
|
m_textColor = *Palette::BlueLight;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_textColor = Palette::Blue;
|
m_textColor = *Palette::Blue;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'o':
|
case 'o':
|
||||||
m_textColor = Palette::Orange;
|
m_textColor = *Palette::Orange;
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
if (*(colorStart+2) == 'l') {
|
if (*(colorStart+2) == 'l') {
|
||||||
m_textColor = Palette::GreenLight;
|
m_textColor = *Palette::GreenLight;
|
||||||
keySize = 2;
|
keySize = 2;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_textColor = Palette::Green;
|
m_textColor = *Palette::Green;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
m_textColor = Palette::Cyan;
|
m_textColor = *Palette::Cyan;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -26,18 +26,18 @@ CalculationController::CalculationController(Responder * parentResponder, Button
|
|||||||
{
|
{
|
||||||
m_r2Layout = HorizontalLayout::Builder(CodePointLayout::Builder('r', KDFont::SmallFont), VerticalOffsetLayout::Builder(CodePointLayout::Builder('2', KDFont::SmallFont), VerticalOffsetLayoutNode::Position::Superscript));
|
m_r2Layout = HorizontalLayout::Builder(CodePointLayout::Builder('r', KDFont::SmallFont), VerticalOffsetLayout::Builder(CodePointLayout::Builder('2', KDFont::SmallFont), VerticalOffsetLayoutNode::Position::Superscript));
|
||||||
m_selectableTableView.setVerticalCellOverlap(0);
|
m_selectableTableView.setVerticalCellOverlap(0);
|
||||||
m_selectableTableView.setBackgroundColor(Palette::BackgroundAppsSecondary);
|
m_selectableTableView.setBackgroundColor(*Palette::BackgroundAppsSecondary);
|
||||||
m_selectableTableView.setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin);
|
m_selectableTableView.setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin);
|
||||||
m_r2TitleCell.setAlignment(1.0f, 0.5f);
|
m_r2TitleCell.setAlignment(1.0f, 0.5f);
|
||||||
for (int i = 0; i < Store::k_numberOfSeries; i++) {
|
for (int i = 0; i < Store::k_numberOfSeries; i++) {
|
||||||
m_columnTitleCells[i].setParentResponder(&m_selectableTableView);
|
m_columnTitleCells[i].setParentResponder(&m_selectableTableView);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < k_numberOfDoubleCalculationCells; i++) {
|
for (int i = 0; i < k_numberOfDoubleCalculationCells; i++) {
|
||||||
m_doubleCalculationCells[i].setTextColor(Palette::SecondaryText);
|
m_doubleCalculationCells[i].setTextColor(*Palette::SecondaryText);
|
||||||
m_doubleCalculationCells[i].setParentResponder(&m_selectableTableView);
|
m_doubleCalculationCells[i].setParentResponder(&m_selectableTableView);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < k_numberOfCalculationCells;i++) {
|
for (int i = 0; i < k_numberOfCalculationCells;i++) {
|
||||||
m_calculationCells[i].setTextColor(Palette::SecondaryText);
|
m_calculationCells[i].setTextColor(*Palette::SecondaryText);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < k_maxNumberOfDisplayableRows; i++) {
|
for (int i = 0; i < k_maxNumberOfDisplayableRows; i++) {
|
||||||
m_titleCells[i].setMessageFont(KDFont::SmallFont);
|
m_titleCells[i].setMessageFont(KDFont::SmallFont);
|
||||||
@@ -167,7 +167,7 @@ void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int
|
|||||||
buffer[0] = 'Y';
|
buffer[0] = 'Y';
|
||||||
myCell->setSecondText(buffer);
|
myCell->setSecondText(buffer);
|
||||||
assert(seriesNumber < Palette::numberOfDataColors());
|
assert(seriesNumber < Palette::numberOfDataColors());
|
||||||
myCell->setColor(Palette::DataColor[seriesNumber]);
|
myCell->setColor(*Palette::DataColor[seriesNumber]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ class ColumnTitleCell : public EvenOddDoubleBufferTextCellWithSeparator {
|
|||||||
public:
|
public:
|
||||||
ColumnTitleCell(Responder * parentResponder = nullptr) :
|
ColumnTitleCell(Responder * parentResponder = nullptr) :
|
||||||
EvenOddDoubleBufferTextCellWithSeparator(parentResponder, 0.5f, 0.5f),
|
EvenOddDoubleBufferTextCellWithSeparator(parentResponder, 0.5f, 0.5f),
|
||||||
m_functionColor(Palette::Red)
|
m_functionColor(*Palette::Red)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
virtual void setColor(KDColor color);
|
virtual void setColor(KDColor color);
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ void GraphController::setRoundCrossCursorView() {
|
|||||||
if (round) {
|
if (round) {
|
||||||
// Set the color although the cursor view stays round
|
// Set the color although the cursor view stays round
|
||||||
assert(*m_selectedSeriesIndex < Palette::numberOfDataColors());
|
assert(*m_selectedSeriesIndex < Palette::numberOfDataColors());
|
||||||
m_roundCursorView.setColor(Palette::DataColor[*m_selectedSeriesIndex]);
|
m_roundCursorView.setColor(*Palette::DataColor[*m_selectedSeriesIndex]);
|
||||||
}
|
}
|
||||||
CursorView * nextCursorView = round ? static_cast<Shared::CursorView *>(&m_roundCursorView) : static_cast<Shared::CursorView *>(&m_crossCursorView);
|
CursorView * nextCursorView = round ? static_cast<Shared::CursorView *>(&m_roundCursorView) : static_cast<Shared::CursorView *>(&m_crossCursorView);
|
||||||
// Escape if the cursor view stays the same
|
// Escape if the cursor view stays the same
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ GraphView::GraphView(Store * store, CurveViewCursor * cursor, BannerView * banne
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(rect, Palette::BackgroundHard);
|
ctx->fillRect(rect, *Palette::BackgroundHard);
|
||||||
drawGrid(ctx, rect);
|
drawGrid(ctx, rect);
|
||||||
drawAxes(ctx, rect);
|
drawAxes(ctx, rect);
|
||||||
simpleDrawBothAxesLabels(ctx, rect);
|
simpleDrawBothAxesLabels(ctx, rect);
|
||||||
@@ -23,7 +23,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
for (int series = 0; series < Store::k_numberOfSeries; series++) {
|
for (int series = 0; series < Store::k_numberOfSeries; series++) {
|
||||||
if (!m_store->seriesIsEmpty(series)) {
|
if (!m_store->seriesIsEmpty(series)) {
|
||||||
assert(series < Palette::numberOfDataColors());
|
assert(series < Palette::numberOfDataColors());
|
||||||
KDColor color = Palette::DataColor[series];
|
KDColor color = *Palette::DataColor[series];
|
||||||
Model * seriesModel = m_store->modelForSeries(series);
|
Model * seriesModel = m_store->modelForSeries(series);
|
||||||
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, [](float abscissa, void * model, void * context) {
|
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, [](float abscissa, void * model, void * context) {
|
||||||
Model * regressionModel = static_cast<Model *>(model);
|
Model * regressionModel = static_cast<Model *>(model);
|
||||||
@@ -35,7 +35,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
drawDot(ctx, rect, m_store->get(series, 0, index), m_store->get(series, 1, index), color);
|
drawDot(ctx, rect, m_store->get(series, 0, index), m_store->get(series, 1, index), color);
|
||||||
}
|
}
|
||||||
drawDot(ctx, rect, m_store->meanOfColumn(series, 0), m_store->meanOfColumn(series, 1), color, Size::Small);
|
drawDot(ctx, rect, m_store->meanOfColumn(series, 0), m_store->meanOfColumn(series, 1), color, Size::Small);
|
||||||
drawDot(ctx, rect, m_store->meanOfColumn(series, 0), m_store->meanOfColumn(series, 1), Palette::BackgroundHard);
|
drawDot(ctx, rect, m_store->meanOfColumn(series, 0), m_store->meanOfColumn(series, 1), *Palette::BackgroundHard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ void StoreController::willDisplayCellAtLocation(HighlightCell * cell, int i, int
|
|||||||
bool isValuesColumn = i%Store::k_numberOfColumnsPerSeries == 0;
|
bool isValuesColumn = i%Store::k_numberOfColumnsPerSeries == 0;
|
||||||
mytitleCell->setSeparatorLeft(isValuesColumn && i > 0);
|
mytitleCell->setSeparatorLeft(isValuesColumn && i > 0);
|
||||||
int seriesIndex = i/Store::k_numberOfColumnsPerSeries;
|
int seriesIndex = i/Store::k_numberOfColumnsPerSeries;
|
||||||
mytitleCell->setColor(m_store->numberOfPairsOfSeries(seriesIndex) == 0 ? Palette::SecondaryText : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GreyDark with graph/list_controller and statistics/store_controller
|
mytitleCell->setColor(m_store->numberOfPairsOfSeries(seriesIndex) == 0 ? *Palette::SecondaryText : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GreyDark with graph/list_controller and statistics/store_controller
|
||||||
char name[] = {isValuesColumn ? 'X' : 'Y', static_cast<char>('1' + seriesIndex), 0};
|
char name[] = {isValuesColumn ? 'X' : 'Y', static_cast<char>('1' + seriesIndex), 0};
|
||||||
mytitleCell->setText(name);
|
mytitleCell->setText(name);
|
||||||
}
|
}
|
||||||
|
|||||||
2
apps/rpn
2
apps/rpn
Submodule apps/rpn updated: b51172c32f...76d065ebf7
@@ -30,7 +30,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
}
|
}
|
||||||
drawDot(ctx, rect, x, y, s->color());
|
drawDot(ctx, rect, x, y, s->color());
|
||||||
if (x >= m_highlightedStart && x <= m_highlightedEnd && record == m_selectedRecord) {
|
if (x >= m_highlightedStart && x <= m_highlightedEnd && record == m_selectedRecord) {
|
||||||
KDColor color = m_shouldColorHighlighted ? s->color() : Palette::PrimaryText;
|
KDColor color = m_shouldColorHighlighted ? s->color() : *Palette::PrimaryText;
|
||||||
if (y >= 0.0f) {
|
if (y >= 0.0f) {
|
||||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, x, 0.0f, y, color, 1);
|
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, x, 0.0f, y, color, 1);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ ListController::ListController(Responder * parentResponder, ::InputEventHandlerD
|
|||||||
m_expressionCells{},
|
m_expressionCells{},
|
||||||
m_parameterController(inputEventHandlerDelegate, this),
|
m_parameterController(inputEventHandlerDelegate, this),
|
||||||
m_typeParameterController(this, this, TableCell::Layout::Vertical),
|
m_typeParameterController(this, this, TableCell::Layout::Vertical),
|
||||||
m_typeStackController(nullptr, &m_typeParameterController, Palette::ToolboxHeaderText, Palette::ToolboxHeaderBackground, Palette::ToolboxHeaderBorder),
|
m_typeStackController(nullptr, &m_typeParameterController, *Palette::ToolboxHeaderText, *Palette::ToolboxHeaderBackground, *Palette::ToolboxHeaderBorder),
|
||||||
m_sequenceToolbox()
|
m_sequenceToolbox()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < k_maxNumberOfRows; i++) {
|
for (int i = 0; i < k_maxNumberOfRows; i++) {
|
||||||
@@ -191,7 +191,7 @@ void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) {
|
|||||||
myCell->setLayout(sequence->secondInitialConditionName());
|
myCell->setLayout(sequence->secondInitialConditionName());
|
||||||
}
|
}
|
||||||
// Set the color
|
// Set the color
|
||||||
KDColor nameColor = sequence->isActive() ? sequence->color() : Palette::SecondaryText;
|
KDColor nameColor = sequence->isActive() ? sequence->color() : *Palette::SecondaryText;
|
||||||
myCell->setColor(nameColor);
|
myCell->setColor(nameColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ void ListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int
|
|||||||
myCell->setLayout(sequence->secondInitialConditionLayout());
|
myCell->setLayout(sequence->secondInitialConditionLayout());
|
||||||
}
|
}
|
||||||
bool active = sequence->isActive();
|
bool active = sequence->isActive();
|
||||||
KDColor textColor = active ? Palette::PrimaryText : Palette::SecondaryText;
|
KDColor textColor = active ? *Palette::PrimaryText : *Palette::SecondaryText;
|
||||||
myCell->setTextColor(textColor);
|
myCell->setTextColor(textColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ void CellWithSeparator::setHighlighted(bool highlight) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CellWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
|
void CellWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(KDRect(0, Metric::CellSeparatorThickness, bounds().width(), k_margin), Palette::BackgroundApps);
|
ctx->fillRect(KDRect(0, Metric::CellSeparatorThickness, bounds().width(), k_margin), *Palette::BackgroundApps);
|
||||||
}
|
}
|
||||||
|
|
||||||
int CellWithSeparator::numberOfSubviews() const {
|
int CellWithSeparator::numberOfSubviews() const {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ AboutController::AboutController(Responder * parentResponder) :
|
|||||||
for (int i = 0; i < k_totalNumberOfCell; i++) {
|
for (int i = 0; i < k_totalNumberOfCell; i++) {
|
||||||
m_cells[i].setMessageFont(KDFont::LargeFont);
|
m_cells[i].setMessageFont(KDFont::LargeFont);
|
||||||
m_cells[i].setAccessoryFont(KDFont::SmallFont);
|
m_cells[i].setAccessoryFont(KDFont::SmallFont);
|
||||||
m_cells[i].setAccessoryTextColor(Palette::SecondaryText);
|
m_cells[i].setAccessoryTextColor(*Palette::SecondaryText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ ContributorsController::ContributorsController(Responder * parentResponder) :
|
|||||||
for (int i = 0; i < k_totalNumberOfCell; i++) {
|
for (int i = 0; i < k_totalNumberOfCell; i++) {
|
||||||
m_cells[i].setMessageFont(KDFont::LargeFont);
|
m_cells[i].setMessageFont(KDFont::LargeFont);
|
||||||
m_cells[i].setAccessoryFont(KDFont::SmallFont);
|
m_cells[i].setAccessoryFont(KDFont::SmallFont);
|
||||||
m_cells[i].setAccessoryTextColor(Palette::SecondaryText);
|
m_cells[i].setAccessoryTextColor(*Palette::SecondaryText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,15 +64,15 @@ void ContributorsController::willDisplayCellForIndex(HighlightCell * cell, int i
|
|||||||
myTextCell->setTextColor(KDColor::RGB24(0xC03535));
|
myTextCell->setTextColor(KDColor::RGB24(0xC03535));
|
||||||
} else if (index > 0 && index <= s_numberOfDevelopers) {
|
} else if (index > 0 && index <= s_numberOfDevelopers) {
|
||||||
myTextCell->setAccessoryText(I18n::translate(s_developersUsernames[index - 1]));
|
myTextCell->setAccessoryText(I18n::translate(s_developersUsernames[index - 1]));
|
||||||
myTextCell->setTextColor(Palette::PrimaryText);
|
myTextCell->setTextColor(*Palette::PrimaryText);
|
||||||
} else if (index == s_numberOfDevelopers + 1) {
|
} else if (index == s_numberOfDevelopers + 1) {
|
||||||
myTextCell->setAccessoryText("");
|
myTextCell->setAccessoryText("");
|
||||||
myTextCell->setTextColor(KDColor::RGB24(0x1ABC9A));
|
myTextCell->setTextColor(KDColor::RGB24(0x1ABC9A));
|
||||||
} else {
|
} else {
|
||||||
myTextCell->setAccessoryText(I18n::translate(s_betaTestersUsernames[index - 2 - s_numberOfDevelopers]));
|
myTextCell->setAccessoryText(I18n::translate(s_betaTestersUsernames[index - 2 - s_numberOfDevelopers]));
|
||||||
myTextCell->setTextColor(Palette::PrimaryText);
|
myTextCell->setTextColor(*Palette::PrimaryText);
|
||||||
}
|
}
|
||||||
myTextCell->setAccessoryTextColor(Palette::SecondaryText);
|
myTextCell->setAccessoryTextColor(*Palette::SecondaryText);
|
||||||
GenericSubController::willDisplayCellForIndex(cell, index);
|
GenericSubController::willDisplayCellForIndex(cell, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,8 +14,8 @@ void MessageTableCellWithEditableTextWithSeparator::setHighlighted(bool highligh
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MessageTableCellWithEditableTextWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
|
void MessageTableCellWithEditableTextWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), Palette::ListCellBorder);
|
ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), *Palette::ListCellBorder);
|
||||||
ctx->fillRect(KDRect(0, k_separatorThickness, bounds().width(), k_margin-k_separatorThickness), Palette::BackgroundApps);
|
ctx->fillRect(KDRect(0, k_separatorThickness, bounds().width(), k_margin-k_separatorThickness), *Palette::BackgroundApps);
|
||||||
}
|
}
|
||||||
|
|
||||||
int MessageTableCellWithEditableTextWithSeparator::numberOfSubviews() const {
|
int MessageTableCellWithEditableTextWithSeparator::numberOfSubviews() const {
|
||||||
|
|||||||
@@ -14,12 +14,12 @@ SelectableViewWithMessages::SelectableViewWithMessages(SelectableTableView * sel
|
|||||||
for (int i = 0; i < k_maxNumberOfLines; i++) {
|
for (int i = 0; i < k_maxNumberOfLines; i++) {
|
||||||
m_messageLines[i].setFont(KDFont::SmallFont);
|
m_messageLines[i].setFont(KDFont::SmallFont);
|
||||||
m_messageLines[i].setAlignment(0.5f, 0.5f);
|
m_messageLines[i].setAlignment(0.5f, 0.5f);
|
||||||
m_messageLines[i].setBackgroundColor(Palette::BackgroundApps);
|
m_messageLines[i].setBackgroundColor(*Palette::BackgroundApps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectableViewWithMessages::drawRect(KDContext * ctx, KDRect rect) const {
|
void SelectableViewWithMessages::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(bounds(), Palette::BackgroundApps);
|
ctx->fillRect(bounds(), *Palette::BackgroundApps);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectableViewWithMessages::setMessages(I18n::Message * m, int numberOfMessages) {
|
void SelectableViewWithMessages::setMessages(I18n::Message * m, int numberOfMessages) {
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ public:
|
|||||||
KDSize minimalSizeForOptimalDisplay() const override;
|
KDSize minimalSizeForOptimalDisplay() const override;
|
||||||
KDCoordinate minimalHeightForOptimalDisplayGivenWidth(KDCoordinate width) const;
|
KDCoordinate minimalHeightForOptimalDisplayGivenWidth(KDCoordinate width) const;
|
||||||
void reload() { layoutSubviews(); }
|
void reload() { layoutSubviews(); }
|
||||||
static constexpr const KDFont * Font() { return KDFont::SmallFont; }
|
static const KDFont * Font() { return KDFont::SmallFont; }
|
||||||
static constexpr KDColor TextColor() { return Palette::PrimaryText; }
|
static const KDColor TextColor() { return *Palette::PrimaryText; }
|
||||||
static constexpr KDColor BackgroundColor() { return Palette::SubMenuBackground; }
|
static const KDColor BackgroundColor() { return *Palette::SubMenuBackground; }
|
||||||
private:
|
private:
|
||||||
static constexpr KDCoordinate LineSpacing = 2;
|
static constexpr KDCoordinate LineSpacing = 2;
|
||||||
int numberOfSubviews() const override = 0;
|
int numberOfSubviews() const override = 0;
|
||||||
|
|||||||
@@ -24,18 +24,18 @@ void BufferTextViewWithTextField::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
|
|
||||||
// Fill margins with white
|
// Fill margins with white
|
||||||
// Left margin
|
// Left margin
|
||||||
ctx->fillRect(KDRect(0, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), Palette::BackgroundHard);
|
ctx->fillRect(KDRect(0, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), *Palette::BackgroundHard);
|
||||||
ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), Palette::BackgroundHard);
|
ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), *Palette::BackgroundHard);
|
||||||
// Right margin
|
// Right margin
|
||||||
ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), Palette::BackgroundHard);
|
ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), *Palette::BackgroundHard);
|
||||||
// Above the text field
|
// Above the text field
|
||||||
ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, 0, textFieldRect.width() + 2*k_borderWidth, bounds().height()), Palette::BackgroundHard);
|
ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, 0, textFieldRect.width() + 2*k_borderWidth, bounds().height()), *Palette::BackgroundHard);
|
||||||
// Under the text field
|
// Under the text field
|
||||||
ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, textFieldRect.bottom() + k_borderWidth, textFieldRect.width() + 2*k_borderWidth, bounds().height()), Palette::BackgroundHard);
|
ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, textFieldRect.bottom() + k_borderWidth, textFieldRect.width() + 2*k_borderWidth, bounds().height()), *Palette::BackgroundHard);
|
||||||
|
|
||||||
// Draw the text field border
|
// 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);
|
KDRect borderRect = KDRect(textFieldRect.x()-k_borderWidth, textFieldRect.y()-k_borderWidth, textFieldRect.width()+2*k_borderWidth, textFieldRect.height()+2*k_borderWidth);
|
||||||
ctx->strokeRect(borderRect, Palette::ListCellBorder);
|
ctx->strokeRect(borderRect, *Palette::ListCellBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BufferTextViewWithTextField::didBecomeFirstResponder() {
|
void BufferTextViewWithTextField::didBecomeFirstResponder() {
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
#include "button_with_separator.h"
|
#include "button_with_separator.h"
|
||||||
|
|
||||||
ButtonWithSeparator::ButtonWithSeparator(Responder * parentResponder, I18n::Message message, Invocation invocation) :
|
ButtonWithSeparator::ButtonWithSeparator(Responder * parentResponder, I18n::Message message, Invocation invocation) :
|
||||||
Button(parentResponder, message, invocation, KDFont::LargeFont, Palette::ButtonText)
|
Button(parentResponder, message, invocation, KDFont::LargeFont, *Palette::ButtonText)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
|
void ButtonWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
KDCoordinate width = bounds().width();
|
KDCoordinate width = bounds().width();
|
||||||
KDCoordinate height = bounds().height();
|
KDCoordinate height = bounds().height();
|
||||||
ctx->fillRect(KDRect(0, 0, width, k_lineThickness), Palette::ListCellBorder);
|
ctx->fillRect(KDRect(0, 0, width, k_lineThickness), *Palette::ListCellBorder);
|
||||||
ctx->fillRect(KDRect(0, k_lineThickness, width, k_margin-k_lineThickness), Palette::BackgroundApps);
|
ctx->fillRect(KDRect(0, k_lineThickness, width, k_margin-k_lineThickness), *Palette::BackgroundApps);
|
||||||
// Draw rectangle around cell
|
// Draw rectangle around cell
|
||||||
ctx->fillRect(KDRect(0, k_margin, width, k_lineThickness), Palette::ListCellBorder);
|
ctx->fillRect(KDRect(0, k_margin, width, k_lineThickness), *Palette::ListCellBorder);
|
||||||
ctx->fillRect(KDRect(0, k_margin+k_lineThickness, k_lineThickness, height-k_margin), Palette::ListCellBorder);
|
ctx->fillRect(KDRect(0, k_margin+k_lineThickness, k_lineThickness, height-k_margin), *Palette::ListCellBorder);
|
||||||
ctx->fillRect(KDRect(width-k_lineThickness, k_lineThickness+k_margin, k_lineThickness, height-k_margin), Palette::ListCellBorder);
|
ctx->fillRect(KDRect(width-k_lineThickness, k_lineThickness+k_margin, k_lineThickness, height-k_margin), *Palette::ListCellBorder);
|
||||||
ctx->fillRect(KDRect(0, height-3*k_lineThickness, width, k_lineThickness), Palette::ButtonBorderOut);
|
ctx->fillRect(KDRect(0, height-3*k_lineThickness, width, k_lineThickness), *Palette::ButtonBorderOut);
|
||||||
ctx->fillRect(KDRect(0, height-2*k_lineThickness, width, k_lineThickness), Palette::ListCellBorder);
|
ctx->fillRect(KDRect(0, height-2*k_lineThickness, width, k_lineThickness), *Palette::ListCellBorder);
|
||||||
ctx->fillRect(KDRect(k_lineThickness, height-k_lineThickness, width-2*k_lineThickness, k_lineThickness), Palette::ButtonShadow);
|
ctx->fillRect(KDRect(k_lineThickness, height-k_lineThickness, width-2*k_lineThickness, k_lineThickness), *Palette::ButtonShadow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ namespace Shared {
|
|||||||
void CursorView::drawRect(KDContext * ctx, KDRect rect) const {
|
void CursorView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
KDCoordinate width = bounds().width();
|
KDCoordinate width = bounds().width();
|
||||||
KDCoordinate height = bounds().height();
|
KDCoordinate height = bounds().height();
|
||||||
ctx->fillRect(KDRect((width-1)/2, 0, 1, height), Palette::PrimaryText);
|
ctx->fillRect(KDRect((width-1)/2, 0, 1, height), *Palette::PrimaryText);
|
||||||
ctx->fillRect(KDRect(0, (height-1)/2, width, 1), Palette::PrimaryText);
|
ctx->fillRect(KDRect(0, (height-1)/2, width, 1), *Palette::PrimaryText);
|
||||||
}
|
}
|
||||||
|
|
||||||
KDSize CursorView::minimalSizeForOptimalDisplay() const {
|
KDSize CursorView::minimalSizeForOptimalDisplay() const {
|
||||||
|
|||||||
@@ -286,7 +286,7 @@ void CurveView::drawLabel(KDContext * ctx, KDRect rect, float xPosition, float y
|
|||||||
KDPoint position = positionLabel(xCoordinate, yCoordinate, labelSize, horizontalPosition, verticalPosition);
|
KDPoint position = positionLabel(xCoordinate, yCoordinate, labelSize, horizontalPosition, verticalPosition);
|
||||||
if (rect.intersects(KDRect(position, labelSize))) {
|
if (rect.intersects(KDRect(position, labelSize))) {
|
||||||
// TODO: should we blend?
|
// TODO: should we blend?
|
||||||
ctx->drawString(label, position, k_font, color, Palette::BackgroundApps);
|
ctx->drawString(label, position, k_font, color, *Palette::BackgroundApps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,7 +369,7 @@ void CurveView::drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis
|
|||||||
labelPosition,
|
labelPosition,
|
||||||
k_labelGraduationLength,
|
k_labelGraduationLength,
|
||||||
1);
|
1);
|
||||||
ctx->fillRect(graduation, Palette::PrimaryText);
|
ctx->fillRect(graduation, *Palette::PrimaryText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -414,7 +414,7 @@ void CurveView::drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis
|
|||||||
|
|
||||||
DrawLabel:
|
DrawLabel:
|
||||||
if (rect.intersects(KDRect(position, textSize))) {
|
if (rect.intersects(KDRect(position, textSize))) {
|
||||||
ctx->drawString(labelI, position, k_font, Palette::PrimaryText, backgroundColor);
|
ctx->drawString(labelI, position, k_font, *Palette::PrimaryText, backgroundColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -557,8 +557,8 @@ void CurveView::drawArrow(KDContext * ctx, KDRect rect, float x, float y, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CurveView::drawGrid(KDContext * ctx, KDRect rect) const {
|
void CurveView::drawGrid(KDContext * ctx, KDRect rect) const {
|
||||||
KDColor boldColor = Palette::GridPrimaryLine;
|
KDColor boldColor = *Palette::GridPrimaryLine;
|
||||||
KDColor lightColor = Palette::GridSecondaryLine;
|
KDColor lightColor = *Palette::GridSecondaryLine;
|
||||||
drawGridLines(ctx, rect, Axis::Vertical, m_curveViewRange->xGridUnit(), boldColor, lightColor);
|
drawGridLines(ctx, rect, Axis::Vertical, m_curveViewRange->xGridUnit(), boldColor, lightColor);
|
||||||
drawGridLines(ctx, rect, Axis::Horizontal, m_curveViewRange->yGridUnit(), boldColor, lightColor);
|
drawGridLines(ctx, rect, Axis::Horizontal, m_curveViewRange->yGridUnit(), boldColor, lightColor);
|
||||||
}
|
}
|
||||||
@@ -569,7 +569,7 @@ void CurveView::drawAxes(KDContext * ctx, KDRect rect) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CurveView::drawAxis(KDContext * ctx, KDRect rect, Axis axis) const {
|
void CurveView::drawAxis(KDContext * ctx, KDRect rect, Axis axis) const {
|
||||||
drawLine(ctx, rect, axis, 0.0f, Palette::PrimaryText, 1);
|
drawLine(ctx, rect, axis, 0.0f, *Palette::PrimaryText, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr KDCoordinate thinCircleDiameter = 1;
|
constexpr KDCoordinate thinCircleDiameter = 1;
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ protected:
|
|||||||
};
|
};
|
||||||
// Draw the label at the above/below and to the left/right of the given position
|
// Draw the label at the above/below and to the left/right of the given position
|
||||||
void drawLabel(KDContext * ctx, KDRect rect, float xPosition, float yPosition, const char * label, KDColor color, RelativePosition horizontalPosition, RelativePosition verticalPosition) const;
|
void drawLabel(KDContext * ctx, KDRect rect, float xPosition, float yPosition, const char * label, KDColor color, RelativePosition horizontalPosition, RelativePosition verticalPosition) const;
|
||||||
void drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis, bool shiftOrigin, bool graduationOnly = false, bool fixCoordinate = false, KDCoordinate fixedCoordinate = 0, KDColor backgroundColor = Palette::BackgroundHard) const;
|
void drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis, bool shiftOrigin, bool graduationOnly = false, bool fixCoordinate = false, KDCoordinate fixedCoordinate = 0, KDColor backgroundColor = *Palette::BackgroundHard) const;
|
||||||
View * m_bannerView;
|
View * m_bannerView;
|
||||||
CurveViewCursor * m_curveViewCursor;
|
CurveViewCursor * m_curveViewCursor;
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ public:
|
|||||||
static KDColor colorOfSeriesAtIndex(int i) {
|
static KDColor colorOfSeriesAtIndex(int i) {
|
||||||
assert(i >= 0 && i < k_numberOfSeries);
|
assert(i >= 0 && i < k_numberOfSeries);
|
||||||
assert(i < Palette::numberOfDataColors());
|
assert(i < Palette::numberOfDataColors());
|
||||||
return Palette::DataColor[i];
|
return *Palette::DataColor[i];
|
||||||
}
|
}
|
||||||
static KDColor colorLightOfSeriesAtIndex(int i) {
|
static KDColor colorLightOfSeriesAtIndex(int i) {
|
||||||
assert(i >= 0 && i < k_numberOfSeries);
|
assert(i >= 0 && i < k_numberOfSeries);
|
||||||
assert(i < Palette::numberOfLightDataColors());
|
assert(i < Palette::numberOfLightDataColors());
|
||||||
return Palette::DataColorLight[i];
|
return *Palette::DataColorLight[i];
|
||||||
}
|
}
|
||||||
double * data() { return reinterpret_cast<double*>(&m_data); }
|
double * data() { return reinterpret_cast<double*>(&m_data); }
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ KDSize FunctionExpressionCell::minimalSizeForOptimalDisplay() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FunctionExpressionCell::drawRect(KDContext * ctx, KDRect rect) const {
|
void FunctionExpressionCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
KDColor separatorColor = m_even ? Palette::BackgroundApps : Palette::BackgroundHard;
|
KDColor separatorColor = m_even ? *Palette::BackgroundApps : *Palette::BackgroundHard;
|
||||||
// Color the horizontal separator
|
// Color the horizontal separator
|
||||||
ctx->fillRect(KDRect(0, bounds().height()-k_separatorThickness, bounds().width(), k_separatorThickness), separatorColor);
|
ctx->fillRect(KDRect(0, bounds().height()-k_separatorThickness, bounds().width(), k_separatorThickness), separatorColor);
|
||||||
// Color the left margin
|
// Color the left margin
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ FunctionGraphView::FunctionGraphView(InteractiveCurveViewRange * graphRange,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FunctionGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
void FunctionGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(rect, Palette::BackgroundHard);
|
ctx->fillRect(rect, *Palette::BackgroundHard);
|
||||||
drawGrid(ctx, rect);
|
drawGrid(ctx, rect);
|
||||||
drawAxes(ctx, rect);
|
drawAxes(ctx, rect);
|
||||||
simpleDrawBothAxesLabels(ctx, rect);
|
simpleDrawBothAxesLabels(ctx, rect);
|
||||||
|
|||||||
@@ -17,13 +17,13 @@ FunctionListController::FunctionListController(Responder * parentResponder, Butt
|
|||||||
TabViewController * tabController = list->tabController();
|
TabViewController * tabController = list->tabController();
|
||||||
tabController->setActiveTab(1);
|
tabController->setActiveTab(1);
|
||||||
return true;
|
return true;
|
||||||
}, this), KDFont::SmallFont, Palette::ButtonText),
|
}, this), KDFont::SmallFont, *Palette::ButtonText),
|
||||||
m_valuesButton(this, I18n::Message::DisplayValues, Invocation([](void * context, void * sender) {
|
m_valuesButton(this, I18n::Message::DisplayValues, Invocation([](void * context, void * sender) {
|
||||||
FunctionListController * list = (FunctionListController *)context;
|
FunctionListController * list = (FunctionListController *)context;
|
||||||
TabViewController * tabController = list->tabController();
|
TabViewController * tabController = list->tabController();
|
||||||
tabController->setActiveTab(2);
|
tabController->setActiveTab(2);
|
||||||
return true;
|
return true;
|
||||||
}, this), KDFont::SmallFont, Palette::ButtonText),
|
}, this), KDFont::SmallFont, *Palette::ButtonText),
|
||||||
m_titlesColumnWidth(k_minTitleColumnWidth)
|
m_titlesColumnWidth(k_minTitleColumnWidth)
|
||||||
{
|
{
|
||||||
/* m_memoizedCellBaseline is not initialized by the call to
|
/* m_memoizedCellBaseline is not initialized by the call to
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ void FunctionTitleCell::setBaseline(KDCoordinate baseline) {
|
|||||||
|
|
||||||
void FunctionTitleCell::drawRect(KDContext * ctx, KDRect rect) const {
|
void FunctionTitleCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
if (m_orientation == Orientation::VerticalIndicator){
|
if (m_orientation == Orientation::VerticalIndicator){
|
||||||
KDColor separatorColor = m_even ? Palette::BackgroundApps : Palette::BackgroundHard;
|
KDColor separatorColor = m_even ? *Palette::BackgroundApps : *Palette::BackgroundHard;
|
||||||
KDColor backgroundColor = m_even ? Palette::BackgroundHard : Palette::BackgroundApps;
|
KDColor backgroundColor = m_even ? *Palette::BackgroundHard : *Palette::BackgroundApps;
|
||||||
// Draw the color indicator
|
// Draw the color indicator
|
||||||
ctx->fillRect(KDRect(0, 0, k_colorIndicatorThickness, bounds().height()), m_functionColor);
|
ctx->fillRect(KDRect(0, 0, k_colorIndicatorThickness, bounds().height()), m_functionColor);
|
||||||
// Draw the horizontal separator
|
// Draw the horizontal separator
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public:
|
|||||||
EvenOddCell(),
|
EvenOddCell(),
|
||||||
m_orientation(orientation),
|
m_orientation(orientation),
|
||||||
m_baseline(-1),
|
m_baseline(-1),
|
||||||
m_functionColor(Palette::PrimaryText)
|
m_functionColor(*Palette::PrimaryText)
|
||||||
{}
|
{}
|
||||||
virtual void setOrientation(Orientation orientation);
|
virtual void setOrientation(Orientation orientation);
|
||||||
virtual void setColor(KDColor color);
|
virtual void setColor(KDColor color);
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ FunctionZoomAndPanCurveViewController::ContentView::LegendView::LegendView()
|
|||||||
for (int i = 0; i < k_numberOfLegends; i++) {
|
for (int i = 0; i < k_numberOfLegends; i++) {
|
||||||
m_legends[i].setFont(KDFont::SmallFont);
|
m_legends[i].setFont(KDFont::SmallFont);
|
||||||
m_legends[i].setMessage(messages[i]);
|
m_legends[i].setMessage(messages[i]);
|
||||||
m_legends[i].setBackgroundColor(Palette::SubMenuBackground);
|
m_legends[i].setBackgroundColor(*Palette::SubMenuBackground);
|
||||||
m_legends[i].setAlignment(horizontalAlignments[i], 0.5f);
|
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};
|
KeyView::Type tokenTypes[k_numberOfTokens] = {KeyView::Type::Up, KeyView::Type::Down, KeyView::Type::Left, KeyView::Type::Right, KeyView::Type::Plus, KeyView::Type::Minus};
|
||||||
@@ -115,7 +115,7 @@ FunctionZoomAndPanCurveViewController::ContentView::LegendView::LegendView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void FunctionZoomAndPanCurveViewController::ContentView::LegendView::drawRect(KDContext * ctx, KDRect rect) const {
|
void FunctionZoomAndPanCurveViewController::ContentView::LegendView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight), Palette::SubMenuBackground);
|
ctx->fillRect(KDRect(0, bounds().height() - k_legendHeight, bounds().width(), k_legendHeight), *Palette::SubMenuBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
int FunctionZoomAndPanCurveViewController::ContentView::LegendView::numberOfSubviews() const {
|
int FunctionZoomAndPanCurveViewController::ContentView::LegendView::numberOfSubviews() const {
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public:
|
|||||||
Hideable() :
|
Hideable() :
|
||||||
m_hide(false)
|
m_hide(false)
|
||||||
{}
|
{}
|
||||||
static KDColor hideColor() { return Palette::BackgroundAppsSecondary; }
|
static KDColor hideColor() { return *Palette::BackgroundAppsSecondary; }
|
||||||
bool hidden() const { return m_hide; }
|
bool hidden() const { return m_hide; }
|
||||||
virtual void setHide(bool hide) { m_hide = hide; }
|
virtual void setHide(bool hide) { m_hide = hide; }
|
||||||
virtual void reinit() {}
|
virtual void reinit() {}
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ LocalizationController::ContentView::ContentView(LocalizationController * contro
|
|||||||
m_controller(controller),
|
m_controller(controller),
|
||||||
m_selectableTableView(controller, controller, dataSource),
|
m_selectableTableView(controller, controller, dataSource),
|
||||||
m_countryTitleMessage(KDFont::LargeFont, I18n::Message::Country),
|
m_countryTitleMessage(KDFont::LargeFont, I18n::Message::Country),
|
||||||
m_borderView(Palette::BackgroundApps)
|
m_borderView(*Palette::BackgroundApps)
|
||||||
{
|
{
|
||||||
m_countryTitleMessage.setBackgroundColor(Palette::BackgroundHard);
|
m_countryTitleMessage.setBackgroundColor(*Palette::BackgroundHard);
|
||||||
m_countryTitleMessage.setAlignment(0.5f, 0.5f);
|
m_countryTitleMessage.setAlignment(0.5f, 0.5f);
|
||||||
assert(k_numberOfCountryWarningLines == 2); // textMessages is not overflowed
|
assert(k_numberOfCountryWarningLines == 2); // textMessages is not overflowed
|
||||||
I18n::Message textMessages[k_numberOfCountryWarningLines] = {I18n::Message::CountryWarning1, I18n::Message::CountryWarning2};
|
I18n::Message textMessages[k_numberOfCountryWarningLines] = {I18n::Message::CountryWarning1, I18n::Message::CountryWarning2};
|
||||||
for (int i = 0; i < k_numberOfCountryWarningLines; i++) {
|
for (int i = 0; i < k_numberOfCountryWarningLines; i++) {
|
||||||
m_countryWarningLines[i].setBackgroundColor(Palette::BackgroundApps);
|
m_countryWarningLines[i].setBackgroundColor(*Palette::BackgroundApps);
|
||||||
m_countryWarningLines[i].setFont(KDFont::SmallFont);
|
m_countryWarningLines[i].setFont(KDFont::SmallFont);
|
||||||
m_countryWarningLines[i].setAlignment(0.5f, 0.5f);
|
m_countryWarningLines[i].setAlignment(0.5f, 0.5f);
|
||||||
m_countryWarningLines[i].setMessage(textMessages[i]);
|
m_countryWarningLines[i].setMessage(textMessages[i]);
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ protected:
|
|||||||
ContentView(LocalizationController * controller, SelectableTableViewDataSource * dataSource);
|
ContentView(LocalizationController * controller, SelectableTableViewDataSource * dataSource);
|
||||||
|
|
||||||
SelectableTableView * selectableTableView() { return &m_selectableTableView; }
|
SelectableTableView * selectableTableView() { return &m_selectableTableView; }
|
||||||
void drawRect(KDContext * ctx, KDRect rect) const override { ctx->fillRect(bounds(), Palette::BackgroundApps); }
|
void drawRect(KDContext * ctx, KDRect rect) const override { ctx->fillRect(bounds(), *Palette::BackgroundApps); }
|
||||||
void modeHasChanged();
|
void modeHasChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -1,19 +1,19 @@
|
|||||||
#include "message_view.h"
|
#include "message_view.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
MessageView::MessageView(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages) {
|
MessageView::MessageView(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages) {
|
||||||
m_numberOfMessages = numberOfMessages < k_maxNumberOfMessages ? numberOfMessages : k_maxNumberOfMessages;
|
m_numberOfMessages = numberOfMessages < k_maxNumberOfMessages ? numberOfMessages : k_maxNumberOfMessages;
|
||||||
for (uint8_t i = 0; i < m_numberOfMessages; i++) {
|
for (uint8_t i = 0; i < m_numberOfMessages; i++) {
|
||||||
m_messageTextViews[i].setFont(i == 0 ? KDFont::LargeFont : KDFont::SmallFont);
|
m_messageTextViews[i].setFont(i == 0 ? KDFont::LargeFont : KDFont::SmallFont);
|
||||||
m_messageTextViews[i].setMessage(messages[i]);
|
m_messageTextViews[i].setMessage(messages[i]);
|
||||||
m_messageTextViews[i].setAlignment(0.5f, 0.5f);
|
m_messageTextViews[i].setAlignment(0.5f, 0.5f);
|
||||||
m_messageTextViews[i].setTextColor(fgcolors[i]);
|
m_messageTextViews[i].setTextColor(*fgcolors[i]);
|
||||||
m_messageTextViews[i].setBackgroundColor(bgcolors[i]);
|
m_messageTextViews[i].setBackgroundColor(*bgcolors[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageView::drawRect(KDContext * ctx, KDRect rect) const {
|
void MessageView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(bounds(), Palette::BackgroundHard);
|
ctx->fillRect(bounds(), *Palette::BackgroundHard);
|
||||||
}
|
}
|
||||||
|
|
||||||
View * MessageView::subviewAtIndex(int index) {
|
View * MessageView::subviewAtIndex(int index) {
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class MessageView : public View {
|
class MessageView : public View {
|
||||||
public:
|
public:
|
||||||
MessageView(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages);
|
MessageView(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors [], uint8_t numberOfMessages);
|
||||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||||
protected:
|
protected:
|
||||||
int numberOfSubviews() const override { return m_numberOfMessages; }
|
int numberOfSubviews() const override { return m_numberOfMessages; }
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ void OkView::drawRect(KDContext * ctx, KDRect rect) const {
|
|||||||
KDCoordinate height = bounds().height();
|
KDCoordinate height = bounds().height();
|
||||||
KDRect frame((width-k_okSize)/2, (height-k_okSize)/2, k_okSize, k_okSize);
|
KDRect frame((width-k_okSize)/2, (height-k_okSize)/2, k_okSize, k_okSize);
|
||||||
KDColor okWorkingBuffer[OkView::k_okSize*OkView::k_okSize];
|
KDColor okWorkingBuffer[OkView::k_okSize*OkView::k_okSize];
|
||||||
ctx->blendRectWithMask(frame, Palette::PrimaryText, (const uint8_t *)okMask, okWorkingBuffer);
|
ctx->blendRectWithMask(frame, *Palette::PrimaryText, (const uint8_t *)okMask, okWorkingBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
KDSize OkView::minimalSizeForOptimalDisplay() const {
|
KDSize OkView::minimalSizeForOptimalDisplay() const {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ void RangeParameterController::willDisplayCellForIndex(HighlightCell * cell, int
|
|||||||
MessageTableCellWithEditableText * myCell = (MessageTableCellWithEditableText *)cell;
|
MessageTableCellWithEditableText * myCell = (MessageTableCellWithEditableText *)cell;
|
||||||
I18n::Message labels[k_numberOfTextCell] = {I18n::Message::XMin, I18n::Message::XMax, I18n::Message::YMin, I18n::Message::YMax};
|
I18n::Message labels[k_numberOfTextCell] = {I18n::Message::XMin, I18n::Message::XMax, I18n::Message::YMin, I18n::Message::YMax};
|
||||||
myCell->setMessage(labels[index]);
|
myCell->setMessage(labels[index]);
|
||||||
myCell->setTextColor(Palette::PrimaryText);
|
myCell->setTextColor(*Palette::PrimaryText);
|
||||||
FloatParameterController::willDisplayCellForIndex(cell, index);
|
FloatParameterController::willDisplayCellForIndex(cell, index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Shared {
|
|||||||
|
|
||||||
class RoundCursorView : public CursorView {
|
class RoundCursorView : public CursorView {
|
||||||
public:
|
public:
|
||||||
RoundCursorView(KDColor color = Palette::PrimaryText) :
|
RoundCursorView(KDColor color = *Palette::PrimaryText) :
|
||||||
m_color(color)
|
m_color(color)
|
||||||
#ifdef GRAPH_CURSOR_SPEEDUP
|
#ifdef GRAPH_CURSOR_SPEEDUP
|
||||||
, m_underneathPixelBufferLoaded(false)
|
, m_underneathPixelBufferLoaded(false)
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ static inline KDCoordinate maxCoordinate(KDCoordinate x, KDCoordinate y) { retur
|
|||||||
|
|
||||||
ScrollableExactApproximateExpressionsView::ContentCell::ContentCell() :
|
ScrollableExactApproximateExpressionsView::ContentCell::ContentCell() :
|
||||||
m_rightExpressionView(),
|
m_rightExpressionView(),
|
||||||
m_approximateSign(KDFont::LargeFont, I18n::Message::AlmostEqual, 0.5f, 0.5f, Palette::ApproximateSignText),
|
m_approximateSign(KDFont::LargeFont, I18n::Message::AlmostEqual, 0.5f, 0.5f, *Palette::ApproximateSignText),
|
||||||
m_leftExpressionView(),
|
m_leftExpressionView(),
|
||||||
m_selectedSubviewPosition((SubviewPosition)0),
|
m_selectedSubviewPosition((SubviewPosition)0),
|
||||||
m_displayLeftExpression(true)
|
m_displayLeftExpression(true)
|
||||||
@@ -17,7 +17,7 @@ ScrollableExactApproximateExpressionsView::ContentCell::ContentCell() :
|
|||||||
}
|
}
|
||||||
|
|
||||||
KDColor ScrollableExactApproximateExpressionsView::ContentCell::backgroundColor() const {
|
KDColor ScrollableExactApproximateExpressionsView::ContentCell::backgroundColor() const {
|
||||||
KDColor background = m_even ? Palette::CalculationBackgroundEven : Palette::CalculationBackgroundOdd;
|
KDColor background = m_even ? *Palette::CalculationBackgroundEven : *Palette::CalculationBackgroundOdd;
|
||||||
return background;
|
return background;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -29,9 +29,9 @@ void ScrollableExactApproximateExpressionsView::ContentCell::setHighlighted(bool
|
|||||||
m_approximateSign.setBackgroundColor(backgroundColor());
|
m_approximateSign.setBackgroundColor(backgroundColor());
|
||||||
if (highlight) {
|
if (highlight) {
|
||||||
if (m_selectedSubviewPosition == SubviewPosition::Left) {
|
if (m_selectedSubviewPosition == SubviewPosition::Left) {
|
||||||
m_leftExpressionView.setBackgroundColor(Palette::ListCellBackgroundSelected);
|
m_leftExpressionView.setBackgroundColor(*Palette::ListCellBackgroundSelected);
|
||||||
} else {
|
} else {
|
||||||
m_rightExpressionView.setBackgroundColor(Palette::ListCellBackgroundSelected);
|
m_rightExpressionView.setBackgroundColor(*Palette::ListCellBackgroundSelected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,9 +45,9 @@ void ScrollableExactApproximateExpressionsView::ContentCell::setEven(bool even)
|
|||||||
|
|
||||||
void ScrollableExactApproximateExpressionsView::ContentCell::reloadTextColor() {
|
void ScrollableExactApproximateExpressionsView::ContentCell::reloadTextColor() {
|
||||||
if (numberOfSubviews() == 1) {
|
if (numberOfSubviews() == 1) {
|
||||||
m_rightExpressionView.setTextColor(Palette::PrimaryText);
|
m_rightExpressionView.setTextColor(*Palette::PrimaryText);
|
||||||
} else {
|
} else {
|
||||||
m_rightExpressionView.setTextColor(Palette::ApproximateExpressionText);
|
m_rightExpressionView.setTextColor(*Palette::ApproximateExpressionText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace Shared {
|
|||||||
|
|
||||||
AbstractScrollableMultipleExpressionsView::ContentCell::ContentCell() :
|
AbstractScrollableMultipleExpressionsView::ContentCell::ContentCell() :
|
||||||
m_rightExpressionView(),
|
m_rightExpressionView(),
|
||||||
m_approximateSign(k_font, k_defaultApproximateMessage, 0.5f, 0.5f, Palette::SecondaryText),
|
m_approximateSign(k_font, k_defaultApproximateMessage, 0.5f, 0.5f, *Palette::SecondaryText),
|
||||||
m_centeredExpressionView(),
|
m_centeredExpressionView(),
|
||||||
m_selectedSubviewPosition(SubviewPosition::Center),
|
m_selectedSubviewPosition(SubviewPosition::Center),
|
||||||
m_displayCenter(true)
|
m_displayCenter(true)
|
||||||
@@ -16,7 +16,7 @@ AbstractScrollableMultipleExpressionsView::ContentCell::ContentCell() :
|
|||||||
}
|
}
|
||||||
|
|
||||||
KDColor AbstractScrollableMultipleExpressionsView::ContentCell::backgroundColor() const {
|
KDColor AbstractScrollableMultipleExpressionsView::ContentCell::backgroundColor() const {
|
||||||
KDColor background = m_even ? Palette::CalculationBackgroundEven : Palette::CalculationBackgroundOdd;
|
KDColor background = m_even ? *Palette::CalculationBackgroundEven : *Palette::CalculationBackgroundOdd;
|
||||||
return background;
|
return background;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -24,13 +24,13 @@ void AbstractScrollableMultipleExpressionsView::ContentCell::setHighlighted(bool
|
|||||||
// Do not call HighlightCell::setHighlighted to avoid marking all cell as dirty
|
// Do not call HighlightCell::setHighlighted to avoid marking all cell as dirty
|
||||||
m_highlighted = highlight;
|
m_highlighted = highlight;
|
||||||
KDColor defaultColor = backgroundColor();
|
KDColor defaultColor = backgroundColor();
|
||||||
KDColor color = highlight && m_selectedSubviewPosition == SubviewPosition::Center ? Palette::Select : defaultColor;
|
KDColor color = highlight && m_selectedSubviewPosition == SubviewPosition::Center ? *Palette::Select : defaultColor;
|
||||||
m_centeredExpressionView.setBackgroundColor(color);
|
m_centeredExpressionView.setBackgroundColor(color);
|
||||||
color = highlight && m_selectedSubviewPosition == SubviewPosition::Right ? Palette::Select : defaultColor;
|
color = highlight && m_selectedSubviewPosition == SubviewPosition::Right ? *Palette::Select : defaultColor;
|
||||||
m_rightExpressionView.setBackgroundColor(color);
|
m_rightExpressionView.setBackgroundColor(color);
|
||||||
m_approximateSign.setBackgroundColor(defaultColor);
|
m_approximateSign.setBackgroundColor(defaultColor);
|
||||||
if (leftExpressionView()) {
|
if (leftExpressionView()) {
|
||||||
color = highlight && m_selectedSubviewPosition == SubviewPosition::Left ? Palette::Select : defaultColor;
|
color = highlight && m_selectedSubviewPosition == SubviewPosition::Left ? *Palette::Select : defaultColor;
|
||||||
leftExpressionView()->setBackgroundColor(color);
|
leftExpressionView()->setBackgroundColor(color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,9 +48,9 @@ void AbstractScrollableMultipleExpressionsView::ContentCell::setEven(bool even)
|
|||||||
|
|
||||||
void AbstractScrollableMultipleExpressionsView::ContentCell::reloadTextColor() {
|
void AbstractScrollableMultipleExpressionsView::ContentCell::reloadTextColor() {
|
||||||
if (displayCenter()) {
|
if (displayCenter()) {
|
||||||
m_rightExpressionView.setTextColor(Palette::SecondaryText);
|
m_rightExpressionView.setTextColor(*Palette::SecondaryText);
|
||||||
} else {
|
} else {
|
||||||
m_rightExpressionView.setTextColor(Palette::PrimaryText);
|
m_rightExpressionView.setTextColor(*Palette::PrimaryText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ Ion::Storage::Record::ErrorStatus SequenceStore::addEmptyModel() {
|
|||||||
assert(name);
|
assert(name);
|
||||||
// Choose the corresponding color
|
// Choose the corresponding color
|
||||||
assert(nameIndex < Palette::numberOfDataColors());
|
assert(nameIndex < Palette::numberOfDataColors());
|
||||||
KDColor color = Palette::DataColor[nameIndex];
|
KDColor color = *Palette::DataColor[nameIndex];
|
||||||
Sequence::RecordDataBuffer data(color);
|
Sequence::RecordDataBuffer data(color);
|
||||||
// m_sequences
|
// m_sequences
|
||||||
return Ion::Storage::sharedStorage()->createRecordWithExtension(name, modelExtension(), &data, sizeof(data));
|
return Ion::Storage::sharedStorage()->createRecordWithExtension(name, modelExtension(), &data, sizeof(data));
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ StoreController::ContentView::ContentView(DoublePairStore * store, Responder * p
|
|||||||
m_formulaInputView(this, inputEventHandlerDelegate, textFieldDelegate),
|
m_formulaInputView(this, inputEventHandlerDelegate, textFieldDelegate),
|
||||||
m_displayFormulaInputView(false)
|
m_displayFormulaInputView(false)
|
||||||
{
|
{
|
||||||
m_dataView.setBackgroundColor(Palette::BackgroundAppsSecondary);
|
m_dataView.setBackgroundColor(*Palette::BackgroundAppsSecondary);
|
||||||
m_dataView.setVerticalCellOverlap(0);
|
m_dataView.setVerticalCellOverlap(0);
|
||||||
m_dataView.setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin);
|
m_dataView.setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,16 +155,16 @@ void SumGraphController::reloadBannerView() {
|
|||||||
/* Legend View */
|
/* Legend View */
|
||||||
|
|
||||||
SumGraphController::LegendView::LegendView(SumGraphController * controller, InputEventHandlerDelegate * inputEventHandlerDelegate, CodePoint sumSymbol) :
|
SumGraphController::LegendView::LegendView(SumGraphController * controller, InputEventHandlerDelegate * inputEventHandlerDelegate, CodePoint sumSymbol) :
|
||||||
m_sum(0.0f, 0.5f, KDColorBlack, Palette::GrayMiddle),
|
m_sum(0.0f, 0.5f, KDColorBlack, *Palette::GrayMiddle),
|
||||||
m_legend(k_font, I18n::Message::Default, 0.0f, 0.5f, KDColorBlack, Palette::GrayMiddle),
|
m_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_editableZone(controller, m_textBuffer, k_editableZoneBufferSize, TextField::maxBufferSize(), inputEventHandlerDelegate, controller, k_font, 0.0f, 0.5f, KDColorBlack, *Palette::GrayMiddle),
|
||||||
m_sumSymbol(sumSymbol)
|
m_sumSymbol(sumSymbol)
|
||||||
{
|
{
|
||||||
m_textBuffer[0] = 0;
|
m_textBuffer[0] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SumGraphController::LegendView::drawRect(KDContext * ctx, KDRect rect) const {
|
void SumGraphController::LegendView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(bounds(), Palette::GrayMiddle);
|
ctx->fillRect(bounds(), *Palette::GrayMiddle);
|
||||||
}
|
}
|
||||||
|
|
||||||
KDSize SumGraphController::LegendView::minimalSizeForOptimalDisplay() const {
|
KDSize SumGraphController::LegendView::minimalSizeForOptimalDisplay() const {
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ public:
|
|||||||
const KDFont * size = KDFont::LargeFont,
|
const KDFont * size = KDFont::LargeFont,
|
||||||
float horizontalAlignment = 0.0f,
|
float horizontalAlignment = 0.0f,
|
||||||
float verticalAlignment = 0.5f,
|
float verticalAlignment = 0.5f,
|
||||||
KDColor textColor = Palette::PrimaryText,
|
KDColor textColor = *Palette::PrimaryText,
|
||||||
KDColor backgroundColor = Palette::BackgroundHard) :
|
KDColor backgroundColor = *Palette::BackgroundHard) :
|
||||||
TextField(parentResponder, textBuffer, textBufferSize, draftTextBufferSize, inputEventHandlerDelegate, delegate, size, horizontalAlignment, verticalAlignment, textColor, backgroundColor),
|
TextField(parentResponder, textBuffer, textBufferSize, draftTextBufferSize, inputEventHandlerDelegate, delegate, size, horizontalAlignment, verticalAlignment, textColor, backgroundColor),
|
||||||
m_extensionLength(extensionLength)
|
m_extensionLength(extensionLength)
|
||||||
{}
|
{}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ ValuesController::ValuesController(Responder * parentResponder, ButtonRowControl
|
|||||||
void ValuesController::setupSelectableTableViewAndCells(InputEventHandlerDelegate * inputEventHandlerDelegate) {
|
void ValuesController::setupSelectableTableViewAndCells(InputEventHandlerDelegate * inputEventHandlerDelegate) {
|
||||||
selectableTableView()->setVerticalCellOverlap(0);
|
selectableTableView()->setVerticalCellOverlap(0);
|
||||||
selectableTableView()->setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin);
|
selectableTableView()->setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin);
|
||||||
selectableTableView()->setBackgroundColor(Palette::BackgroundAppsSecondary);
|
selectableTableView()->setBackgroundColor(*Palette::BackgroundAppsSecondary);
|
||||||
|
|
||||||
int numberOfAbscissaCells = abscissaCellsCount();
|
int numberOfAbscissaCells = abscissaCellsCount();
|
||||||
for (int i = 0; i < numberOfAbscissaCells; i++) {
|
for (int i = 0; i < numberOfAbscissaCells; i++) {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace Shared {
|
|||||||
|
|
||||||
void VerticalCursorView::drawRect(KDContext * ctx, KDRect rect) const {
|
void VerticalCursorView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
KDCoordinate height = bounds().height();
|
KDCoordinate height = bounds().height();
|
||||||
ctx->fillRect(KDRect(0, 0, 1, height), Palette::PrimaryText);
|
ctx->fillRect(KDRect(0, 0, 1, height), *Palette::PrimaryText);
|
||||||
}
|
}
|
||||||
|
|
||||||
KDSize VerticalCursorView::minimalSizeForOptimalDisplay() const {
|
KDSize VerticalCursorView::minimalSizeForOptimalDisplay() const {
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
ShiftAlphaLockView::ShiftAlphaLockView() :
|
ShiftAlphaLockView::ShiftAlphaLockView() :
|
||||||
View(),
|
View(),
|
||||||
m_shiftAlphaView(KDFont::SmallFont, I18n::Message::Default, 1.0f, 0.5f, Palette::ToolbarText, Palette::Toolbar),
|
m_shiftAlphaView(KDFont::SmallFont, I18n::Message::Default, 1.0f, 0.5f, *Palette::ToolbarText, *Palette::Toolbar),
|
||||||
m_status(Ion::Events::ShiftAlphaStatus::Default)
|
m_status(Ion::Events::ShiftAlphaStatus::Default)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShiftAlphaLockView::drawRect(KDContext * ctx, KDRect rect) const {
|
void ShiftAlphaLockView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(bounds(), Palette::Toolbar);
|
ctx->fillRect(bounds(), *Palette::Toolbar);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShiftAlphaLockView::setStatus(Ion::Events::ShiftAlphaStatus status) {
|
bool ShiftAlphaLockView::setStatus(Ion::Events::ShiftAlphaStatus status) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ EquationListView::EquationListView(ListController * listController) :
|
|||||||
listController->setScrollViewDelegate(this);
|
listController->setScrollViewDelegate(this);
|
||||||
m_scrollBraceView.setMargins(k_margin, k_margin, k_margin, k_margin);
|
m_scrollBraceView.setMargins(k_margin, k_margin, k_margin, k_margin);
|
||||||
m_scrollBraceView.setDecoratorType(ScrollView::Decorator::Type::None);
|
m_scrollBraceView.setDecoratorType(ScrollView::Decorator::Type::None);
|
||||||
m_scrollBraceView.setBackgroundColor(Palette::BackgroundHard);
|
m_scrollBraceView.setBackgroundColor(*Palette::BackgroundHard);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EquationListView::setBraceStyle(BraceStyle style) {
|
void EquationListView::setBraceStyle(BraceStyle style) {
|
||||||
@@ -106,15 +106,15 @@ const uint8_t bottomBrace[braceExtremumHeight][braceExtremumWidth] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
void EquationListView::BraceView::drawRect(KDContext * ctx, KDRect rect) const {
|
void EquationListView::BraceView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(bounds(), Palette::BackgroundHard);
|
ctx->fillRect(bounds(), *Palette::BackgroundHard);
|
||||||
KDCoordinate height = bounds().height();
|
KDCoordinate height = bounds().height();
|
||||||
KDCoordinate margin = 3;
|
KDCoordinate margin = 3;
|
||||||
KDColor braceWorkingBuffer[60];
|
KDColor braceWorkingBuffer[60];
|
||||||
ctx->blendRectWithMask(KDRect(margin, 0, braceExtremumWidth, braceExtremumHeight), Palette::PrimaryText, (const uint8_t *)topBrace, (KDColor *)(braceWorkingBuffer));
|
ctx->blendRectWithMask(KDRect(margin, 0, braceExtremumWidth, braceExtremumHeight), *Palette::PrimaryText, (const uint8_t *)topBrace, (KDColor *)(braceWorkingBuffer));
|
||||||
ctx->blendRectWithMask(KDRect(0, height/2-braceCenterHeight/2, braceCenterWidth, braceCenterHeight), Palette::PrimaryText, (const uint8_t *)middleBrace, (KDColor *)(braceWorkingBuffer));
|
ctx->blendRectWithMask(KDRect(0, height/2-braceCenterHeight/2, braceCenterWidth, braceCenterHeight), *Palette::PrimaryText, (const uint8_t *)middleBrace, (KDColor *)(braceWorkingBuffer));
|
||||||
ctx->blendRectWithMask(KDRect(margin, height-braceExtremumHeight, braceExtremumWidth, braceExtremumHeight), Palette::PrimaryText, (const uint8_t *)bottomBrace, (KDColor *)(braceWorkingBuffer));
|
ctx->blendRectWithMask(KDRect(margin, height-braceExtremumHeight, braceExtremumWidth, braceExtremumHeight), *Palette::PrimaryText, (const uint8_t *)bottomBrace, (KDColor *)(braceWorkingBuffer));
|
||||||
ctx->fillRect(KDRect(margin, braceExtremumHeight, 1, height/2-braceCenterHeight/2-braceExtremumHeight), Palette::PrimaryText);
|
ctx->fillRect(KDRect(margin, braceExtremumHeight, 1, height/2-braceCenterHeight/2-braceExtremumHeight), *Palette::PrimaryText);
|
||||||
ctx->fillRect(KDRect(margin, height/2+braceCenterHeight/2, 1, height/2-braceExtremumHeight/2-braceExtremumHeight), Palette::PrimaryText);
|
ctx->fillRect(KDRect(margin, height/2+braceCenterHeight/2, 1, height/2-braceExtremumHeight/2-braceExtremumHeight), *Palette::PrimaryText);
|
||||||
}
|
}
|
||||||
|
|
||||||
KDSize EquationListView::BraceView::minimalSizeForOptimalDisplay() const {
|
KDSize EquationListView::BraceView::minimalSizeForOptimalDisplay() const {
|
||||||
|
|||||||
@@ -7,14 +7,14 @@
|
|||||||
namespace Solver {
|
namespace Solver {
|
||||||
|
|
||||||
IntervalController::ContentView::ContentView(SelectableTableView * selectableTableView) :
|
IntervalController::ContentView::ContentView(SelectableTableView * selectableTableView) :
|
||||||
m_instructions0(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction0, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps),
|
m_instructions0(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction0, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps),
|
||||||
m_instructions1(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction1, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps),
|
m_instructions1(KDFont::SmallFont, I18n::Message::ApproximateSolutionIntervalInstruction1, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps),
|
||||||
m_selectableTableView(selectableTableView)
|
m_selectableTableView(selectableTableView)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void IntervalController::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
void IntervalController::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_topMargin), Palette::BackgroundApps);
|
ctx->fillRect(KDRect(0, 0, bounds().width(), k_topMargin), *Palette::BackgroundApps);
|
||||||
}
|
}
|
||||||
|
|
||||||
int IntervalController::ContentView::numberOfSubviews() const {
|
int IntervalController::ContentView::numberOfSubviews() const {
|
||||||
@@ -104,7 +104,7 @@ bool IntervalController::textFieldDidFinishEditing(TextField * textField, const
|
|||||||
void IntervalController::buttonAction() {
|
void IntervalController::buttonAction() {
|
||||||
StackViewController * stack = stackController();
|
StackViewController * stack = stackController();
|
||||||
m_equationStore->approximateSolve(textFieldDelegateApp()->localContext(), m_shouldReplaceFunctionsButNotSymbols);
|
m_equationStore->approximateSolve(textFieldDelegateApp()->localContext(), m_shouldReplaceFunctionsButNotSymbols);
|
||||||
stack->push(App::app()->solutionsControllerStack(), Palette::BannerSecondText, Palette::BannerSecondBackground, Palette::BannerSecondBorder);
|
stack->push(App::app()->solutionsControllerStack(), *Palette::BannerSecondText, *Palette::BannerSecondBackground, *Palette::BannerSecondBorder);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,9 @@ ListController::ListController(Responder * parentResponder, EquationStore * equa
|
|||||||
ListController * list = (ListController *)context;
|
ListController * list = (ListController *)context;
|
||||||
list->resolveEquations();
|
list->resolveEquations();
|
||||||
return true;
|
return true;
|
||||||
}, this), KDFont::LargeFont, Palette::ButtonText),
|
}, this), KDFont::LargeFont, *Palette::ButtonText),
|
||||||
m_modelsParameterController(this, equationStore, this),
|
m_modelsParameterController(this, equationStore, this),
|
||||||
m_modelsStackController(nullptr, &m_modelsParameterController, Palette::BannerFirstVariantText, Palette::BannerFirstVariantBackground, Palette::BannerFirstVariantBorder)
|
m_modelsStackController(nullptr, &m_modelsParameterController, *Palette::BannerFirstVariantText, *Palette::BannerFirstVariantBackground, *Palette::BannerFirstVariantBorder)
|
||||||
{
|
{
|
||||||
m_addNewModel.setAlignment(0.3f, 0.5f); // (EquationListView::k_braceTotalWidth+k_expressionMargin) / (Ion::Display::Width-m_addNewModel.text().size()) = (30+5)/(320-200)
|
m_addNewModel.setAlignment(0.3f, 0.5f); // (EquationListView::k_braceTotalWidth+k_expressionMargin) / (Ion::Display::Width-m_addNewModel.text().size()) = (30+5)/(320-200)
|
||||||
for (int i = 0; i < k_maxNumberOfRows; i++) {
|
for (int i = 0; i < k_maxNumberOfRows; i++) {
|
||||||
@@ -191,7 +191,7 @@ void ListController::resolveEquations() {
|
|||||||
case EquationStore::Error::RequireApproximateSolution:
|
case EquationStore::Error::RequireApproximateSolution:
|
||||||
{
|
{
|
||||||
reinterpret_cast<IntervalController *>(App::app()->intervalController())->setShouldReplaceFuncionsButNotSymbols(resultWithoutUserDefinedSymbols);
|
reinterpret_cast<IntervalController *>(App::app()->intervalController())->setShouldReplaceFuncionsButNotSymbols(resultWithoutUserDefinedSymbols);
|
||||||
stackController()->push(App::app()->intervalController(), Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder);
|
stackController()->push(App::app()->intervalController(), *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@@ -199,7 +199,7 @@ void ListController::resolveEquations() {
|
|||||||
assert(e == EquationStore::Error::NoError);
|
assert(e == EquationStore::Error::NoError);
|
||||||
StackViewController * stack = stackController();
|
StackViewController * stack = stackController();
|
||||||
reinterpret_cast<IntervalController *>(App::app()->intervalController())->setShouldReplaceFuncionsButNotSymbols(resultWithoutUserDefinedSymbols);
|
reinterpret_cast<IntervalController *>(App::app()->intervalController())->setShouldReplaceFuncionsButNotSymbols(resultWithoutUserDefinedSymbols);
|
||||||
stack->push(App::app()->solutionsControllerStack(), Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder);
|
stack->push(App::app()->solutionsControllerStack(), *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,21 +17,21 @@ using namespace Shared;
|
|||||||
|
|
||||||
namespace Solver {
|
namespace Solver {
|
||||||
|
|
||||||
constexpr KDColor SolutionsController::ContentView::k_backgroundColor;
|
KDColor const * SolutionsController::ContentView::k_backgroundColor = Palette::BackgroundAppsSecondary;
|
||||||
|
|
||||||
SolutionsController::ContentView::ContentView(SolutionsController * controller) :
|
SolutionsController::ContentView::ContentView(SolutionsController * controller) :
|
||||||
m_warningMessageView0(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, KDColorBlack, k_backgroundColor),
|
m_warningMessageView0(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, KDColorBlack, *k_backgroundColor),
|
||||||
m_warningMessageView1(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, KDColorBlack, k_backgroundColor),
|
m_warningMessageView1(KDFont::SmallFont, I18n::Message::Default, 0.5f, 0.5f, KDColorBlack, *k_backgroundColor),
|
||||||
m_selectableTableView(controller, controller, controller, controller),
|
m_selectableTableView(controller, controller, controller, controller),
|
||||||
m_displayWarningMoreSolutions(false)
|
m_displayWarningMoreSolutions(false)
|
||||||
{
|
{
|
||||||
m_selectableTableView.setBackgroundColor(k_backgroundColor);
|
m_selectableTableView.setBackgroundColor(*k_backgroundColor);
|
||||||
m_selectableTableView.setVerticalCellOverlap(0);
|
m_selectableTableView.setVerticalCellOverlap(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SolutionsController::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
void SolutionsController::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
if (m_displayWarningMoreSolutions) {
|
if (m_displayWarningMoreSolutions) {
|
||||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_topMargin), k_backgroundColor);
|
ctx->fillRect(KDRect(0, 0, bounds().width(), k_topMargin), *k_backgroundColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ private:
|
|||||||
class ContentView : public View {
|
class ContentView : public View {
|
||||||
public:
|
public:
|
||||||
constexpr static KDCoordinate k_topMargin = 50;
|
constexpr static KDCoordinate k_topMargin = 50;
|
||||||
constexpr static KDColor k_backgroundColor = Palette::BackgroundAppsSecondary;
|
static KDColor const * k_backgroundColor;
|
||||||
ContentView(SolutionsController * controller);
|
ContentView(SolutionsController * controller);
|
||||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||||
void setWarning(bool warning);
|
void setWarning(bool warning);
|
||||||
@@ -61,7 +61,7 @@ private:
|
|||||||
|
|
||||||
class MessageCell : public HighlightCell {
|
class MessageCell : public HighlightCell {
|
||||||
public:
|
public:
|
||||||
MessageCell() : m_messageView(KDFont::SmallFont, (I18n::Message)0, 0.0f, k_verticalAlignment, KDColorBlack, SolutionsController::ContentView::k_backgroundColor) {}
|
MessageCell() : m_messageView(KDFont::SmallFont, (I18n::Message)0, 0.0f, k_verticalAlignment, KDColorBlack, *SolutionsController::ContentView::k_backgroundColor) {}
|
||||||
void setBackgroundColor(KDColor color) { m_messageView.setBackgroundColor(color); }
|
void setBackgroundColor(KDColor color) { m_messageView.setBackgroundColor(color); }
|
||||||
void setHorizontalAlignment(float alignment) { m_messageView.setAlignment(alignment, k_verticalAlignment); }
|
void setHorizontalAlignment(float alignment) { m_messageView.setAlignment(alignment, k_verticalAlignment); }
|
||||||
void setMessage(I18n::Message message) { m_messageView.setMessage(message); }
|
void setMessage(I18n::Message message) { m_messageView.setMessage(message); }
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ using namespace Shared;
|
|||||||
namespace Statistics {
|
namespace Statistics {
|
||||||
|
|
||||||
void BoxAxisView::drawRect(KDContext * ctx, KDRect rect) const {
|
void BoxAxisView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||||
ctx->fillRect(rect, Palette::BackgroundHard);
|
ctx->fillRect(rect, *Palette::BackgroundHard);
|
||||||
KDRect lineRect = KDRect(0, k_axisMargin, bounds().width(), 1);
|
KDRect lineRect = KDRect(0, k_axisMargin, bounds().width(), 1);
|
||||||
ctx->fillRect(lineRect, Palette::PrimaryText);
|
ctx->fillRect(lineRect, *Palette::PrimaryText);
|
||||||
drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, false, true, k_axisMargin);
|
drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, false, true, k_axisMargin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user