mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 08:47:28 +01:00
Compare commits
9 Commits
upsilon-de
...
upsilon-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51fd990c31 | ||
|
|
7af2b45f1d | ||
|
|
d95785ba42 | ||
|
|
d108b76a32 | ||
|
|
a3d3cbbfa5 | ||
|
|
3a41cbdc85 | ||
|
|
3ccfdf0365 | ||
|
|
6aad7d2279 | ||
|
|
5c1f192228 |
@@ -66,8 +66,8 @@ private:
|
||||
bool updateAlphaLock();
|
||||
|
||||
static I18n::Message k_promptMessages[];
|
||||
static KDColor const * k_promptFGColors[];
|
||||
static KDColor const * k_promptBGColors[];
|
||||
static KDColor k_promptFGColors[];
|
||||
static KDColor k_promptBGColors[];
|
||||
static int k_promptNumberOfMessages;
|
||||
AppsWindow m_window;
|
||||
EmptyBatteryWindow m_emptyBatteryWindow;
|
||||
|
||||
@@ -11,14 +11,14 @@ I18n::Message AppsContainer::k_promptMessages[] = {
|
||||
I18n::Message::BetaVersionMessage6};
|
||||
|
||||
KDColor AppsContainer::k_promptFGColors[] = {
|
||||
&KDColorBlack,
|
||||
&KDColorBlack,
|
||||
&KDColorBlack,
|
||||
&KDColorBlack,
|
||||
&KDColorWhite,
|
||||
&KDColorBlack,
|
||||
&KDColorBlack,
|
||||
*Palette::AccentText};
|
||||
KDColorBlack,
|
||||
KDColorBlack,
|
||||
KDColorBlack,
|
||||
KDColorBlack,
|
||||
KDColorWhite,
|
||||
KDColorBlack,
|
||||
KDColorBlack,
|
||||
Palette::AccentText};
|
||||
|
||||
KDColor AppsContainer::k_promptBGColors[] = {
|
||||
KDColorWhite,
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
I18n::Message AppsContainer::k_promptMessages[] = {};
|
||||
|
||||
KDColor const * AppsContainer::k_promptFGColors[] = {};
|
||||
KDColor const * AppsContainer::k_promptBGColors[] = {};
|
||||
KDColor AppsContainer::k_promptFGColors[] = {};
|
||||
KDColor AppsContainer::k_promptBGColors[] = {};
|
||||
|
||||
int AppsContainer::k_promptNumberOfMessages = 0;
|
||||
|
||||
|
||||
@@ -8,15 +8,15 @@ I18n::Message AppsContainer::k_promptMessages[] = {
|
||||
I18n::Message::UpdateMessage3,
|
||||
I18n::Message::UpdateMessage4};
|
||||
|
||||
KDColor const * AppsContainer::k_promptFGColors[] = {
|
||||
&KDColorBlack,
|
||||
&KDColorBlack,
|
||||
&KDColorBlack,
|
||||
&KDColorWhite,
|
||||
&KDColorBlack,
|
||||
*Palette::AccentText};
|
||||
KDColor AppsContainer::k_promptFGColors[] = {
|
||||
KDColorBlack,
|
||||
KDColorBlack,
|
||||
KDColorBlack,
|
||||
KDColorWhite,
|
||||
KDColorBlack,
|
||||
Palette::AccentText};
|
||||
|
||||
KDColor const * AppsContainer::k_promptBGColors[] = {
|
||||
KDColor AppsContainer::k_promptBGColors[] = {
|
||||
KDColorWhite,
|
||||
KDColorWhite,
|
||||
KDColorWhite,
|
||||
|
||||
Submodule apps/atomic updated: ffafaaf311...69f7a06ba5
@@ -60,43 +60,43 @@ void BatteryView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
*'content' depends on the charge */
|
||||
|
||||
// Draw the left part
|
||||
ctx->fillRect(KDRect(0, 0, k_elementWidth, k_batteryHeight), *Palette::Battery);
|
||||
ctx->fillRect(KDRect(0, 0, k_elementWidth, k_batteryHeight), Palette::Battery);
|
||||
|
||||
// Draw the middle part
|
||||
constexpr KDCoordinate batteryInsideX = k_elementWidth+k_separatorThickness;
|
||||
constexpr KDCoordinate batteryInsideWidth = k_batteryWidth-3*k_elementWidth-2*k_separatorThickness;
|
||||
if (m_isCharging) {
|
||||
// Charging: Yellow background with flash
|
||||
ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), *Palette::BatteryInCharge);
|
||||
ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), Palette::BatteryInCharge);
|
||||
KDRect frame((k_batteryWidth-k_flashWidth)/2, 0, k_flashWidth, k_flashHeight);
|
||||
KDColor flashWorkingBuffer[BatteryView::k_flashHeight*BatteryView::k_flashWidth];
|
||||
ctx->blendRectWithMask(frame, *Palette::Battery, (const uint8_t *)flashMask, flashWorkingBuffer);
|
||||
ctx->blendRectWithMask(frame, Palette::Battery, (const uint8_t *)flashMask, flashWorkingBuffer);
|
||||
} else if (m_chargeState == Ion::Battery::Charge::LOW) {
|
||||
assert(!m_isPlugged);
|
||||
// Low: Quite empty battery
|
||||
ctx->fillRect(KDRect(batteryInsideX, 0, 2*k_elementWidth, k_batteryHeight), *Palette::BatteryLow);
|
||||
ctx->fillRect(KDRect(3*k_elementWidth+k_separatorThickness, 0, k_batteryWidth-5*k_elementWidth-2*k_separatorThickness, k_batteryHeight), KDColor::blend(*Palette::Toolbar, *Palette::Battery, 128));
|
||||
ctx->fillRect(KDRect(batteryInsideX, 0, 2*k_elementWidth, k_batteryHeight), Palette::BatteryLow);
|
||||
ctx->fillRect(KDRect(3*k_elementWidth+k_separatorThickness, 0, k_batteryWidth-5*k_elementWidth-2*k_separatorThickness, k_batteryHeight), KDColor::blend(Palette::Toolbar, Palette::Battery, 128));
|
||||
} else if (m_chargeState == Ion::Battery::Charge::SOMEWHERE_INBETWEEN) {
|
||||
assert(!m_isPlugged);
|
||||
// Middle: Half full battery
|
||||
constexpr KDCoordinate middleChargeWidth = batteryInsideWidth/2;
|
||||
ctx->fillRect(KDRect(batteryInsideX, 0, middleChargeWidth, k_batteryHeight), *Palette::Battery);
|
||||
ctx->fillRect(KDRect(batteryInsideX+middleChargeWidth, 0, middleChargeWidth, k_batteryHeight), KDColor::blend(*Palette::Toolbar, *Palette::Battery, 128));
|
||||
ctx->fillRect(KDRect(batteryInsideX, 0, middleChargeWidth, k_batteryHeight), Palette::Battery);
|
||||
ctx->fillRect(KDRect(batteryInsideX+middleChargeWidth, 0, middleChargeWidth, k_batteryHeight), KDColor::blend(Palette::Toolbar, Palette::Battery, 128));
|
||||
} else {
|
||||
assert(m_chargeState == Ion::Battery::Charge::FULL);
|
||||
// Full but not plugged: Full battery
|
||||
ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), *Palette::Battery);
|
||||
ctx->fillRect(KDRect(batteryInsideX, 0, batteryInsideWidth, k_batteryHeight), Palette::Battery);
|
||||
if (m_isPlugged) {
|
||||
// Plugged and full: Full battery with tick
|
||||
KDRect frame((k_batteryWidth-k_tickWidth)/2, (k_batteryHeight-k_tickHeight)/2, k_tickWidth, k_tickHeight);
|
||||
KDColor tickWorkingBuffer[BatteryView::k_tickHeight*BatteryView::k_tickWidth];
|
||||
ctx->blendRectWithMask(frame, *Palette::Toolbar, (const uint8_t *)tickMask, tickWorkingBuffer);
|
||||
ctx->blendRectWithMask(frame, Palette::Toolbar, (const uint8_t *)tickMask, tickWorkingBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw the right part
|
||||
ctx->fillRect(KDRect(k_batteryWidth-2*k_elementWidth, 0, k_elementWidth, k_batteryHeight), *Palette::Battery);
|
||||
ctx->fillRect(KDRect(k_batteryWidth-k_elementWidth, (k_batteryHeight-k_capHeight)/2, k_elementWidth, k_capHeight), *Palette::Battery);
|
||||
ctx->fillRect(KDRect(k_batteryWidth-2*k_elementWidth, 0, k_elementWidth, k_batteryHeight), Palette::Battery);
|
||||
ctx->fillRect(KDRect(k_batteryWidth-k_elementWidth, (k_batteryHeight-k_capHeight)/2, k_elementWidth, k_capHeight), Palette::Battery);
|
||||
}
|
||||
|
||||
KDSize BatteryView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -13,7 +13,7 @@ ComplexGraphView::ComplexGraphView(ComplexModel * complexModel) :
|
||||
}
|
||||
|
||||
void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(rect, *Palette::BackgroundApps);
|
||||
ctx->fillRect(rect, Palette::BackgroundApps);
|
||||
|
||||
// Draw grid, axes and graduations
|
||||
drawGrid(ctx, rect);
|
||||
@@ -26,7 +26,7 @@ void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
|
||||
assert(!std::isnan(real) && !std::isnan(imag) && !std::isinf(real) && !std::isinf(imag));
|
||||
// Draw the segment from the origin to the dot (real, imag)
|
||||
drawSegment(ctx, rect, 0.0f, 0.0f, m_complex->real(), m_complex->imag(), *Palette::SecondaryText, false);
|
||||
drawSegment(ctx, rect, 0.0f, 0.0f, m_complex->real(), m_complex->imag(), Palette::SecondaryText, false);
|
||||
|
||||
/* Draw the partial ellipse indicating the angle θ
|
||||
* - the ellipse parameters are a = |real|/5 and b = |imag|/5,
|
||||
@@ -59,27 +59,27 @@ void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
float a = parameters.real();
|
||||
float b = parameters.imag();
|
||||
return Poincare::Coordinate2D<float>(a*std::cos(t*th), b*std::sin(t*th));
|
||||
}, ¶meters, &th, false, *Palette::SecondaryText, false);
|
||||
}, ¶meters, &th, false, Palette::SecondaryText, false);
|
||||
|
||||
// Draw dashed segment to indicate real and imaginary
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, real, 0.0f, imag, *Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, imag, 0.0f, real, *Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, real, 0.0f, imag, Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, imag, 0.0f, real, Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||
|
||||
// Draw complex position on the plan
|
||||
drawDot(ctx, rect, real, imag, *Palette::CalculationTrigoAndComplexForeground, Size::Large);
|
||||
drawDot(ctx, rect, real, imag, Palette::CalculationTrigoAndComplexForeground, Size::Large);
|
||||
|
||||
// Draw labels
|
||||
// 're(z)' label
|
||||
drawLabel(ctx, rect, real, 0.0f, "re(z)", *Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, imag >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After);
|
||||
drawLabel(ctx, rect, real, 0.0f, "re(z)", Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, imag >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After);
|
||||
// 'im(z)' label
|
||||
drawLabel(ctx, rect, 0.0f, imag, "im(z)", *Palette::CalculationTrigoAndComplexForeground, real >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None);
|
||||
drawLabel(ctx, rect, 0.0f, imag, "im(z)", Palette::CalculationTrigoAndComplexForeground, real >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None);
|
||||
// '|z|' label, the relative horizontal position of this label depends on the quadrant
|
||||
CurveView::RelativePosition verticalPosition = real*imag < 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After;
|
||||
if (real == 0.0f) {
|
||||
// Edge case: pure imaginary
|
||||
verticalPosition = CurveView::RelativePosition::None;
|
||||
}
|
||||
drawLabel(ctx, rect, real/2.0f, imag/2.0f, "|z|", *Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, verticalPosition);
|
||||
drawLabel(ctx, rect, real/2.0f, imag/2.0f, "|z|", Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, verticalPosition);
|
||||
// 'arg(z)' label, the absolute and relative horizontal/vertical positions of this label depends on the quadrant
|
||||
CurveView::RelativePosition horizontalPosition = real >= 0.0f ? CurveView::RelativePosition::After : CurveView::RelativePosition::None;
|
||||
verticalPosition = imag >= 0.0f ? CurveView::RelativePosition::After : CurveView::RelativePosition::Before;
|
||||
@@ -88,7 +88,7 @@ void ComplexGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
* and for the left half plan, we position the label at the half angle. The
|
||||
* relative position is chosen accordingly. */
|
||||
float anglePositionRatio = real >= 0.0f ? 0.0f : 0.5f;
|
||||
drawLabel(ctx, rect, a*std::cos(anglePositionRatio*th), b*std::sin(anglePositionRatio*th), "arg(z)", *Palette::CalculationTrigoAndComplexForeground, horizontalPosition, verticalPosition);
|
||||
drawLabel(ctx, rect, a*std::cos(anglePositionRatio*th), b*std::sin(anglePositionRatio*th), "arg(z)", Palette::CalculationTrigoAndComplexForeground, horizontalPosition, verticalPosition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ void ExpressionWithEqualSignView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
// Do not color the whole background to avoid coloring behind the equal symbol
|
||||
KDSize expressionSize = ExpressionView::minimalSizeForOptimalDisplay();
|
||||
ctx->fillRect(KDRect(0, 0, expressionSize), m_backgroundColor);
|
||||
m_layout.draw(ctx, drawingOrigin(), m_textColor, m_backgroundColor, m_selectionStart, m_selectionEnd, *Palette::Select);
|
||||
m_layout.draw(ctx, drawingOrigin(), m_textColor, m_backgroundColor, m_selectionStart, m_selectionEnd, Palette::Select);
|
||||
}
|
||||
|
||||
View * ExpressionWithEqualSignView::subviewAtIndex(int index) {
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Calculation {
|
||||
class ExpressionWithEqualSignView : public ExpressionView {
|
||||
public:
|
||||
ExpressionWithEqualSignView() :
|
||||
m_equalSign(KDFont::LargeFont, I18n::Message::Equal, 0.5f, 0.5f, *Palette::PrimaryText)
|
||||
m_equalSign(KDFont::LargeFont, I18n::Message::Equal, 0.5f, 0.5f, Palette::PrimaryText)
|
||||
{}
|
||||
KDSize minimalSizeForOptimalDisplay() const override;
|
||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||
|
||||
@@ -10,7 +10,7 @@ void IllustrationCell::layoutSubviews(bool force) {
|
||||
}
|
||||
|
||||
void IllustrationCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
drawBorderOfRect(ctx, bounds(), *Palette::ListCellBorder);
|
||||
drawBorderOfRect(ctx, bounds(), Palette::ListCellBorder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ void ListController::InnerListController::didBecomeFirstResponder() {
|
||||
/* List Controller */
|
||||
|
||||
ListController::ListController(EditExpressionController * editExpressionController, SelectableTableViewDelegate * delegate) :
|
||||
StackViewController(nullptr, &m_listController, *Palette::ToolboxHeaderText, *Palette::ToolboxHeaderBackground, *Palette::ToolboxHeaderBorder),
|
||||
StackViewController(nullptr, &m_listController, Palette::ToolboxHeaderText, Palette::ToolboxHeaderBackground, Palette::ToolboxHeaderBorder),
|
||||
m_listController(this, delegate),
|
||||
m_editExpressionController(editExpressionController)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ public:
|
||||
static constexpr KDCoordinate k_margin = Metric::CommonSmallMargin;
|
||||
ScrollableThreeExpressionsView(Responder * parentResponder) : Shared::AbstractScrollableMultipleExpressionsView(parentResponder, &m_contentCell), m_contentCell() {
|
||||
setMargins(k_margin, k_margin, k_margin, k_margin); // Left Right margins are already added by TableCell
|
||||
setBackgroundColor(*Palette::BackgroundApps);
|
||||
setBackgroundColor(Palette::BackgroundApps);
|
||||
}
|
||||
void resetMemoization();
|
||||
void setCalculation(Calculation * calculation, bool canChangeDisplayOutput);
|
||||
@@ -28,7 +28,7 @@ private:
|
||||
class ContentCell : public Shared::AbstractScrollableMultipleExpressionsView::ContentCell {
|
||||
public:
|
||||
ContentCell() : m_leftExpressionView() {}
|
||||
KDColor backgroundColor() const override { return *Palette::BackgroundApps; }
|
||||
KDColor backgroundColor() const override { return Palette::BackgroundApps; }
|
||||
void setEven(bool even) override { return; }
|
||||
ExpressionView * leftExpressionView() const override { return const_cast<ExpressionWithEqualSignView *>(&m_leftExpressionView); }
|
||||
private:
|
||||
|
||||
@@ -15,24 +15,24 @@ TrigonometryGraphView::TrigonometryGraphView(TrigonometryModel * model) :
|
||||
void TrigonometryGraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
float s = std::sin(m_model->angle());
|
||||
float c = std::cos(m_model->angle());
|
||||
ctx->fillRect(rect, *Palette::BackgroundApps);
|
||||
ctx->fillRect(rect, Palette::BackgroundApps);
|
||||
drawGrid(ctx, rect);
|
||||
drawAxes(ctx, rect);
|
||||
// Draw the circle
|
||||
drawCurve(ctx, rect, 0.0f, 2.0f*M_PI, M_PI/180.0f, [](float t, void * model, void * context) {
|
||||
return Poincare::Coordinate2D<float>(std::cos(t), std::sin(t));
|
||||
}, nullptr, nullptr, true, *Palette::SecondaryText, false);
|
||||
}, nullptr, nullptr, true, Palette::SecondaryText, false);
|
||||
// Draw dashed segment to indicate sine and cosine
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, c, 0.0f, s, *Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, s, 0.0f, c, *Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, c, 0.0f, s, Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Horizontal, s, 0.0f, c, Palette::CalculationTrigoAndComplexForeground, 1, 3);
|
||||
// Draw angle position on the circle
|
||||
drawDot(ctx, rect, c, s, *Palette::CalculationTrigoAndComplexForeground, Size::Large);
|
||||
drawDot(ctx, rect, c, s, Palette::CalculationTrigoAndComplexForeground, Size::Large);
|
||||
// Draw graduations
|
||||
drawLabelsAndGraduations(ctx, rect, Axis::Vertical, false, true);
|
||||
drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, true);
|
||||
// Draw labels
|
||||
drawLabel(ctx, rect, 0.0f, s, "sin(θ)", *Palette::CalculationTrigoAndComplexForeground, c >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None);
|
||||
drawLabel(ctx, rect, c, 0.0f, "cos(θ)", *Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, s >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After);
|
||||
drawLabel(ctx, rect, 0.0f, s, "sin(θ)", Palette::CalculationTrigoAndComplexForeground, c >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After, CurveView::RelativePosition::None);
|
||||
drawLabel(ctx, rect, c, 0.0f, "cos(θ)", Palette::CalculationTrigoAndComplexForeground, CurveView::RelativePosition::None, s >= 0.0f ? CurveView::RelativePosition::Before : CurveView::RelativePosition::After);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ void HistoryViewCell::reloadSubviewHighlight() {
|
||||
m_ellipsis.setHighlighted(false);
|
||||
if (isHighlighted()) {
|
||||
if (m_dataSource->selectedSubviewType() == HistoryViewCellDataSource::SubviewType::Input) {
|
||||
m_inputView.setExpressionBackgroundColor(*Palette::Select);
|
||||
m_inputView.setExpressionBackgroundColor(Palette::Select);
|
||||
} else if (m_dataSource->selectedSubviewType() == HistoryViewCellDataSource::SubviewType::Output) {
|
||||
m_scrollableOutputView.evenOddCell()->setHighlighted(true);
|
||||
} else {
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
return this;
|
||||
}
|
||||
Poincare::Layout layout() const override;
|
||||
KDColor backgroundColor() const override { return m_even ? *Palette::CalculationBackgroundEven : *Palette::CalculationBackgroundOdd; }
|
||||
KDColor backgroundColor() const override { return m_even ? Palette::CalculationBackgroundEven : Palette::CalculationBackgroundOdd; }
|
||||
void resetMemoization();
|
||||
void setCalculation(Calculation * calculation, bool expanded, bool canChangeDisplayOutput = false);
|
||||
int numberOfSubviews() const override { return 2 + displayedEllipsis(); }
|
||||
|
||||
@@ -40,7 +40,7 @@ ConsoleController::ConsoleController(Responder * parentResponder, App * pythonDe
|
||||
#endif
|
||||
{
|
||||
m_selectableTableView.setMargins(0, Metric::CommonRightMargin, 0, Metric::TitleBarExternHorizontalMargin);
|
||||
m_selectableTableView.setBackgroundColor(*Palette::CodeBackground);
|
||||
m_selectableTableView.setBackgroundColor(Palette::CodeBackground);
|
||||
m_editCell.setPrompt(sStandardPromptText);
|
||||
for (int i = 0; i < k_numberOfLineCells; i++) {
|
||||
m_cells[i].setParentResponder(&m_selectableTableView);
|
||||
|
||||
@@ -18,8 +18,8 @@ void ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::setLine(Consol
|
||||
}
|
||||
|
||||
void ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), *Palette::CodeBackground);
|
||||
ctx->drawString(m_line->text(), KDPointZero, GlobalPreferences::sharedGlobalPreferences()->font(), textColor(m_line), isHighlighted()? *Palette::Select : *Palette::BackgroundApps);
|
||||
ctx->fillRect(bounds(), Palette::CodeBackground);
|
||||
ctx->drawString(m_line->text(), KDPointZero, GlobalPreferences::sharedGlobalPreferences()->font(), textColor(m_line), isHighlighted()? Palette::Select : Palette::BackgroundApps);
|
||||
}
|
||||
|
||||
KDSize ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -53,7 +53,7 @@ private:
|
||||
ConsoleLineView m_consoleLineView;
|
||||
};
|
||||
static KDColor textColor(ConsoleLine * line) {
|
||||
return line->isFromCurrentSession() ? *Palette::CodeText : *Palette::SecondaryText;
|
||||
return line->isFromCurrentSession() ? Palette::CodeText : Palette::SecondaryText;
|
||||
}
|
||||
MessageTextView m_promptView;
|
||||
ScrollableConsoleLineView m_scrollableView;
|
||||
|
||||
@@ -57,8 +57,8 @@ void EditorView::layoutSubviews(bool force) {
|
||||
/* EditorView::GutterView */
|
||||
|
||||
void EditorView::GutterView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor textColor = *Palette::PrimaryText;
|
||||
KDColor backgroundColor = *Palette::CodeGutterViewBackground;
|
||||
KDColor textColor = Palette::PrimaryText;
|
||||
KDColor backgroundColor = Palette::CodeGutterViewBackground;
|
||||
|
||||
ctx->fillRect(rect, backgroundColor);
|
||||
|
||||
|
||||
@@ -14,12 +14,22 @@ extern "C" {
|
||||
|
||||
namespace Code {
|
||||
|
||||
constexpr KDColor CommentColor = Palette::CodeComment;
|
||||
constexpr KDColor NumberColor = Palette::CodeNumber;
|
||||
constexpr KDColor KeywordColor = Palette::CodeKeyword;
|
||||
// constexpr KDColor BuiltinColor = KDColor::RGB24(0x0086B3);
|
||||
constexpr KDColor OperatorColor = Palette::CodeOperator;
|
||||
constexpr KDColor StringColor = Palette::CodeString;
|
||||
constexpr KDColor BackgroundColor = Palette::CodeBackground;
|
||||
constexpr KDColor HighlightColor = Palette::CodeBackgroundSelected;
|
||||
constexpr KDColor AutocompleteColor = KDColor::RGB24(0xC6C6C6); // TODO Palette change
|
||||
|
||||
static inline KDColor TokenColor(mp_token_kind_t tokenKind) {
|
||||
if (tokenKind == MP_TOKEN_STRING) {
|
||||
return *Palette::CodeString;
|
||||
return StringColor;
|
||||
}
|
||||
if (tokenKind == MP_TOKEN_INTEGER || tokenKind == MP_TOKEN_FLOAT_OR_IMAG) {
|
||||
return *Palette::CodeNumber;
|
||||
return NumberColor;
|
||||
}
|
||||
static_assert(MP_TOKEN_ELLIPSIS + 1 == MP_TOKEN_KW_FALSE
|
||||
&& MP_TOKEN_KW_FALSE + 1 == MP_TOKEN_KW_NONE
|
||||
@@ -59,7 +69,7 @@ static inline KDColor TokenColor(mp_token_kind_t tokenKind) {
|
||||
&& MP_TOKEN_KW_YIELD + 1 == MP_TOKEN_OP_TILDE,
|
||||
"MP_TOKEN order changed, so Code::PythonTextArea::TokenColor might need to change too.");
|
||||
if (tokenKind >= MP_TOKEN_KW_FALSE && tokenKind <= MP_TOKEN_KW_YIELD) {
|
||||
return *Palette::CodeKeyword;
|
||||
return KeywordColor;
|
||||
}
|
||||
static_assert(MP_TOKEN_OP_TILDE + 1 == MP_TOKEN_OP_LESS
|
||||
&& MP_TOKEN_OP_LESS + 1 == MP_TOKEN_OP_MORE
|
||||
@@ -111,9 +121,9 @@ static inline KDColor TokenColor(mp_token_kind_t tokenKind) {
|
||||
|| tokenKind == MP_TOKEN_DEL_EQUAL
|
||||
|| tokenKind == MP_TOKEN_DEL_MINUS_MORE)
|
||||
{
|
||||
return *Palette::CodeOperator;
|
||||
return OperatorColor;
|
||||
}
|
||||
return *Palette::CodeText;
|
||||
return Palette::CodeText;
|
||||
}
|
||||
|
||||
static inline size_t TokenLength(mp_lexer_t * lex, const char * tokenPosition) {
|
||||
@@ -206,7 +216,7 @@ void PythonTextArea::ContentView::unloadSyntaxHighlighter() {
|
||||
}
|
||||
|
||||
void PythonTextArea::ContentView::clearRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(rect, *Palette::CodeBackground);
|
||||
ctx->fillRect(rect, BackgroundColor);
|
||||
}
|
||||
|
||||
#define LOG_DRAWING 0
|
||||
@@ -236,11 +246,11 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
||||
fromColumn,
|
||||
spacesStart,
|
||||
std::min(text + byteLength, firstNonSpace) - spacesStart,
|
||||
*Palette::CodeString,
|
||||
*Palette::CodeBackground,
|
||||
StringColor,
|
||||
BackgroundColor,
|
||||
selectionStart,
|
||||
selectionEnd,
|
||||
*Palette::CodeBackgroundSelected);
|
||||
HighlightColor);
|
||||
}
|
||||
if (UTF8Helper::CodePointIs(firstNonSpace, UCodePointNull)) {
|
||||
return;
|
||||
@@ -266,17 +276,17 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
||||
UTF8Helper::GlyphOffsetAtCodePoint(text, tokenEnd),
|
||||
tokenEnd,
|
||||
std::min(text + byteLength, tokenFrom) - tokenEnd,
|
||||
*Palette::CodeString,
|
||||
*Palette::CodeBackground,
|
||||
StringColor,
|
||||
BackgroundColor,
|
||||
selectionStart,
|
||||
selectionEnd,
|
||||
*Palette::CodeBackgroundSelected);
|
||||
HighlightColor);
|
||||
}
|
||||
tokenLength = TokenLength(lex, tokenFrom);
|
||||
tokenEnd = tokenFrom + tokenLength;
|
||||
|
||||
// If the token is being autocompleted, use DefaultColor
|
||||
KDColor color = (tokenFrom <= autocompleteStart && autocompleteStart < tokenEnd) ? *Palette::CodeText : TokenColor(lex->tok_kind);
|
||||
KDColor color = (tokenFrom <= autocompleteStart && autocompleteStart < tokenEnd) ? Palette::CodeText : TokenColor(lex->tok_kind);
|
||||
|
||||
LOG_DRAW("Draw \"%.*s\" for token %d\n", tokenLength, tokenFrom, lex->tok_kind);
|
||||
drawStringAt(ctx, line,
|
||||
@@ -284,10 +294,10 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
||||
tokenFrom,
|
||||
tokenLength,
|
||||
color,
|
||||
*Palette::CodeBackground,
|
||||
BackgroundColor,
|
||||
selectionStart,
|
||||
selectionEnd,
|
||||
*Palette::CodeBackgroundSelected);
|
||||
HighlightColor);
|
||||
|
||||
mp_lexer_to_next(lex);
|
||||
LOG_DRAW("Pop token %d\n", lex->tok_kind);
|
||||
@@ -295,18 +305,18 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
||||
|
||||
tokenFrom += tokenLength;
|
||||
|
||||
// Even if the token is being autocompleted, use *Palette::CodeComment
|
||||
// Even if the token is being autocompleted, use CommentColor
|
||||
if (tokenFrom < text + byteLength) {
|
||||
LOG_DRAW("Draw comment \"%.*s\" from %d\n", byteLength - (tokenFrom - text), firstNonSpace, tokenFrom);
|
||||
drawStringAt(ctx, line,
|
||||
UTF8Helper::GlyphOffsetAtCodePoint(text, tokenFrom),
|
||||
tokenFrom,
|
||||
text + byteLength - tokenFrom,
|
||||
*Palette::CodeComment,
|
||||
*Palette::CodeBackground,
|
||||
CommentColor,
|
||||
BackgroundColor,
|
||||
selectionStart,
|
||||
selectionEnd,
|
||||
*Palette::CodeBackgroundSelected);
|
||||
HighlightColor);
|
||||
}
|
||||
|
||||
mp_lexer_free(lex);
|
||||
@@ -322,11 +332,11 @@ void PythonTextArea::ContentView::drawLine(KDContext * ctx, int line, const char
|
||||
UTF8Helper::GlyphOffsetAtCodePoint(text, autocompleteStart),
|
||||
autocompleteStart,
|
||||
std::min(text + byteLength, m_autocompletionEnd) - autocompleteStart,
|
||||
KDColor::RGB24(0xC6C6C6),
|
||||
*Palette::CodeBackground,
|
||||
AutocompleteColor,
|
||||
BackgroundColor,
|
||||
nullptr,
|
||||
nullptr,
|
||||
*Palette::CodeBackgroundSelected);
|
||||
HighlightColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Code {
|
||||
|
||||
SandboxController::SandboxController(Responder * 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[];
|
||||
|
||||
void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
const KDColor backgroundColor = isHighlighted()? *Palette::CodeBackgroundSelected : *Palette::CodeBackground;
|
||||
const KDColor backgroundColor = isHighlighted()? Palette::CodeBackgroundSelected : Palette::CodeBackground;
|
||||
|
||||
// If it exists, draw the description name.
|
||||
const char * descriptionName = m_scriptNode->description();
|
||||
if (descriptionName != nullptr) {
|
||||
ctx->drawString(descriptionName, KDPoint(0, m_frame.height() - k_bottomMargin - k_font->glyphSize().height()), k_font, *Palette::GrayDark, backgroundColor);
|
||||
ctx->drawString(descriptionName, KDPoint(0, m_frame.height() - k_bottomMargin - k_font->glyphSize().height()), k_font, Palette::GrayDark, backgroundColor);
|
||||
}
|
||||
|
||||
// Draw the node name
|
||||
@@ -21,10 +21,10 @@ void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) cons
|
||||
const int nodeNameLength = m_scriptNode->nameLength();
|
||||
KDSize nameSize = k_font->stringSize(nodeName, nodeNameLength);
|
||||
const KDCoordinate nodeNameY = k_topMargin;
|
||||
ctx->drawString(nodeName, KDPoint(0, nodeNameY), k_font, *Palette::PrimaryText, backgroundColor, nodeNameLength);
|
||||
ctx->drawString(nodeName, KDPoint(0, nodeNameY), k_font, Palette::PrimaryText, backgroundColor, nodeNameLength);
|
||||
// If it is needed, draw the parentheses
|
||||
if (m_scriptNode->type() == ScriptNode::Type::WithParentheses) {
|
||||
ctx->drawString(ScriptNodeCell::k_parentheses, KDPoint(nameSize.width(), nodeNameY), k_font, *Palette::PrimaryText, backgroundColor);
|
||||
ctx->drawString(ScriptNodeCell::k_parentheses, KDPoint(nameSize.width(), nodeNameY), k_font, Palette::PrimaryText, backgroundColor);
|
||||
}
|
||||
|
||||
/* If it exists, draw the source name. If it did not fit, we would have put
|
||||
@@ -32,7 +32,7 @@ void ScriptNodeCell::ScriptNodeView::drawRect(KDContext * ctx, KDRect rect) cons
|
||||
const char * sourceName = m_scriptNode->nodeSourceName();
|
||||
if (sourceName != nullptr) {
|
||||
KDSize sourceNameSize = k_font->stringSize(sourceName);
|
||||
ctx->drawString(sourceName, KDPoint(m_frame.width() - sourceNameSize.width(), nodeNameY), k_font, *Palette::CodeText, backgroundColor);
|
||||
ctx->drawString(sourceName, KDPoint(m_frame.width() - sourceNameSize.width(), nodeNameY), k_font, Palette::CodeText, backgroundColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ void ScriptParameterController::willDisplayCellForIndex(HighlightCell * cell, in
|
||||
MessageTableCellWithBuffer * myCell = (MessageTableCellWithBuffer *)cell;
|
||||
GetScriptSize(myCell);
|
||||
myCell->setAccessoryFont(KDFont::SmallFont);
|
||||
myCell->setAccessoryTextColor(*Palette::SecondaryText);
|
||||
myCell->setAccessoryTextColor(Palette::SecondaryText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,9 +37,9 @@ namespace Code {
|
||||
}
|
||||
|
||||
void toolboxIonKeys::toolboxIonView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(rect, *Palette::WallScreen);
|
||||
ctx->strokeRect(rect, *Palette::ListCellBorder);
|
||||
ctx->drawString(I18n::translate(I18n::Message::PressAKey),KDPoint(rect.left()+80, rect.top()+20),KDFont::LargeFont,*Palette::PrimaryText,*Palette::WallScreen);
|
||||
ctx->fillRect(rect, Palette::WallScreen);
|
||||
ctx->strokeRect(rect, Palette::ListCellBorder);
|
||||
ctx->drawString(I18n::translate(I18n::Message::PressAKey),KDPoint(rect.left()+80, rect.top()+20),KDFont::LargeFont,Palette::PrimaryText,Palette::WallScreen);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ VariableBoxController::VariableBoxController(ScriptStore * scriptStore) :
|
||||
m_importedNodesCount(0)
|
||||
{
|
||||
for (int i = 0; i < k_scriptOriginsCount; i++) {
|
||||
m_subtitleCells[i].setBackgroundColor(*Palette::WallScreen);
|
||||
m_subtitleCells[i].setTextColor(*Palette::SecondaryText);
|
||||
m_subtitleCells[i].setBackgroundColor(Palette::WallScreen);
|
||||
m_subtitleCells[i].setTextColor(Palette::SecondaryText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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(index == 0){
|
||||
myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible));
|
||||
myTextCell->setTextColor(*Palette::Red);
|
||||
myTextCell->setTextColor(Palette::Red);
|
||||
} else {
|
||||
myTextCell->setText(I18n::translate(I18n::Message::WithN0100));
|
||||
myTextCell->setTextColor(*Palette::Red);
|
||||
myTextCell->setTextColor(Palette::Red);
|
||||
}
|
||||
#else
|
||||
if(index == k_numberOfCells-1){
|
||||
myTextCell->setText(I18n::translate(I18n::Message::URL));
|
||||
myTextCell->setTextColor(*Palette::AccentText);
|
||||
myTextCell->setTextColor(Palette::AccentText);
|
||||
return;
|
||||
}
|
||||
if(index == k_numberOfCells-2){
|
||||
myTextCell->setText(I18n::translate(I18n::Message::GetMoreAppsAt));
|
||||
myTextCell->setTextColor(*Palette::AccentText);
|
||||
myTextCell->setTextColor(Palette::AccentText);
|
||||
return;
|
||||
}
|
||||
if(index == 0 && numberOfFiles() == 0){
|
||||
myTextCell->setText(I18n::translate(I18n::Message::NoAppsInstalled));
|
||||
myTextCell->setTextColor(*Palette::Red);
|
||||
myTextCell->setTextColor(Palette::Red);
|
||||
}
|
||||
if(numberOfFiles() > 0){
|
||||
if(fileAtIndex(index, f)) {
|
||||
myTextCell->setText(f.name);
|
||||
myTextCell->setTextColor(f.isExecutable ? *Palette::PrimaryText : *Palette::Palette::SecondaryText);
|
||||
myTextCell->setTextColor(f.isExecutable ? Palette::PrimaryText : Palette::Palette::SecondaryText);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
if(index == 0){
|
||||
myTextCell->setText(I18n::translate(I18n::Message::ExternalNotCompatible));
|
||||
myTextCell->setTextColor(*Palette::Red);
|
||||
myTextCell->setTextColor(Palette::Red);
|
||||
} else {
|
||||
myTextCell->setText(I18n::translate(I18n::Message::WithSimulator));
|
||||
myTextCell->setTextColor(*Palette::Red);
|
||||
myTextCell->setTextColor(Palette::Red);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
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) {
|
||||
HighlightCell::setHighlighted(highlight);
|
||||
KDColor backgroundColor = highlight? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
KDColor backgroundColor = highlight? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
m_pointerTextView.setBackgroundColor(backgroundColor);
|
||||
}
|
||||
|
||||
|
||||
23
apps/geometry/Makefile
Normal file
23
apps/geometry/Makefile
Normal file
@@ -0,0 +1,23 @@
|
||||
apps += Geometry::App
|
||||
app_headers += apps/geometry/app.h
|
||||
|
||||
app_geometry_src = $(addprefix apps/geometry/,\
|
||||
app.cpp \
|
||||
list/figures_controller.cpp \
|
||||
list/definition_type_controller.cpp \
|
||||
list/figure_type_controller.cpp \
|
||||
list/figure_parameters_controller.cpp \
|
||||
list/objects_controller.cpp \
|
||||
list/message_table_cell_with_selector.cpp \
|
||||
figure_store.cpp \
|
||||
graph/graph_controller.cpp \
|
||||
graph/banner_view.cpp \
|
||||
)
|
||||
|
||||
apps_src += $(app_geometry_src)
|
||||
|
||||
app_images += apps/geometry/geometry_icon.png
|
||||
|
||||
i18n_files += $(call i18n_with_universal_for,geometry/base)
|
||||
|
||||
$(eval $(call depends_on_image,apps/geometry/app.cpp,apps/geometry/geometry_icon.png))
|
||||
48
apps/geometry/app.cpp
Normal file
48
apps/geometry/app.cpp
Normal file
@@ -0,0 +1,48 @@
|
||||
#include "app.h"
|
||||
#include "geometry_icon.h"
|
||||
#include "apps/apps_container.h"
|
||||
#include "apps/i18n.h"
|
||||
|
||||
namespace Geometry
|
||||
{
|
||||
|
||||
I18n::Message App::Descriptor::name()
|
||||
{
|
||||
return I18n::Message::GeometryApp;
|
||||
}
|
||||
|
||||
I18n::Message App::Descriptor::upperName()
|
||||
{
|
||||
return I18n::Message::GeometryAppCapital;
|
||||
}
|
||||
|
||||
const Image * App::Descriptor::icon()
|
||||
{
|
||||
return ImageStore::GeometryIcon;
|
||||
}
|
||||
|
||||
App * App::Snapshot::unpack(Container * container)
|
||||
{
|
||||
return new (container->currentAppBuffer()) App(this);
|
||||
}
|
||||
|
||||
App::Descriptor * App::Snapshot::descriptor()
|
||||
{
|
||||
static Descriptor descriptor;
|
||||
return &descriptor;
|
||||
}
|
||||
|
||||
App::App(Snapshot * snapshot) :
|
||||
TextFieldDelegateApp(snapshot, &m_tabViewController),
|
||||
m_figuresController(&m_stackViewController),
|
||||
m_stackViewController(&m_tabViewController, &m_figuresController),
|
||||
m_graphController(&m_graphAlternateEmptyViewController, this, &m_graphHeader, nullptr, nullptr, nullptr),
|
||||
m_graphAlternateEmptyViewController(&m_graphHeader, &m_graphController, &m_graphController),
|
||||
m_graphHeader(&m_graphStackViewController, &m_graphAlternateEmptyViewController, &m_graphController),
|
||||
m_graphStackViewController(&m_tabViewController, &m_graphHeader),
|
||||
m_otherViewController(&m_tabViewController),
|
||||
m_tabViewController(&m_modalViewController, snapshot, &m_stackViewController, &m_graphAlternateEmptyViewController, &m_otherViewController)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
40
apps/geometry/app.h
Normal file
40
apps/geometry/app.h
Normal file
@@ -0,0 +1,40 @@
|
||||
#ifndef GEOMETRY_H
|
||||
#define GEOMETRY_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "list/figures_controller.h"
|
||||
#include "graph/graph_controller.h"
|
||||
#include "other/other_view_controller.h"
|
||||
#include "../shared/text_field_delegate_app.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
class App : public Shared::TextFieldDelegateApp {
|
||||
public:
|
||||
class Descriptor : public ::App::Descriptor {
|
||||
public:
|
||||
I18n::Message name() override;
|
||||
I18n::Message upperName() override;
|
||||
const Image * icon() override;
|
||||
};
|
||||
class Snapshot : public ::App::Snapshot, public TabViewDataSource {
|
||||
public:
|
||||
App * unpack(Container * container) override;
|
||||
Descriptor * descriptor() override;
|
||||
};
|
||||
private:
|
||||
App(Snapshot * snapshot);
|
||||
|
||||
FiguresController m_figuresController;
|
||||
StackViewController m_stackViewController;
|
||||
GraphController m_graphController;
|
||||
AlternateEmptyViewController m_graphAlternateEmptyViewController;
|
||||
StackViewController m_graphStackViewController;
|
||||
ButtonRowController m_graphHeader;
|
||||
OtherViewController m_otherViewController;
|
||||
TabViewController m_tabViewController;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
6
apps/geometry/base.de.i18n
Normal file
6
apps/geometry/base.de.i18n
Normal file
@@ -0,0 +1,6 @@
|
||||
GeometryApp = "Geometry"
|
||||
GeometryAppCapital = "GEOMETRY"
|
||||
AddFigure = "Ajouter une figure"
|
||||
FigureType = "Type de figure"
|
||||
DefinitionType = "Définition de la figure"
|
||||
ParametersChoice = "Choix des paramètres"
|
||||
6
apps/geometry/base.en.i18n
Normal file
6
apps/geometry/base.en.i18n
Normal file
@@ -0,0 +1,6 @@
|
||||
GeometryApp = "Geometry"
|
||||
GeometryAppCapital = "GEOMETRY"
|
||||
AddFigure = "Ajouter une figure"
|
||||
FigureType = "Type de figure"
|
||||
DefinitionType = "Définition de la figure"
|
||||
ParametersChoice = "Choix des paramètres"
|
||||
6
apps/geometry/base.es.i18n
Normal file
6
apps/geometry/base.es.i18n
Normal file
@@ -0,0 +1,6 @@
|
||||
GeometryApp = "Geometry"
|
||||
GeometryAppCapital = "GEOMETRY"
|
||||
AddFigure = "Ajouter une figure"
|
||||
FigureType = "Type de figure"
|
||||
DefinitionType = "Définition de la figure"
|
||||
ParametersChoice = "Choix des paramètres"
|
||||
6
apps/geometry/base.fr.i18n
Normal file
6
apps/geometry/base.fr.i18n
Normal file
@@ -0,0 +1,6 @@
|
||||
GeometryApp = "Geometry"
|
||||
GeometryAppCapital = "GEOMETRY"
|
||||
AddFigure = "Ajouter une figure"
|
||||
FigureType = "Type de figure"
|
||||
DefinitionType = "Définition de la figure"
|
||||
ParametersChoice = "Choix des paramètres"
|
||||
6
apps/geometry/base.hu.i18n
Normal file
6
apps/geometry/base.hu.i18n
Normal file
@@ -0,0 +1,6 @@
|
||||
GeometryApp = "Geometry"
|
||||
GeometryAppCapital = "GEOMETRY"
|
||||
AddFigure = "Ajouter une figure"
|
||||
FigureType = "Type de figure"
|
||||
DefinitionType = "Définition de la figure"
|
||||
ParametersChoice = "Choix des paramètres"
|
||||
6
apps/geometry/base.it.i18n
Normal file
6
apps/geometry/base.it.i18n
Normal file
@@ -0,0 +1,6 @@
|
||||
GeometryApp = "Geometry"
|
||||
GeometryAppCapital = "GEOMETRY"
|
||||
AddFigure = "Ajouter une figure"
|
||||
FigureType = "Type de figure"
|
||||
DefinitionType = "Définition de la figure"
|
||||
ParametersChoice = "Choix des paramètres"
|
||||
6
apps/geometry/base.nl.i18n
Normal file
6
apps/geometry/base.nl.i18n
Normal file
@@ -0,0 +1,6 @@
|
||||
GeometryApp = "Geometry"
|
||||
GeometryAppCapital = "GEOMETRY"
|
||||
AddFigure = "Ajouter une figure"
|
||||
FigureType = "Type de figure"
|
||||
DefinitionType = "Définition de la figure"
|
||||
ParametersChoice = "Choix des paramètres"
|
||||
6
apps/geometry/base.pt.i18n
Normal file
6
apps/geometry/base.pt.i18n
Normal file
@@ -0,0 +1,6 @@
|
||||
GeometryApp = "Geometry"
|
||||
GeometryAppCapital = "GEOMETRY"
|
||||
AddFigure = "Ajouter une figure"
|
||||
FigureType = "Type de figure"
|
||||
DefinitionType = "Définition de la figure"
|
||||
ParametersChoice = "Choix des paramètres"
|
||||
24
apps/geometry/base.universal.i18n
Normal file
24
apps/geometry/base.universal.i18n
Normal file
@@ -0,0 +1,24 @@
|
||||
FiguresTab = "Figures"
|
||||
NoFigures = "Aucune figure à afficher"
|
||||
OtherTab = "TODO"
|
||||
Coordinates = "Coordonnées"
|
||||
Middle = "Milieu"
|
||||
VectorProject = "Projeté vectoriel"
|
||||
OrthogonalProject = "Projeté orthogonal"
|
||||
CartesianEquation = "Equation cartésienne"
|
||||
LinearEquation = "Equation linéaire"
|
||||
Points = "Points"
|
||||
PointAndVector = "Point et vecteur"
|
||||
Parallele = "Parallèle"
|
||||
Perpendicular = "Perpendiculaire"
|
||||
PointAndRadius = "Point et rayon"
|
||||
Diameter = "Diamètre"
|
||||
TwoPoints = "Deux points"
|
||||
Segment = "Segment"
|
||||
Angle = "Angle"
|
||||
Area = "Surface"
|
||||
Point = "Point"
|
||||
Line = "Droite"
|
||||
Circle = "Cercle"
|
||||
Vector = "Vecteur"
|
||||
Indicator = "Indicateur"
|
||||
1
apps/geometry/figure_store.cpp
Normal file
1
apps/geometry/figure_store.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "figure_store.h"
|
||||
14
apps/geometry/figure_store.h
Normal file
14
apps/geometry/figure_store.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#ifndef FIGURE__STORE__H
|
||||
#define FIGURE__STORE__H
|
||||
|
||||
#include "../shared/expression_model_store.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
class FigureStore: Shared::ExpressionModelStore {
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
27
apps/geometry/figures/figure.h
Normal file
27
apps/geometry/figures/figure.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef POINCARE_FIGURE_H
|
||||
#define POINCARE_FIGURE_H
|
||||
|
||||
#include "figure_type.h"
|
||||
|
||||
using namespace Poincare;
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
class FigureNode : public TreeNode {
|
||||
public:
|
||||
virtual size_t size() const override = 0;
|
||||
|
||||
virtual int numberOfChildren() const override { return 0; }
|
||||
|
||||
virtual FigureType type() const = 0;
|
||||
virtual FigureDefinitionType definitionType() const = 0;
|
||||
};
|
||||
|
||||
class Figure : public TreeHandle {
|
||||
public:
|
||||
Figure(const FigureNode * node) : TreeHandle(node) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
24
apps/geometry/figures/figure_type.h
Normal file
24
apps/geometry/figures/figure_type.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef GEOMETRY_FIGURE_TYPE_H
|
||||
#define GEOMETRY_FIGURE_TYPE_H
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
enum class FigureType {
|
||||
None = 0, // Used to trigger assert in debug mode
|
||||
Expression, // It's not a real figure type but we use it to build figures like points
|
||||
|
||||
Point,
|
||||
|
||||
Line,
|
||||
Circle,
|
||||
Vector,
|
||||
Indicator
|
||||
};
|
||||
|
||||
enum class FigureDefinitionType {
|
||||
PointByCoordinates
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
6
apps/geometry/figures/figures.h
Normal file
6
apps/geometry/figures/figures.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef FIGURES_H
|
||||
#define FIGURES_H
|
||||
|
||||
#include "point_by_coordinates.h"
|
||||
|
||||
#endif
|
||||
1
apps/geometry/figures/point.cpp
Normal file
1
apps/geometry/figures/point.cpp
Normal file
@@ -0,0 +1 @@
|
||||
#include "point.h"
|
||||
18
apps/geometry/figures/point.h
Normal file
18
apps/geometry/figures/point.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef GEOMETRY_POINT_H
|
||||
#define GEOMETRY_POINT_H
|
||||
|
||||
#include "figure.h"
|
||||
namespace Geometry {
|
||||
|
||||
class PointNode : public FigureNode {
|
||||
virtual FigureType type() const override { return FigureType::Point; }
|
||||
};
|
||||
|
||||
class Point : public Figure {
|
||||
public:
|
||||
Point(const PointNode * n) : Figure(n) {}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
31
apps/geometry/figures/point_by_coordinates.h
Normal file
31
apps/geometry/figures/point_by_coordinates.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef POINT_BY_COORDINATES_H
|
||||
#define POINT_BY_COORDINATES_H
|
||||
|
||||
#include <poincare/expression.h>
|
||||
#include "point.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
class PointByCoordinatesNode : public PointNode {
|
||||
public:
|
||||
virtual size_t size() const override { return sizeof(PointByCoordinatesNode); }
|
||||
virtual int numberOfChildren() const override { return 2; }
|
||||
virtual FigureDefinitionType definitionType() const override { return FigureDefinitionType::PointByCoordinates; }
|
||||
#if POINCARE_TREE_LOG
|
||||
void logNodeName(std::ostream & stream) const override {
|
||||
stream << "PointByCoordinates";
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
class PointByCoordinates : public Figure {
|
||||
public:
|
||||
PointByCoordinates(const PointByCoordinatesNode * n) : Figure(n) {}
|
||||
static PointByCoordinates Builder(Expression x, Expression y) { return TreeHandle::FixedArityBuilder<PointByCoordinates, PointByCoordinatesNode>({x, x}); }
|
||||
static int numberOfParameters() { return 2; }
|
||||
static FigureType parameterTypeAtIndex(int i) { return FigureType::Expression; }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
BIN
apps/geometry/geometry_icon.png
Normal file
BIN
apps/geometry/geometry_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
15
apps/geometry/graph/banner_view.cpp
Normal file
15
apps/geometry/graph/banner_view.cpp
Normal file
@@ -0,0 +1,15 @@
|
||||
#include "banner_view.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
BannerView::BannerView(
|
||||
Responder * parentResponder,
|
||||
InputEventHandlerDelegate * inputEventHandlerDelegate,
|
||||
TextFieldDelegate * textFieldDelegate
|
||||
) :
|
||||
Shared::XYBannerView(parentResponder, inputEventHandlerDelegate, textFieldDelegate)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
15
apps/geometry/graph/banner_view.h
Normal file
15
apps/geometry/graph/banner_view.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef GEOMETRY_BANNER_VIEW_H
|
||||
#define GEOMETRY_BANNER_VIEW_H
|
||||
|
||||
#include "../../shared/xy_banner_view.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
class BannerView : public Shared::XYBannerView {
|
||||
public:
|
||||
BannerView(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * textFieldDelegate);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
11
apps/geometry/graph/graph_controller.cpp
Normal file
11
apps/geometry/graph/graph_controller.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include "graph_controller.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
GraphController::GraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, ButtonRowController * header, Shared::InteractiveCurveViewRange/*TODO -> Store*/ * store, Shared::CurveViewCursor * cursor, uint32_t * rangeVersion) :
|
||||
InteractiveCurveViewController(parentResponder, inputEventHandlerDelegate, header, store, nullptr, cursor, rangeVersion)
|
||||
{
|
||||
/* WHEREIWAS: Now i must make the app launch again without crash, by replacing the multiples nullptr that I used... */
|
||||
}
|
||||
|
||||
}
|
||||
33
apps/geometry/graph/graph_controller.h
Normal file
33
apps/geometry/graph/graph_controller.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef GRAPH_VIEW_CONTROLLER_H
|
||||
#define GRAPH_VIEW_CONTROLLER_H
|
||||
|
||||
#include "../shared/interactive_curve_view_controller.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
class GraphController : public Shared::InteractiveCurveViewController {
|
||||
public:
|
||||
GraphController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, ButtonRowController * header, Shared::InteractiveCurveViewRange * store, Shared::CurveViewCursor * cursor, uint32_t * rangeVersion);
|
||||
|
||||
virtual Shared::InteractiveCurveViewRange * interactiveCurveViewRange() override { return nullptr; } //TOIMPLEMENT
|
||||
virtual Shared::CurveView * curveView() override { return nullptr; } //TOIMPLEMENT
|
||||
virtual void reloadBannerView() override { } //TOIMPLEMENT
|
||||
virtual bool handleEnter() override { return false; } //TOIMPLEMENT
|
||||
virtual void initCursorParameters() override { } //TOIMPLEMENT
|
||||
virtual bool moveCursorVertically(int direction) override { return false; } //TOIMPLEMENT
|
||||
virtual uint32_t rangeVersion() override { return 0; } //TOIMPLEMENT
|
||||
virtual bool cursorMatchesModel() override { return false; } //TOIMPLEMENT
|
||||
virtual Poincare::Coordinate2D<double> xyValues(int curveIndex, double t, Poincare::Context * context) const override { return Poincare::Coordinate2D<double>(0, 0); } //TOIMPLEMENT
|
||||
virtual bool closestCurveIndexIsSuitable(int newIndex, int currentIndex) const override { return false; }
|
||||
virtual int selectedCurveIndex() const override { return 0; }
|
||||
virtual int numberOfCurves() const override { return 0; }
|
||||
|
||||
/* AlternateEmptyViewDefaultDelegate */
|
||||
virtual bool isEmpty() const override { return false; }
|
||||
virtual I18n::Message emptyMessage() override { return I18n::Message::NoFigures; }
|
||||
private:
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
147
apps/geometry/list/definition_type_controller.cpp
Normal file
147
apps/geometry/list/definition_type_controller.cpp
Normal file
@@ -0,0 +1,147 @@
|
||||
#include "figure_type_controller.h"
|
||||
#include "../figures/figures.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
static constexpr I18n::Message sPointDefinitionsMessages[] = {
|
||||
I18n::Message::Coordinates,
|
||||
I18n::Message::Middle,
|
||||
I18n::Message::VectorProject,
|
||||
I18n::Message::OrthogonalProject
|
||||
};
|
||||
static const uint8_t sPointDefinitionsMessagesCount = sizeof(sPointDefinitionsMessages) / sizeof(I18n::Message);
|
||||
|
||||
|
||||
static constexpr I18n::Message sLineDefinitionMessages[] = {
|
||||
I18n::Message::CartesianEquation,
|
||||
I18n::Message::LinearEquation,
|
||||
I18n::Message::Points,
|
||||
I18n::Message::PointAndVector,
|
||||
I18n::Message::Parallele,
|
||||
I18n::Message::Perpendicular
|
||||
};
|
||||
static const uint8_t sLineDefinitionsMessagesCount = sizeof(sLineDefinitionMessages) / sizeof(I18n::Message);
|
||||
|
||||
|
||||
static constexpr I18n::Message sCircleDefinitionsMessages[] = {
|
||||
I18n::Message::PointAndRadius,
|
||||
I18n::Message::Diameter,
|
||||
I18n::Message::CartesianEquation,
|
||||
};
|
||||
static const uint8_t sCircleDefinitionsMessagesCount = sizeof(sCircleDefinitionsMessages) / sizeof(I18n::Message);
|
||||
|
||||
|
||||
static constexpr I18n::Message sVectorDefinitionsMessages[] = {
|
||||
I18n::Message::Coordinates,
|
||||
I18n::Message::TwoPoints
|
||||
};
|
||||
static const uint8_t sVectorDefinitionsMessagesCount = sizeof(sVectorDefinitionsMessages) / sizeof(I18n::Message);
|
||||
|
||||
|
||||
static constexpr I18n::Message sIndicatorDefinitionsMessages[] = {
|
||||
I18n::Message::Segment,
|
||||
I18n::Message::Angle,
|
||||
I18n::Message::Area,
|
||||
};
|
||||
static const uint8_t sIndicatorDefinitionsMessagesCount = sizeof(sIndicatorDefinitionsMessages) / sizeof(I18n::Message);
|
||||
|
||||
|
||||
DefinitionTypeController::DefinitionTypeController(Responder * parentResponder, FigureParametersController * parametersController):
|
||||
ViewController(parentResponder),
|
||||
m_lastSelectedRow(0),
|
||||
m_selectableTableView(this),
|
||||
m_messages(nullptr),
|
||||
m_figureType(FigureType::None),
|
||||
m_parametersController(parametersController)
|
||||
{
|
||||
for (int i = 0; i < k_numberOfCells; i ++) {
|
||||
m_cells[i].setMessageFont(KDFont::LargeFont);
|
||||
}
|
||||
}
|
||||
|
||||
void DefinitionTypeController::viewWillAppear() {
|
||||
assert(m_figureType != FigureType::None && m_messages != nullptr);
|
||||
selectRow(m_lastSelectedRow);
|
||||
m_selectableTableView.reloadData(); // We reload the cell of the table view to update their message
|
||||
}
|
||||
|
||||
void DefinitionTypeController::didBecomeFirstResponder() {
|
||||
//App::app()->snapshot()->setActivePage(App::Snapshot::Page::Distribution);
|
||||
Container::activeApp()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
|
||||
bool DefinitionTypeController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
|
||||
m_lastSelectedRow = selectedRow();
|
||||
StackViewController * stack = static_cast<StackViewController *>(parentResponder());
|
||||
m_parametersController->setParametersInfoFunctions(PointByCoordinates::numberOfParameters, PointByCoordinates::parameterTypeAtIndex);
|
||||
stack->push(m_parametersController);
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Back) {
|
||||
StackViewController * stack = static_cast<StackViewController *>(parentResponder());
|
||||
stack->pop();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
HighlightCell * DefinitionTypeController::reusableCell(int index) {
|
||||
assert(index >= 0);
|
||||
assert(index < k_numberOfCells);
|
||||
return &m_cells[index];
|
||||
}
|
||||
|
||||
void DefinitionTypeController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
MessageTableCellWithChevron * myCell = (MessageTableCellWithChevron *)cell;
|
||||
myCell->setMessage(m_messages[index]);
|
||||
}
|
||||
|
||||
int DefinitionTypeController::numberOfRows() const {
|
||||
switch (m_figureType) {
|
||||
case FigureType::Point:
|
||||
return sPointDefinitionsMessagesCount;
|
||||
break;
|
||||
case FigureType::Line:
|
||||
return sLineDefinitionsMessagesCount;
|
||||
break;
|
||||
case FigureType::Circle:
|
||||
return sCircleDefinitionsMessagesCount;
|
||||
break;
|
||||
case FigureType::Vector:
|
||||
return sVectorDefinitionsMessagesCount;
|
||||
break;
|
||||
case FigureType::Indicator:
|
||||
return sIndicatorDefinitionsMessagesCount;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void DefinitionTypeController::setFigureType(FigureType figureType) {
|
||||
m_figureType = figureType;
|
||||
switch (m_figureType) {
|
||||
case FigureType::Point:
|
||||
m_messages = sPointDefinitionsMessages;
|
||||
break;
|
||||
case FigureType::Line:
|
||||
m_messages = sLineDefinitionMessages;
|
||||
break;
|
||||
case FigureType::Circle:
|
||||
m_messages = sCircleDefinitionsMessages;
|
||||
break;
|
||||
case FigureType::Vector:
|
||||
m_messages = sVectorDefinitionsMessages;
|
||||
break;
|
||||
case FigureType::Indicator:
|
||||
m_messages = sIndicatorDefinitionsMessages;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
53
apps/geometry/list/definition_type_controller.h
Normal file
53
apps/geometry/list/definition_type_controller.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef GEOMETRY_DEFINITION_TYPE_CONTROLLER_H
|
||||
#define GEOMETRY_DEFINITION_TYPE_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "apps/i18n.h"
|
||||
#include "../figures/figure_type.h"
|
||||
#include "figure_parameters_controller.h"
|
||||
|
||||
namespace Geometry {
|
||||
/**
|
||||
* \brief DefinitionTypeController is a controller to choose how the figure is defined
|
||||
*/
|
||||
class DefinitionTypeController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource {
|
||||
public:
|
||||
DefinitionTypeController(Responder * parentResponder, FigureParametersController * parametersController);
|
||||
|
||||
/* ViewController */
|
||||
View * view() override { return &m_selectableTableView; }
|
||||
// We want to avoid using half of the screen just for titles
|
||||
virtual DisplayParameter displayParameter() override { return DisplayParameter::DoNotShowOwnTitle; }
|
||||
const char * title() override { return I18n::translate(I18n::Message::DefinitionType); }
|
||||
|
||||
/* Responder */
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
|
||||
/* ViewController */
|
||||
void didBecomeFirstResponder() override;
|
||||
void viewWillAppear() override;
|
||||
TELEMETRY_ID("FigureType");
|
||||
|
||||
/* SelectableTableViewDataSource */
|
||||
int numberOfRows() const override;
|
||||
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
|
||||
KDCoordinate cellHeight() override { return k_cellHeight; }
|
||||
HighlightCell * reusableCell(int index) override;
|
||||
int reusableCellCount() const override { return k_numberOfCells; }
|
||||
|
||||
/* Customs methods */
|
||||
void setFigureType(FigureType type);
|
||||
private:
|
||||
constexpr static KDCoordinate k_cellHeight = Metric::ParameterCellHeight;
|
||||
constexpr static int k_numberOfCells = 6;
|
||||
int m_lastSelectedRow;
|
||||
MessageTableCellWithChevron m_cells[k_numberOfCells];
|
||||
SelectableTableView m_selectableTableView;
|
||||
const I18n::Message * m_messages;
|
||||
FigureType m_figureType;
|
||||
FigureParametersController * m_parametersController;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
114
apps/geometry/list/figure_parameters_controller.cpp
Normal file
114
apps/geometry/list/figure_parameters_controller.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
#include "figure_parameters_controller.h"
|
||||
#include "../app.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
FigureParametersController::FigureParametersController(Responder * parentResponder):
|
||||
ViewController(parentResponder),
|
||||
m_lastSelectedRow(0),
|
||||
m_selectableTableView(this),
|
||||
m_okButton(&m_selectableTableView, I18n::Message::Ok, Invocation([](void * context, void * sender) {
|
||||
FigureParametersController * parameterController = (FigureParametersController *) context;
|
||||
parameterController->returnToMenu();
|
||||
return true;
|
||||
}, this))
|
||||
{
|
||||
for (int i = 0; i < k_choiceCells; i++) {
|
||||
m_choicesCells[i].setParentResponder(&m_selectableTableView);
|
||||
}
|
||||
for (int i = 0; i < k_textCells; i++) {
|
||||
m_textCells[i].setParentResponder(&m_selectableTableView);
|
||||
m_textCells[i].textField()->setDelegates(this, this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FigureParametersController::setParametersInfoFunctions(NumberOfParametersFunction numberOfParametersFunction, TypeOfParametersAtIndexFunction typeOfParametersAtIndexFunction) {
|
||||
m_numberOfParametersFunction = numberOfParametersFunction;
|
||||
m_typeOfParametersAtIndexFunction = typeOfParametersAtIndexFunction;
|
||||
}
|
||||
|
||||
void FigureParametersController::didBecomeFirstResponder() {
|
||||
Container::activeApp()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
|
||||
void FigureParametersController::viewWillAppear() {
|
||||
selectRow(m_lastSelectedRow);
|
||||
}
|
||||
|
||||
void FigureParametersController::returnToMenu() {
|
||||
StackViewController * stack = static_cast<StackViewController *>(parentResponder());
|
||||
stack->pop();
|
||||
stack->pop();
|
||||
stack->pop();
|
||||
}
|
||||
|
||||
/* ListViewDataSource */
|
||||
int FigureParametersController::typeAtLocation(int i, int j) {
|
||||
if (j == m_numberOfParametersFunction()) {
|
||||
return 0; // It's equivalent to "None", so we can use it for button cell
|
||||
}
|
||||
return (int) m_typeOfParametersAtIndexFunction(j);
|
||||
}
|
||||
|
||||
int FigureParametersController::reusableCellCount(int type) {
|
||||
if (type == 0) {
|
||||
return 1;
|
||||
}
|
||||
return type == (int) FigureType::Expression ? k_textCells: k_choiceCells;
|
||||
}
|
||||
|
||||
HighlightCell * FigureParametersController::reusableCell(int index, int type) {
|
||||
if (type == 0) {
|
||||
return &m_okButton;
|
||||
}
|
||||
if (type == (int) FigureType::Expression) {
|
||||
return &m_textCells[index];
|
||||
}
|
||||
return &m_choicesCells[index];
|
||||
}
|
||||
|
||||
int FigureParametersController::numberOfRows() const {
|
||||
return m_numberOfParametersFunction() + 1;
|
||||
}
|
||||
KDCoordinate FigureParametersController::rowHeight(int j) {
|
||||
if (j == numberOfRows()-1) {
|
||||
return Metric::ParameterCellHeight+k_buttonMargin;
|
||||
}
|
||||
return Metric::ParameterCellHeight;
|
||||
}
|
||||
|
||||
KDCoordinate FigureParametersController::cumulatedHeightFromIndex(int j) {
|
||||
if (j == numberOfRows()) {
|
||||
return j*Metric::ParameterCellHeight+k_buttonMargin;
|
||||
}
|
||||
return Metric::ParameterCellHeight*j;
|
||||
}
|
||||
|
||||
int FigureParametersController::indexFromCumulatedHeight(KDCoordinate offsetY) {
|
||||
return (offsetY - 1) / Metric::ParameterCellHeight;
|
||||
}
|
||||
|
||||
void FigureParametersController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
|
||||
}
|
||||
|
||||
bool FigureParametersController::textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) {
|
||||
return (event == Ion::Events::Down && selectedRow() < numberOfRows()-1)
|
||||
|| (event == Ion::Events::Up && selectedRow() > 0)
|
||||
|| TextFieldDelegate::textFieldShouldFinishEditing(textField, event);
|
||||
}
|
||||
|
||||
bool FigureParametersController::textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) {
|
||||
m_selectableTableView.reloadCellAtLocation(0, selectedRow());
|
||||
m_selectableTableView.reloadData();
|
||||
textField->setText(text);
|
||||
if (event == Ion::Events::EXE || event == Ion::Events::OK) {
|
||||
m_selectableTableView.selectCellAtLocation(selectedColumn(), selectedRow() + 1);
|
||||
} else {
|
||||
m_selectableTableView.handleEvent(event);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
64
apps/geometry/list/figure_parameters_controller.h
Normal file
64
apps/geometry/list/figure_parameters_controller.h
Normal file
@@ -0,0 +1,64 @@
|
||||
#ifndef GEOMETRY_FIGURE_PARAMETERS_CONTROLLER_H
|
||||
#define GEOMETRY_FIGURE_PARAMETERS_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "apps/i18n.h"
|
||||
#include "message_table_cell_with_selector.h"
|
||||
#include "../figures/figure.h"
|
||||
#include "../../shared/parameter_text_field_delegate.h"
|
||||
#include "../../shared/input_event_handler_delegate.h"
|
||||
#include "../../shared/button_with_separator.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
typedef int (*NumberOfParametersFunction)();
|
||||
typedef FigureType (*TypeOfParametersAtIndexFunction)(int);
|
||||
|
||||
/**
|
||||
* \brief Controller returning the parameter choosen by the user to define the figure
|
||||
*/
|
||||
class FigureParametersController : public ViewController, public ListViewDataSource, public SelectableTableViewDataSource, public Shared::ParameterTextFieldDelegate, public Shared::InputEventHandlerDelegate {
|
||||
public:
|
||||
FigureParametersController(Responder * parentResponder);
|
||||
void setParametersInfoFunctions(NumberOfParametersFunction numberOfParametersFunction, TypeOfParametersAtIndexFunction typeOfParametersAtIndexFunction);
|
||||
void returnToMenu();
|
||||
/* ViewController */
|
||||
const char * title() override { return I18n::translate(I18n::Message::ParametersChoice); }
|
||||
// We want to avoid using half of the screen just for titles
|
||||
virtual DisplayParameter displayParameter() override { return DisplayParameter::DoNotShowOwnTitle; }
|
||||
View * view() override { return &m_selectableTableView; };
|
||||
|
||||
/* Responder */
|
||||
void didBecomeFirstResponder() override;
|
||||
void viewWillAppear() override;
|
||||
|
||||
/* ListViewDataSource */
|
||||
int typeAtLocation(int i, int j) override;
|
||||
int reusableCellCount(int type) override; // TO IMPLEMENT
|
||||
HighlightCell * reusableCell(int index, int type) override;
|
||||
int numberOfRows() const override;
|
||||
KDCoordinate rowHeight(int j) override;
|
||||
KDCoordinate cumulatedHeightFromIndex(int j) override;
|
||||
int indexFromCumulatedHeight(KDCoordinate offsetY) override;
|
||||
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
|
||||
|
||||
/* InputEventHandlerDelegate */
|
||||
bool textFieldShouldFinishEditing(TextField * textField, Ion::Events::Event event) override;
|
||||
bool textFieldDidFinishEditing(TextField * textField, const char * text, Ion::Events::Event event) override;
|
||||
|
||||
private:
|
||||
SelectableTableView m_selectableTableView;
|
||||
constexpr static int k_textCells = 2;
|
||||
constexpr static int k_choiceCells = 3;
|
||||
constexpr static int k_buttonMargin = 6;
|
||||
int m_lastSelectedRow;
|
||||
MessageTableCellWithEditableText m_textCells[k_textCells];
|
||||
MessageTableCellWithSelector m_choicesCells[k_choiceCells];
|
||||
ButtonWithSeparator m_okButton;
|
||||
NumberOfParametersFunction m_numberOfParametersFunction;
|
||||
TypeOfParametersAtIndexFunction m_typeOfParametersAtIndexFunction;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
70
apps/geometry/list/figure_type_controller.cpp
Normal file
70
apps/geometry/list/figure_type_controller.cpp
Normal file
@@ -0,0 +1,70 @@
|
||||
#include "figure_type_controller.h"
|
||||
#include "apps/i18n.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
static FigureType sTypes[] = {
|
||||
FigureType::Point,
|
||||
FigureType::Line,
|
||||
FigureType::Circle,
|
||||
FigureType::Vector,
|
||||
FigureType::Indicator
|
||||
};
|
||||
|
||||
static I18n::Message sMessages[] = {
|
||||
I18n::Message::Point,
|
||||
I18n::Message::Line,
|
||||
I18n::Message::Circle,
|
||||
I18n::Message::Vector,
|
||||
I18n::Message::Indicator
|
||||
};
|
||||
|
||||
FigureTypeController::FigureTypeController(Responder * parentResponder, DefinitionTypeController * definitionTypeController) :
|
||||
ViewController(parentResponder),
|
||||
m_lastSelectedRow(0),
|
||||
m_selectableTableView(this),
|
||||
m_definitionTypeController(definitionTypeController),
|
||||
m_messages(sMessages)
|
||||
{
|
||||
for (int i = 0; i < k_numberOfCells; i ++) {
|
||||
m_cells[i].setMessageFont(KDFont::LargeFont);
|
||||
}
|
||||
}
|
||||
|
||||
void FigureTypeController::viewWillAppear() {
|
||||
selectRow(m_lastSelectedRow);
|
||||
}
|
||||
|
||||
void FigureTypeController::didBecomeFirstResponder() {
|
||||
//App::app()->snapshot()->setActivePage(App::Snapshot::Page::Distribution);
|
||||
Container::activeApp()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
|
||||
bool FigureTypeController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
|
||||
m_lastSelectedRow = selectedRow();
|
||||
StackViewController * stack = static_cast<StackViewController *>(parentResponder());
|
||||
m_definitionTypeController->setFigureType(sTypes[selectedRow()]);
|
||||
stack->push(m_definitionTypeController);
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Back ) {
|
||||
StackViewController * stack = static_cast<StackViewController *>(parentResponder());
|
||||
stack->pop();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
HighlightCell * FigureTypeController::reusableCell(int index) {
|
||||
assert(index >= 0);
|
||||
assert(index < k_numberOfCells);
|
||||
return &m_cells[index];
|
||||
}
|
||||
|
||||
void FigureTypeController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
MessageTableCellWithChevron * myCell = (MessageTableCellWithChevron *)cell;
|
||||
myCell->setMessage(m_messages[index]);
|
||||
}
|
||||
|
||||
}
|
||||
49
apps/geometry/list/figure_type_controller.h
Normal file
49
apps/geometry/list/figure_type_controller.h
Normal file
@@ -0,0 +1,49 @@
|
||||
#ifndef GEOMETRY_FIGURE_TYPE_CONTROLLER_H
|
||||
#define GEOMETRY_FIGURE_TYPE_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "definition_type_controller.h"
|
||||
|
||||
namespace Geometry {
|
||||
/**
|
||||
* \brief FigureTypeController is a controller that is used to select the type of
|
||||
* figure to be created.
|
||||
*/
|
||||
class FigureTypeController : public ViewController, public SimpleListViewDataSource, public SelectableTableViewDataSource {
|
||||
public:
|
||||
FigureTypeController(Responder * parentResponder, DefinitionTypeController * definitionController);
|
||||
|
||||
/* ViewController */
|
||||
View * view() override { return &m_selectableTableView; }
|
||||
// We want to avoid using half of the screen just for titles
|
||||
virtual DisplayParameter displayParameter() override { return DisplayParameter::DoNotShowOwnTitle; }
|
||||
const char * title() override { return I18n::translate(I18n::Message::FigureType); }
|
||||
|
||||
/* Responder */
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
void didBecomeFirstResponder() override;
|
||||
|
||||
/* ViewController */
|
||||
void viewWillAppear() override;
|
||||
TELEMETRY_ID("FigureType");
|
||||
|
||||
/* TableViewDataSource */
|
||||
int numberOfRows() const override { return k_numberOfRows; }
|
||||
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
|
||||
KDCoordinate cellHeight() override { return k_cellHeight; }
|
||||
HighlightCell * reusableCell(int index) override;
|
||||
int reusableCellCount() const override { return k_numberOfCells; }
|
||||
private:
|
||||
constexpr static KDCoordinate k_cellHeight = Metric::ParameterCellHeight;
|
||||
constexpr static int k_numberOfCells = 5;
|
||||
constexpr static int k_numberOfRows = 5;
|
||||
int m_lastSelectedRow;
|
||||
MessageTableCellWithChevron m_cells[k_numberOfCells];
|
||||
SelectableTableView m_selectableTableView;
|
||||
DefinitionTypeController * m_definitionTypeController;
|
||||
I18n::Message * m_messages;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
77
apps/geometry/list/figures_controller.cpp
Normal file
77
apps/geometry/list/figures_controller.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
#include "figures_controller.h"
|
||||
#include "definition_type_controller.h"
|
||||
#include <apps/i18n.h>
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
FiguresController::FiguresController(Responder * parentResponder):
|
||||
ViewController(parentResponder),
|
||||
m_selectableTableView(this, this, this, this),
|
||||
m_addFigureCell(),
|
||||
m_emptyCell(),
|
||||
m_figureTypeController(this, &m_definitionTypeController),
|
||||
m_definitionTypeController(&m_figureTypeController, &m_parametersController),
|
||||
m_parametersController(&m_definitionTypeController)
|
||||
{
|
||||
m_addFigureCell.setMessage(I18n::Message::AddFigure);
|
||||
}
|
||||
|
||||
bool FiguresController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
if (isAddFigureRow(selectedRow())) {
|
||||
StackViewController * stack = static_cast<StackViewController *>(parentResponder());
|
||||
stack->push(&m_figureTypeController);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (event == Ion::Events::Up && selectedRow() == 0) {
|
||||
m_selectableTableView.deselectTable();
|
||||
assert(selectedRow() == -1);
|
||||
Container::activeApp()->setFirstResponder(parentResponder()->parentResponder());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void FiguresController::didBecomeFirstResponder() {
|
||||
Container::activeApp()->setFirstResponder(&m_selectableTableView);
|
||||
}
|
||||
|
||||
|
||||
HighlightCell * FiguresController::reusableCell(int index, int type) {
|
||||
assert(index >= 0);
|
||||
if (type == 2) {
|
||||
return &m_emptyCell;
|
||||
}
|
||||
return &m_addFigureCell;
|
||||
}
|
||||
|
||||
void FiguresController::willDisplayCellAtLocation(HighlightCell * cell, int i, int j) {
|
||||
if (i == 0) {
|
||||
return;
|
||||
}
|
||||
EvenOddCell * myCell = (EvenOddCell *)cell;
|
||||
myCell->setEven(j%2 == 0);
|
||||
myCell->setHighlighted(i == selectedColumn() && j == selectedRow());
|
||||
myCell->reloadCell();
|
||||
}
|
||||
|
||||
bool FiguresController::isAddFigureRow(int j) {
|
||||
return j == 0;
|
||||
}
|
||||
|
||||
int FiguresController::reusableCellCount(int type) {
|
||||
if (type > 1) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int FiguresController::typeAtLocation(int i, int j) {
|
||||
if (isAddFigureRow(j)) {
|
||||
return i + 2;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
}
|
||||
47
apps/geometry/list/figures_controller.h
Normal file
47
apps/geometry/list/figures_controller.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef FIGURES_CONTROLLER_H
|
||||
#define FIGURES_CONTROLLER_H
|
||||
|
||||
#include <escher.h>
|
||||
#include "figure_type_controller.h"
|
||||
|
||||
namespace Geometry
|
||||
{
|
||||
/**
|
||||
* \brief FiguresController is a controller to show the list of the figures
|
||||
*/
|
||||
class FiguresController : public ViewController, public SelectableTableViewDataSource, public SelectableTableViewDelegate, public TableViewDataSource {
|
||||
public:
|
||||
FiguresController(Responder * parentResponder);
|
||||
|
||||
/* ViewController */
|
||||
View * view() override { return &m_selectableTableView; }
|
||||
const char * title() override { return I18n::translate(I18n::Message::FiguresTab); }
|
||||
virtual DisplayParameter displayParameter() override { return DisplayParameter::DoNotShowOwnTitle; }
|
||||
/* Responder */
|
||||
bool handleEvent(Ion::Events::Event event) override; // TO IMPLEMENT
|
||||
void didBecomeFirstResponder() override;
|
||||
|
||||
/* TableView */
|
||||
int numberOfRows() const override { return 1; } // TO IMPLEMENT
|
||||
int numberOfColumns() const override { return 2; } // TO IMPLEMENT
|
||||
KDCoordinate columnWidth(int i) { return i == 0 ? 50 : 150; } // TO IMPLEMENT
|
||||
KDCoordinate rowHeight(int j) { return 50; } // TO IMPLEMENT
|
||||
HighlightCell * reusableCell(int index, int type); // TO IMPLEMENT
|
||||
void willDisplayCellAtLocation(HighlightCell * cell, int i, int j) override; // TO IMPLEMENT
|
||||
int reusableCellCount(int type);
|
||||
int typeAtLocation(int i, int j); // TO IMPLEMENT
|
||||
|
||||
private:
|
||||
/* Customs methods */
|
||||
bool isAddFigureRow(int j); // TO IMPLEMENT
|
||||
|
||||
SelectableTableView m_selectableTableView;
|
||||
EvenOddMessageTextCell m_addFigureCell;
|
||||
EvenOddCell m_emptyCell;
|
||||
FigureTypeController m_figureTypeController;
|
||||
DefinitionTypeController m_definitionTypeController;
|
||||
FigureParametersController m_parametersController;
|
||||
};
|
||||
|
||||
}
|
||||
#endif
|
||||
24
apps/geometry/list/message_table_cell_with_selector.cpp
Normal file
24
apps/geometry/list/message_table_cell_with_selector.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "message_table_cell_with_selector.h"
|
||||
#include <escher/container.h>
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
MessageTableCellWithSelector::MessageTableCellWithSelector(ToolboxMessageTree * root, const KDFont * font) :
|
||||
Responder(nullptr),
|
||||
MessageTableCell((I18n::Message)0, font),
|
||||
m_objectsRoot(root),
|
||||
m_selectedMessage(nullptr),
|
||||
m_toolbox(this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
bool MessageTableCellWithSelector::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
Container::activeApp()->displayModalViewController(&m_toolbox, 0.f, 0.f, Metric::PopUpTopMargin, Metric::PopUpLeftMargin, 0, Metric::PopUpRightMargin);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
26
apps/geometry/list/message_table_cell_with_selector.h
Normal file
26
apps/geometry/list/message_table_cell_with_selector.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef ESHER_MESSAGE_TABLE_CELL_WITH_OBJECT_SELECTOR_H_
|
||||
#define ESHER_MESSAGE_TABLE_CELL_WITH_OBJECT_SELECTOR_H_
|
||||
|
||||
#include <escher/message_table_cell_with_buffer.h>
|
||||
#include <escher/toolbox_message_tree.h>
|
||||
#include "objects_controller.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
class MessageTableCellWithSelector : public Responder, public MessageTableCell {
|
||||
public:
|
||||
MessageTableCellWithSelector(ToolboxMessageTree * root = nullptr, const KDFont * font = KDFont::SmallFont);
|
||||
ToolboxMessageTree * getSelectedMessage() const { return m_selectedMessage; };
|
||||
bool handleEvent(Ion::Events::Event event);
|
||||
Responder * responder() override {
|
||||
return this;
|
||||
}
|
||||
private:
|
||||
ToolboxMessageTree * m_objectsRoot;
|
||||
ToolboxMessageTree * m_selectedMessage;
|
||||
ObjectsController m_toolbox;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
35
apps/geometry/list/objects_controller.cpp
Normal file
35
apps/geometry/list/objects_controller.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "objects_controller.h"
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
ObjectsController::ObjectsController(Responder * responder) :
|
||||
NestedMenuController(this)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int ObjectsController::numberOfRows() const {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ObjectsController::reusableCellCount(int type) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ObjectsController::typeAtLocation(int i, int j) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool ObjectsController::selectLeaf(int type) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HighlightCell * ObjectsController::leafCellAtIndex(int index) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HighlightCell * ObjectsController::nodeCellAtIndex(int index) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
}
|
||||
21
apps/geometry/list/objects_controller.h
Normal file
21
apps/geometry/list/objects_controller.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef GEOMETRY_OBJECTS_CONTROLLER_H
|
||||
#define GEOMETRY_OBJECTS_CONTROLLER_H
|
||||
|
||||
#include <escher/nested_menu_controller.h>
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
class ObjectsController : public NestedMenuController {
|
||||
public:
|
||||
ObjectsController(Responder * parentResponder);
|
||||
virtual int numberOfRows() const override;
|
||||
virtual int reusableCellCount(int type) override;
|
||||
virtual int typeAtLocation(int i, int j) override;
|
||||
virtual bool selectLeaf(int selectedRow) override;
|
||||
virtual HighlightCell * leafCellAtIndex(int index) override;
|
||||
virtual HighlightCell * nodeCellAtIndex(int index) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
16
apps/geometry/other/other_view_controller.h
Normal file
16
apps/geometry/other/other_view_controller.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#ifndef OTHER_VIEW_CONTROLLER_H
|
||||
#define OTHER_VIEW_CONTROLLER_H
|
||||
|
||||
namespace Geometry {
|
||||
|
||||
class OtherViewController : public ViewController {
|
||||
public:
|
||||
OtherViewController(Responder * parentResponder):
|
||||
ViewController(parentResponder) {}
|
||||
View * view() override { return nullptr; }
|
||||
const char * title() override { return I18n::translate(I18n::Message::OtherTab); }
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -75,7 +75,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
// To represent the tangent, we draw segment from and to abscissas at the extremity of the drawn rect
|
||||
float minAbscissa = pixelToFloat(Axis::Horizontal, rect.left());
|
||||
float maxAbscissa = pixelToFloat(Axis::Horizontal, rect.right());
|
||||
drawSegment(ctx, rect, minAbscissa, tangentParameterA*minAbscissa+tangentParameterB, maxAbscissa, tangentParameterA*maxAbscissa+tangentParameterB, *Palette::GraphTangent, false);
|
||||
drawSegment(ctx, rect, minAbscissa, tangentParameterA*minAbscissa+tangentParameterB, maxAbscissa, tangentParameterA*maxAbscissa+tangentParameterB, Palette::GraphTangent, false);
|
||||
}
|
||||
} else if (type == Shared::ContinuousFunction::PlotType::Polar) {
|
||||
// Polar
|
||||
|
||||
@@ -167,7 +167,7 @@ void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) {
|
||||
// Set name and color if the name is not being edited
|
||||
ExpiringPointer<ContinuousFunction> function = modelStore()->modelForRecord(modelStore()->recordAtIndex(j));
|
||||
setFunctionNameInTextField(function, titleCell->textField());
|
||||
KDColor functionNameColor = function->isActive() ? function->color() : *Palette::SecondaryText;
|
||||
KDColor functionNameColor = function->isActive() ? function->color() : Palette::SecondaryText;
|
||||
titleCell->setColor(functionNameColor);
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@ void ListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int
|
||||
Shared::FunctionListController::willDisplayExpressionCellAtIndex(cell, j);
|
||||
FunctionExpressionCell * myCell = (FunctionExpressionCell *)cell;
|
||||
ExpiringPointer<ContinuousFunction> f = modelStore()->modelForRecord(modelStore()->recordAtIndex(j));
|
||||
KDColor textColor = f->isActive() ? *Palette::PrimaryText : *Palette::SecondaryText;
|
||||
KDColor textColor = f->isActive() ? Palette::PrimaryText : Palette::SecondaryText;
|
||||
myCell->setTextColor(textColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ public:
|
||||
const KDFont * size = KDFont::LargeFont,
|
||||
float horizontalAlignment = 0.0f,
|
||||
float verticalAlignment = 0.5f,
|
||||
KDColor textColor = *Palette::PrimaryText,
|
||||
KDColor backgroundColor = *Palette::BackgroundHard) :
|
||||
KDColor textColor = Palette::PrimaryText,
|
||||
KDColor backgroundColor = Palette::BackgroundHard) :
|
||||
TextFieldWithExtension(extensionLength, parentResponder, textBuffer, textBufferSize, draftTextBufferSize, inputEventHandlerDelegate, delegate, size, horizontalAlignment, verticalAlignment, textColor, backgroundColor) {}
|
||||
void setDraftTextBufferSize(size_t size) { m_contentView.setDraftTextBufferSize(size); }
|
||||
};
|
||||
|
||||
@@ -30,7 +30,7 @@ const uint8_t arrowDownMask[10][9] = {
|
||||
|
||||
ArrowView::ArrowView() :
|
||||
m_directionIsUp(true),
|
||||
m_color(*Palette::PrimaryText)
|
||||
m_color(Palette::PrimaryText)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ void ArrowView::setColor(KDColor color) {
|
||||
|
||||
void ArrowView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDColor arrowWorkingBuffer[10*9];
|
||||
ctx->fillRect(bounds(), *Palette::BackgroundHard);
|
||||
ctx->fillRect(bounds(), Palette::BackgroundHard);
|
||||
KDCoordinate startLine = m_directionIsUp ? k_arrowHeight : 0;
|
||||
KDCoordinate startArrow = m_directionIsUp ? 0 : bounds().height()-k_arrowHeight;
|
||||
ctx->fillRect(KDRect((Ion::Display::Width-k_arrowThickness)/2, startLine, k_arrowThickness, bounds().height()-k_arrowHeight), m_color);
|
||||
|
||||
@@ -59,7 +59,7 @@ void KeyboardView::drawKey(int keyIndex, KDContext * ctx, KDRect rect) const {
|
||||
|
||||
KDColor KeyboardView::keyColor(Ion::Keyboard::Key key) const {
|
||||
if (!m_keyboardModel.belongsToTestedKeysSubset(key)) {
|
||||
return *Palette::ListCellBorder;
|
||||
return Palette::ListCellBorder;
|
||||
}
|
||||
if (m_keyboardModel.testedKey() == key) {
|
||||
return KDColorBlue;
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Home {
|
||||
|
||||
AppCell::AppCell() :
|
||||
HighlightCell(),
|
||||
m_nameView(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, *Palette::HomeCellText, *Palette::HomeCellBackground),
|
||||
m_nameView(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::HomeCellText, Palette::HomeCellBackground),
|
||||
m_backgroundView(nullptr),
|
||||
m_visible(true), m_external_app(false)
|
||||
{
|
||||
@@ -39,7 +39,7 @@ void AppCell::setExtAppDescriptor(const char* name, const uint8_t *icon, size_t
|
||||
m_iconView.setImage(icon, iconLength);
|
||||
m_iconView.setImage(nullptr);
|
||||
m_nameView.setText(name);
|
||||
m_nameView.setTextColor(*Palette::HomeCellTextExternal);
|
||||
m_nameView.setTextColor(Palette::HomeCellTextExternal);
|
||||
m_nameView.setMessage(I18n::Message::Default);
|
||||
layoutSubviews();
|
||||
}
|
||||
@@ -49,7 +49,7 @@ void AppCell::setExtAppDescriptor(const char* name, const Image* icon) {
|
||||
m_iconView.setImage(icon);
|
||||
m_iconView.setImage(nullptr, 0);
|
||||
m_nameView.setText(name);
|
||||
m_nameView.setTextColor(*Palette::HomeCellTextExternal);
|
||||
m_nameView.setTextColor(Palette::HomeCellTextExternal);
|
||||
m_nameView.setMessage(I18n::Message::Default);
|
||||
layoutSubviews();
|
||||
}
|
||||
@@ -59,7 +59,7 @@ void AppCell::setAppDescriptor(::App::Descriptor * descriptor) {
|
||||
m_iconView.setImage(descriptor->icon());
|
||||
m_iconView.setImage(nullptr, 0);
|
||||
m_nameView.setMessage(descriptor->name());
|
||||
m_nameView.setTextColor(*Palette::HomeCellText);
|
||||
m_nameView.setTextColor(Palette::HomeCellText);
|
||||
m_nameView.setText(nullptr);
|
||||
layoutSubviews();
|
||||
}
|
||||
@@ -76,8 +76,8 @@ void AppCell::setBackgroundView(const BackgroundView * backgroundView) {
|
||||
}
|
||||
|
||||
void AppCell::reloadCell() {
|
||||
m_nameView.setTextColor(isHighlighted() ? (m_external_app ? *Palette::HomeCellTextExternalActive : *Palette::HomeCellTextActive) : (m_external_app ? *Palette::HomeCellTextExternal : *Palette::HomeCellText));
|
||||
m_nameView.setBackgroundColor(isHighlighted() ? *Palette::HomeCellBackgroundActive : *Palette::HomeCellBackground);
|
||||
m_nameView.setTextColor(isHighlighted() ? (m_external_app ? Palette::HomeCellTextExternalActive : Palette::HomeCellTextActive) : (m_external_app ? Palette::HomeCellTextExternal : Palette::HomeCellText));
|
||||
m_nameView.setBackgroundColor(isHighlighted() ? Palette::HomeCellBackgroundActive : Palette::HomeCellBackground);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Default,calculation,rpn,graph,code,statistics,probability,solver,atomic,sequence,regression,reader,settings
|
||||
HidePython,calculation,rpn,graph,code,statistics,probability,solver,atomic,sequence,regression,reader,settings
|
||||
Default,geometry,calculation,rpn,graph,code,statistics,probability,solver,atomic,sequence,regression,reader,settings
|
||||
HidePython,geometry,calculation,rpn,graph,code,statistics,probability,solver,atomic,sequence,regression,reader,settings
|
||||
|
||||
|
@@ -73,7 +73,7 @@ Controller::Controller(Responder * parentResponder, SelectableTableViewDataSourc
|
||||
m_cells[i].setBackgroundView(m_view.backgroundView());
|
||||
}
|
||||
|
||||
m_view.backgroundView()->setDefaultColor(*Palette::HomeBackground);
|
||||
m_view.backgroundView()->setDefaultColor(Palette::HomeBackground);
|
||||
|
||||
|
||||
#ifdef HOME_DISPLAY_EXTERNALS
|
||||
|
||||
@@ -15,7 +15,7 @@ const uint8_t lockMask[LockView::k_lockHeight][LockView::k_lockWidth] = {
|
||||
void LockView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDRect frame((bounds().width() - k_lockWidth)/2, (bounds().height()-k_lockHeight)/2, k_lockWidth, k_lockHeight);
|
||||
KDColor lockWorkingBuffer[LockView::k_lockHeight*LockView::k_lockWidth];
|
||||
ctx->blendRectWithMask(frame, *Palette::ToolbarText, (const uint8_t *)lockMask, lockWorkingBuffer);
|
||||
ctx->blendRectWithMask(frame, Palette::ToolbarText, (const uint8_t *)lockMask, lockWorkingBuffer);
|
||||
}
|
||||
|
||||
KDSize LockView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
MathVariableBoxEmptyController::MathVariableBoxEmptyView::MathVariableBoxEmptyView() :
|
||||
ModalViewEmptyView(),
|
||||
m_layoutExample(0.5f, 0.5f, *Palette::PrimaryText, *Palette::WallScreen)
|
||||
m_layoutExample(0.5f, 0.5f, Palette::PrimaryText, Palette::WallScreen)
|
||||
{
|
||||
initMessageViews();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ LogoView::LogoView() :
|
||||
}
|
||||
|
||||
void LogoView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), *Palette::BackgroundHard);
|
||||
ctx->fillRect(bounds(), Palette::BackgroundHard);
|
||||
}
|
||||
|
||||
int LogoView::numberOfSubviews() const {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
namespace OnBoarding {
|
||||
|
||||
PromptController::MessageViewWithSkip::MessageViewWithSkip(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages) :
|
||||
PromptController::MessageViewWithSkip::MessageViewWithSkip(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages) :
|
||||
MessageView(messages, fgcolors, bgcolors, numberOfMessages),
|
||||
m_skipView(KDFont::SmallFont, I18n::Message::Skip, 1.0f, 0.5f),
|
||||
m_okView()
|
||||
@@ -42,7 +42,7 @@ void PromptController::MessageViewWithSkip::layoutSubviews(bool force) {
|
||||
m_okView.setFrame(KDRect(width - okSize.width()-k_okMargin, height-okSize.height()-k_okMargin, okSize), force);
|
||||
}
|
||||
|
||||
PromptController::PromptController(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages) :
|
||||
PromptController::PromptController(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages) :
|
||||
ViewController(nullptr),
|
||||
m_messageViewWithSkip(messages, fgcolors, bgcolors, numberOfMessages)
|
||||
{
|
||||
|
||||
@@ -10,13 +10,13 @@ namespace OnBoarding {
|
||||
|
||||
class PromptController : public ViewController {
|
||||
public:
|
||||
PromptController(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages);
|
||||
PromptController(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages);
|
||||
View * view() override { return &m_messageViewWithSkip; }
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
private:
|
||||
class MessageViewWithSkip : public MessageView {
|
||||
public:
|
||||
MessageViewWithSkip(I18n::Message * messages, KDColor const * fgcolors[], KDColor const * bgcolors[], uint8_t numberOfMessages);
|
||||
MessageViewWithSkip(I18n::Message * messages, KDColor * fgcolors, KDColor * bgcolors, uint8_t numberOfMessages);
|
||||
protected:
|
||||
int numberOfSubviews() const override;
|
||||
View * subviewAtIndex(int index) override;
|
||||
|
||||
@@ -85,11 +85,11 @@ App::App(Snapshot * snapshot) :
|
||||
{
|
||||
switch (snapshot->activePage()) {
|
||||
case Snapshot::Page::Parameters:
|
||||
m_stackViewController.push(&m_parametersController, *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder);
|
||||
m_stackViewController.push(&m_parametersController, Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder);
|
||||
break;
|
||||
case Snapshot::Page::Calculations:
|
||||
m_stackViewController.push(&m_parametersController, *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder);
|
||||
m_stackViewController.push(&m_calculationController, *Palette::BannerSecondText, *Palette::BannerSecondBackground, *Palette::BannerSecondBorder);
|
||||
m_stackViewController.push(&m_parametersController, Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder);
|
||||
m_stackViewController.push(&m_calculationController, Palette::BannerSecondText, Palette::BannerSecondBackground, Palette::BannerSecondBorder);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -38,10 +38,10 @@ KDSize CalculationCell::minimalSizeForOptimalDisplay() const {
|
||||
}
|
||||
|
||||
void CalculationCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), *Palette::BackgroundHard);
|
||||
ctx->fillRect(bounds(), Palette::BackgroundHard);
|
||||
if (m_isResponder) {
|
||||
KDSize textSize = m_text.minimalSizeForOptimalDisplay();
|
||||
ctx->strokeRect(KDRect(2*k_margin+textSize.width(), 0, calculationCellWidth()+2*ResponderImageCell::k_outline, ImageCell::k_height+2*ResponderImageCell::k_outline), *Palette::ProbabilityCellBorder);
|
||||
ctx->strokeRect(KDRect(2*k_margin+textSize.width(), 0, calculationCellWidth()+2*ResponderImageCell::k_outline, ImageCell::k_height+2*ResponderImageCell::k_outline), Palette::ProbabilityCellBorder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Probability {
|
||||
constexpr int CalculationController::k_titleBufferSize;
|
||||
|
||||
CalculationController::ContentView::ContentView(SelectableTableView * selectableTableView, Distribution * distribution, Calculation * calculation) :
|
||||
m_titleView(KDFont::SmallFont, I18n::Message::ComputeProbability, 0.5f, 0.5f, *Palette::SecondaryText, *Palette::BackgroundApps),
|
||||
m_titleView(KDFont::SmallFont, I18n::Message::ComputeProbability, 0.5f, 0.5f, Palette::SecondaryText, Palette::BackgroundApps),
|
||||
m_selectableTableView(selectableTableView),
|
||||
m_distributionCurveView(distribution, calculation)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ CalculationController::CalculationController(Responder * parentResponder, InputE
|
||||
m_selectableTableView.setMargins(k_tableMargin);
|
||||
m_selectableTableView.setVerticalCellOverlap(0);
|
||||
m_selectableTableView.setDecoratorType(ScrollView::Decorator::Type::None);
|
||||
m_selectableTableView.setBackgroundColor(*Palette::BackgroundHard);
|
||||
m_selectableTableView.setBackgroundColor(Palette::BackgroundHard);
|
||||
|
||||
|
||||
for (int i = 0; i < k_numberOfCalculationCells; i++) {
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Probability {
|
||||
|
||||
Cell::Cell() :
|
||||
HighlightCell(),
|
||||
m_labelView(KDFont::LargeFont, (I18n::Message)0, 0, 0.5, *Palette::PrimaryText, *Palette::BackgroundHard),
|
||||
m_labelView(KDFont::LargeFont, (I18n::Message)0, 0, 0.5, Palette::PrimaryText, Palette::BackgroundHard),
|
||||
m_icon(nullptr),
|
||||
m_focusedIcon(nullptr)
|
||||
{
|
||||
@@ -36,7 +36,7 @@ void Cell::layoutSubviews(bool force) {
|
||||
|
||||
void Cell::reloadCell() {
|
||||
HighlightCell::reloadCell();
|
||||
KDColor backgroundColor = isHighlighted()? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
KDColor backgroundColor = isHighlighted()? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
m_labelView.setBackgroundColor(backgroundColor);
|
||||
if (isHighlighted()) {
|
||||
m_iconView.setImage(m_focusedIcon);
|
||||
@@ -57,12 +57,12 @@ void Cell::setImage(const Image * image, const Image * focusedImage) {
|
||||
void Cell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate width = bounds().width();
|
||||
KDCoordinate height = bounds().height();
|
||||
KDColor backgroundColor = isHighlighted() ? *Palette::ListCellBackgroundSelected : *Palette::ListCellBackground;
|
||||
KDColor backgroundColor = isHighlighted() ? Palette::ListCellBackgroundSelected : Palette::ListCellBackground;
|
||||
ctx->fillRect(KDRect(1, 1, width-2, height-1), backgroundColor);
|
||||
ctx->fillRect(KDRect(0, 0, width, 1), *Palette::ProbabilityCellBorder);
|
||||
ctx->fillRect(KDRect(0, 1, 1, height-1), *Palette::ProbabilityCellBorder);
|
||||
ctx->fillRect(KDRect(width-1, 1, 1, height-1), *Palette::ProbabilityCellBorder);
|
||||
ctx->fillRect(KDRect(0, height-1, width, 1), *Palette::ProbabilityCellBorder);
|
||||
ctx->fillRect(KDRect(0, 0, width, 1), Palette::ProbabilityCellBorder);
|
||||
ctx->fillRect(KDRect(0, 1, 1, height-1), Palette::ProbabilityCellBorder);
|
||||
ctx->fillRect(KDRect(width-1, 1, 1, height-1), Palette::ProbabilityCellBorder);
|
||||
ctx->fillRect(KDRect(0, height-1, width, 1), Palette::ProbabilityCellBorder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ bool Probability::DistributionController::handleEvent(Ion::Events::Event event)
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
|
||||
StackViewController * stack = (StackViewController *)parentResponder();
|
||||
setDistributionAccordingToIndex(selectedRow());
|
||||
stack->push(m_parametersController, *Palette::BannerFirstText, *Palette::BannerFirstBackground, *Palette::BannerFirstBorder);
|
||||
stack->push(m_parametersController, Palette::BannerFirstText, Palette::BannerFirstBackground, Palette::BannerFirstBorder);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -26,7 +26,7 @@ private:
|
||||
class ContentView : public View {
|
||||
public:
|
||||
ContentView(SelectableTableView * selectableTableView) :
|
||||
m_titleView(KDFont::SmallFont, I18n::Message::ChooseDistribution, 0.5f, 0.5f, *Palette::SecondaryText, *Palette::BackgroundApps),
|
||||
m_titleView(KDFont::SmallFont, I18n::Message::ChooseDistribution, 0.5f, 0.5f, Palette::SecondaryText, Palette::BackgroundApps),
|
||||
m_selectableTableView(selectableTableView)
|
||||
{}
|
||||
constexpr static KDCoordinate k_titleMargin = 8;
|
||||
|
||||
@@ -6,7 +6,7 @@ using namespace Shared;
|
||||
|
||||
namespace Probability {
|
||||
|
||||
KDColor const * DistributionCurveView::k_backgroundColor = Palette::BackgroundApps;
|
||||
constexpr KDColor DistributionCurveView::k_backgroundColor;
|
||||
|
||||
void DistributionCurveView::reload() {
|
||||
CurveView::reload();
|
||||
@@ -16,9 +16,9 @@ void DistributionCurveView::reload() {
|
||||
void DistributionCurveView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
float lowerBound = m_calculation->lowerBound();
|
||||
float upperBound = m_calculation->upperBound();
|
||||
ctx->fillRect(bounds(), *k_backgroundColor);
|
||||
ctx->fillRect(bounds(), k_backgroundColor);
|
||||
drawAxis(ctx, rect, Axis::Horizontal);
|
||||
drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, false, false, 0, *k_backgroundColor);
|
||||
drawLabelsAndGraduations(ctx, rect, Axis::Horizontal, false, false, false, 0, k_backgroundColor);
|
||||
if (m_distribution->type() == Distribution::Type::Normal) {
|
||||
/* Special case for the normal distribution, which has always the same curve
|
||||
* We indicate the pixels from and to which we color under the curve, not
|
||||
@@ -29,9 +29,9 @@ void DistributionCurveView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
return;
|
||||
}
|
||||
if (m_distribution->isContinuous()) {
|
||||
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, m_distribution, nullptr, *Palette::ProbabilityCurve, true, true, lowerBound, upperBound);
|
||||
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, m_distribution, nullptr, Palette::ProbabilityCurve, true, true, lowerBound, upperBound);
|
||||
} else {
|
||||
drawHistogram(ctx, rect, EvaluateAtAbscissa, m_distribution, nullptr, 0, 1, false, *Palette::ProbabilityHistogramBar, *Palette::ProbabilityCurve, lowerBound, upperBound+0.5f);
|
||||
drawHistogram(ctx, rect, EvaluateAtAbscissa, m_distribution, nullptr, 0, 1, false, Palette::ProbabilityHistogramBar, Palette::ProbabilityCurve, lowerBound, upperBound+0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ void DistributionCurveView::drawStandardNormal(KDContext * ctx, KDRect rect, flo
|
||||
// Draw a centered reduced normal curve
|
||||
NormalDistribution n;
|
||||
constCastedThis->setCurveViewRange(&n);
|
||||
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, &n, nullptr, *Palette::ProbabilityCurve, true, true, pixelToFloat(Axis::Horizontal, colorLowerBoundPixel), pixelToFloat(Axis::Horizontal, colorUpperBoundPixel));
|
||||
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, EvaluateXYAtAbscissa, &n, nullptr, Palette::ProbabilityCurve, true, true, pixelToFloat(Axis::Horizontal, colorLowerBoundPixel), pixelToFloat(Axis::Horizontal, colorUpperBoundPixel));
|
||||
|
||||
// Put back the previous curve view range
|
||||
constCastedThis->setCurveViewRange(previousRange);
|
||||
|
||||
@@ -30,7 +30,7 @@ protected:
|
||||
private:
|
||||
static float EvaluateAtAbscissa(float abscissa, void * model, void * context);
|
||||
static Poincare::Coordinate2D<float> EvaluateXYAtAbscissa(float abscissa, void * model, void * context);
|
||||
static KDColor const * k_backgroundColor;
|
||||
static constexpr KDColor k_backgroundColor = Palette::BackgroundApps;
|
||||
void drawStandardNormal(KDContext * ctx, KDRect rect, float colorLowerBound, float colorUpperBound) const;
|
||||
char m_labels[k_maxNumberOfXLabels][k_labelBufferMaxSize];
|
||||
Distribution * m_distribution;
|
||||
|
||||
@@ -8,16 +8,16 @@ namespace Probability {
|
||||
|
||||
ParametersController::ContentView::ContentView(SelectableTableView * selectableTableView) :
|
||||
m_numberOfParameters(1),
|
||||
m_titleView(KDFont::SmallFont, I18n::Message::ChooseParameters, 0.5f, 0.5f, *Palette::SecondaryText, *Palette::BackgroundApps),
|
||||
m_firstParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps),
|
||||
m_secondParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, *Palette::PrimaryText, *Palette::BackgroundApps),
|
||||
m_titleView(KDFont::SmallFont, I18n::Message::ChooseParameters, 0.5f, 0.5f, Palette::SecondaryText, Palette::BackgroundApps),
|
||||
m_firstParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps),
|
||||
m_secondParameterDefinition(KDFont::SmallFont, (I18n::Message)0, 0.5f, 0.5f, Palette::PrimaryText, Palette::BackgroundApps),
|
||||
m_selectableTableView(selectableTableView)
|
||||
{
|
||||
}
|
||||
|
||||
void ParametersController::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
int tableHeight = m_selectableTableView->minimalSizeForOptimalDisplay().height();
|
||||
ctx->fillRect(KDRect(0, tableHeight, bounds().width(), bounds().height() - tableHeight), *Palette::BackgroundApps);
|
||||
ctx->fillRect(KDRect(0, tableHeight, bounds().width(), bounds().height() - tableHeight), Palette::BackgroundApps);
|
||||
}
|
||||
|
||||
MessageTextView * ParametersController::ContentView::parameterDefinitionAtIndex(int index) {
|
||||
@@ -161,7 +161,7 @@ bool ParametersController::textFieldDidFinishEditing(TextField * textField, cons
|
||||
|
||||
void ParametersController::buttonAction() {
|
||||
StackViewController * stack = stackController();
|
||||
stack->push(m_calculationController, *Palette::BannerSecondText, *Palette::BannerSecondBackground, *Palette::BannerSecondBorder);
|
||||
stack->push(m_calculationController, Palette::BannerSecondText, Palette::BannerSecondBackground, Palette::BannerSecondBorder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ ResponderImageCell::ResponderImageCell(Responder * parentResponder, Distribution
|
||||
}
|
||||
|
||||
void ResponderImageCell::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), *Palette::BackgroundHard);
|
||||
ctx->strokeRect(KDRect(0, 0, ImageCell::k_width+2*k_outline, ImageCell::k_height+2*k_outline), *Palette::ProbabilityCellBorder);
|
||||
ctx->fillRect(bounds(), Palette::BackgroundHard);
|
||||
ctx->strokeRect(KDRect(0, 0, ImageCell::k_width+2*k_outline, ImageCell::k_height+2*k_outline), Palette::ProbabilityCellBorder);
|
||||
}
|
||||
|
||||
KDSize ResponderImageCell::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -55,7 +55,7 @@ void ReadBookController::loadPosition() {
|
||||
else {
|
||||
m_readerView.setBookSave({
|
||||
0,
|
||||
*Palette::PrimaryText
|
||||
Palette::PrimaryText
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,7 +243,7 @@ void WordWrapTextView::setBookSave(BookSave save) {
|
||||
bool WordWrapTextView::updateTextColorForward(const char * colorStart) const {
|
||||
|
||||
if (*(colorStart + 1) == '\\') {
|
||||
m_textColor = *Palette::PrimaryText;
|
||||
m_textColor = Palette::PrimaryText;
|
||||
return (*(colorStart + 3) == '%' || *(colorStart + 4) == '%');
|
||||
}
|
||||
|
||||
@@ -254,56 +254,56 @@ bool WordWrapTextView::updateTextColorForward(const char * colorStart) const {
|
||||
{
|
||||
case 'r':
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = *Palette::RedLight;
|
||||
m_textColor = Palette::RedLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = *Palette::Red;
|
||||
m_textColor = Palette::Red;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
m_textColor = *Palette::Magenta;
|
||||
m_textColor = Palette::Magenta;
|
||||
break;
|
||||
case 't':
|
||||
m_textColor = *Palette::Turquoise;
|
||||
m_textColor = Palette::Turquoise;
|
||||
break;
|
||||
case 'p':
|
||||
if (*(colorStart+2) == 'k') {
|
||||
m_textColor = *Palette::Pink;
|
||||
m_textColor = Palette::Pink;
|
||||
keySize = 2;
|
||||
}
|
||||
else if (*(colorStart+2) == 'p') {
|
||||
m_textColor = *Palette::Purple;
|
||||
m_textColor = Palette::Purple;
|
||||
keySize = 2;
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if (*(colorStart+2) == 'r') {
|
||||
m_textColor = *Palette::Brown;
|
||||
m_textColor = Palette::Brown;
|
||||
keySize = 2;
|
||||
}
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = *Palette::BlueLight;
|
||||
m_textColor = Palette::BlueLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = *Palette::Blue;
|
||||
m_textColor = Palette::Blue;
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
m_textColor = *Palette::Orange;
|
||||
m_textColor = Palette::Orange;
|
||||
break;
|
||||
case 'g':
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = *Palette::GreenLight;
|
||||
m_textColor = Palette::GreenLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = *Palette::Green;
|
||||
m_textColor = Palette::Green;
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
m_textColor = *Palette::Cyan;
|
||||
m_textColor = Palette::Cyan;
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -330,56 +330,56 @@ bool WordWrapTextView::updateTextColorBackward(const char * colorStart) const {
|
||||
{
|
||||
case 'r':
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = *Palette::RedLight;
|
||||
m_textColor = Palette::RedLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = *Palette::Red;
|
||||
m_textColor = Palette::Red;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
m_textColor = *Palette::Magenta;
|
||||
m_textColor = Palette::Magenta;
|
||||
break;
|
||||
case 't':
|
||||
m_textColor = *Palette::Turquoise;
|
||||
m_textColor = Palette::Turquoise;
|
||||
break;
|
||||
case 'p':
|
||||
if (*(colorStart+2) == 'k') {
|
||||
m_textColor = *Palette::Pink;
|
||||
m_textColor = Palette::Pink;
|
||||
keySize = 2;
|
||||
}
|
||||
else if (*(colorStart+2) == 'p') {
|
||||
m_textColor = *Palette::Purple;
|
||||
m_textColor = Palette::Purple;
|
||||
keySize = 2;
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if (*(colorStart+2) == 'r') {
|
||||
m_textColor = *Palette::Brown;
|
||||
m_textColor = Palette::Brown;
|
||||
keySize = 2;
|
||||
}
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = *Palette::BlueLight;
|
||||
m_textColor = Palette::BlueLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = *Palette::Blue;
|
||||
m_textColor = Palette::Blue;
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
m_textColor = *Palette::Orange;
|
||||
m_textColor = Palette::Orange;
|
||||
break;
|
||||
case 'g':
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = *Palette::GreenLight;
|
||||
m_textColor = Palette::GreenLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = *Palette::Green;
|
||||
m_textColor = Palette::Green;
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
m_textColor = *Palette::Cyan;
|
||||
m_textColor = Palette::Cyan;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -26,18 +26,18 @@ CalculationController::CalculationController(Responder * parentResponder, Button
|
||||
{
|
||||
m_r2Layout = HorizontalLayout::Builder(CodePointLayout::Builder('r', KDFont::SmallFont), VerticalOffsetLayout::Builder(CodePointLayout::Builder('2', KDFont::SmallFont), VerticalOffsetLayoutNode::Position::Superscript));
|
||||
m_selectableTableView.setVerticalCellOverlap(0);
|
||||
m_selectableTableView.setBackgroundColor(*Palette::BackgroundAppsSecondary);
|
||||
m_selectableTableView.setBackgroundColor(Palette::BackgroundAppsSecondary);
|
||||
m_selectableTableView.setMargins(k_margin, k_scrollBarMargin, k_scrollBarMargin, k_margin);
|
||||
m_r2TitleCell.setAlignment(1.0f, 0.5f);
|
||||
for (int i = 0; i < Store::k_numberOfSeries; i++) {
|
||||
m_columnTitleCells[i].setParentResponder(&m_selectableTableView);
|
||||
}
|
||||
for (int i = 0; i < k_numberOfDoubleCalculationCells; i++) {
|
||||
m_doubleCalculationCells[i].setTextColor(*Palette::SecondaryText);
|
||||
m_doubleCalculationCells[i].setTextColor(Palette::SecondaryText);
|
||||
m_doubleCalculationCells[i].setParentResponder(&m_selectableTableView);
|
||||
}
|
||||
for (int i = 0; i < k_numberOfCalculationCells;i++) {
|
||||
m_calculationCells[i].setTextColor(*Palette::SecondaryText);
|
||||
m_calculationCells[i].setTextColor(Palette::SecondaryText);
|
||||
}
|
||||
for (int i = 0; i < k_maxNumberOfDisplayableRows; i++) {
|
||||
m_titleCells[i].setMessageFont(KDFont::SmallFont);
|
||||
@@ -167,7 +167,7 @@ void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int
|
||||
buffer[0] = 'Y';
|
||||
myCell->setSecondText(buffer);
|
||||
assert(seriesNumber < Palette::numberOfDataColors());
|
||||
myCell->setColor(*Palette::DataColor[seriesNumber]);
|
||||
myCell->setColor(Palette::DataColor[seriesNumber]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class ColumnTitleCell : public EvenOddDoubleBufferTextCellWithSeparator {
|
||||
public:
|
||||
ColumnTitleCell(Responder * parentResponder = nullptr) :
|
||||
EvenOddDoubleBufferTextCellWithSeparator(parentResponder, 0.5f, 0.5f),
|
||||
m_functionColor(*Palette::Red)
|
||||
m_functionColor(Palette::Red)
|
||||
{
|
||||
}
|
||||
virtual void setColor(KDColor color);
|
||||
|
||||
@@ -391,7 +391,7 @@ void GraphController::setRoundCrossCursorView() {
|
||||
if (round) {
|
||||
// Set the color although the cursor view stays round
|
||||
assert(*m_selectedSeriesIndex < Palette::numberOfDataColors());
|
||||
m_roundCursorView.setColor(*Palette::DataColor[*m_selectedSeriesIndex]);
|
||||
m_roundCursorView.setColor(Palette::DataColor[*m_selectedSeriesIndex]);
|
||||
}
|
||||
CursorView * nextCursorView = round ? static_cast<Shared::CursorView *>(&m_roundCursorView) : static_cast<Shared::CursorView *>(&m_crossCursorView);
|
||||
// Escape if the cursor view stays the same
|
||||
|
||||
@@ -15,7 +15,7 @@ GraphView::GraphView(Store * store, CurveViewCursor * cursor, BannerView * banne
|
||||
}
|
||||
|
||||
void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(rect, *Palette::BackgroundHard);
|
||||
ctx->fillRect(rect, Palette::BackgroundHard);
|
||||
drawGrid(ctx, rect);
|
||||
drawAxes(ctx, rect);
|
||||
simpleDrawBothAxesLabels(ctx, rect);
|
||||
@@ -23,7 +23,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
for (int series = 0; series < Store::k_numberOfSeries; series++) {
|
||||
if (!m_store->seriesIsEmpty(series)) {
|
||||
assert(series < Palette::numberOfDataColors());
|
||||
KDColor color = *Palette::DataColor[series];
|
||||
KDColor color = Palette::DataColor[series];
|
||||
Model * seriesModel = m_store->modelForSeries(series);
|
||||
drawCartesianCurve(ctx, rect, -INFINITY, INFINITY, [](float abscissa, void * model, void * context) {
|
||||
Model * regressionModel = static_cast<Model *>(model);
|
||||
@@ -35,7 +35,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
drawDot(ctx, rect, m_store->get(series, 0, index), m_store->get(series, 1, index), color);
|
||||
}
|
||||
drawDot(ctx, rect, m_store->meanOfColumn(series, 0), m_store->meanOfColumn(series, 1), color, Size::Small);
|
||||
drawDot(ctx, rect, m_store->meanOfColumn(series, 0), m_store->meanOfColumn(series, 1), *Palette::BackgroundHard);
|
||||
drawDot(ctx, rect, m_store->meanOfColumn(series, 0), m_store->meanOfColumn(series, 1), Palette::BackgroundHard);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ void StoreController::willDisplayCellAtLocation(HighlightCell * cell, int i, int
|
||||
bool isValuesColumn = i%Store::k_numberOfColumnsPerSeries == 0;
|
||||
mytitleCell->setSeparatorLeft(isValuesColumn && i > 0);
|
||||
int seriesIndex = i/Store::k_numberOfColumnsPerSeries;
|
||||
mytitleCell->setColor(m_store->numberOfPairsOfSeries(seriesIndex) == 0 ? *Palette::SecondaryText : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GreyDark with graph/list_controller and statistics/store_controller
|
||||
mytitleCell->setColor(m_store->numberOfPairsOfSeries(seriesIndex) == 0 ? Palette::SecondaryText : Store::colorOfSeriesAtIndex(seriesIndex)); // TODO Share GreyDark with graph/list_controller and statistics/store_controller
|
||||
char name[] = {isValuesColumn ? 'X' : 'Y', static_cast<char>('1' + seriesIndex), 0};
|
||||
mytitleCell->setText(name);
|
||||
}
|
||||
|
||||
2
apps/rpn
2
apps/rpn
Submodule apps/rpn updated: 76d065ebf7...b51172c32f
@@ -30,7 +30,7 @@ void GraphView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
}
|
||||
drawDot(ctx, rect, x, y, s->color());
|
||||
if (x >= m_highlightedStart && x <= m_highlightedEnd && record == m_selectedRecord) {
|
||||
KDColor color = m_shouldColorHighlighted ? s->color() : *Palette::PrimaryText;
|
||||
KDColor color = m_shouldColorHighlighted ? s->color() : Palette::PrimaryText;
|
||||
if (y >= 0.0f) {
|
||||
drawHorizontalOrVerticalSegment(ctx, rect, Axis::Vertical, x, 0.0f, y, color, 1);
|
||||
} else {
|
||||
|
||||
@@ -15,7 +15,7 @@ ListController::ListController(Responder * parentResponder, ::InputEventHandlerD
|
||||
m_expressionCells{},
|
||||
m_parameterController(inputEventHandlerDelegate, this),
|
||||
m_typeParameterController(this, this, TableCell::Layout::Vertical),
|
||||
m_typeStackController(nullptr, &m_typeParameterController, *Palette::ToolboxHeaderText, *Palette::ToolboxHeaderBackground, *Palette::ToolboxHeaderBorder),
|
||||
m_typeStackController(nullptr, &m_typeParameterController, Palette::ToolboxHeaderText, Palette::ToolboxHeaderBackground, Palette::ToolboxHeaderBorder),
|
||||
m_sequenceToolbox()
|
||||
{
|
||||
for (int i = 0; i < k_maxNumberOfRows; i++) {
|
||||
@@ -191,7 +191,7 @@ void ListController::willDisplayTitleCellAtIndex(HighlightCell * cell, int j) {
|
||||
myCell->setLayout(sequence->secondInitialConditionName());
|
||||
}
|
||||
// Set the color
|
||||
KDColor nameColor = sequence->isActive() ? sequence->color() : *Palette::SecondaryText;
|
||||
KDColor nameColor = sequence->isActive() ? sequence->color() : Palette::SecondaryText;
|
||||
myCell->setColor(nameColor);
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ void ListController::willDisplayExpressionCellAtIndex(HighlightCell * cell, int
|
||||
myCell->setLayout(sequence->secondInitialConditionLayout());
|
||||
}
|
||||
bool active = sequence->isActive();
|
||||
KDColor textColor = active ? *Palette::PrimaryText : *Palette::SecondaryText;
|
||||
KDColor textColor = active ? Palette::PrimaryText : Palette::SecondaryText;
|
||||
myCell->setTextColor(textColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ void CellWithSeparator::setHighlighted(bool highlight) {
|
||||
}
|
||||
|
||||
void CellWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(KDRect(0, Metric::CellSeparatorThickness, bounds().width(), k_margin), *Palette::BackgroundApps);
|
||||
ctx->fillRect(KDRect(0, Metric::CellSeparatorThickness, bounds().width(), k_margin), Palette::BackgroundApps);
|
||||
}
|
||||
|
||||
int CellWithSeparator::numberOfSubviews() const {
|
||||
|
||||
@@ -15,7 +15,8 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
SettingsMessageTree(I18n::Message::ExamMode, ExamModeConfiguration::s_modelExamChildren),
|
||||
#ifdef HAS_CODE
|
||||
SettingsMessageTree(I18n::Message::CodeApp, s_codeChildren),
|
||||
#endif SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren),
|
||||
#endif
|
||||
SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren),
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren)};
|
||||
|
||||
constexpr SettingsMessageTree s_model = SettingsMessageTree(I18n::Message::SettingsApp, s_modelMenu);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user