mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Compare commits
4 Commits
upsilon-de
...
upsilon-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8a1bc6149 | ||
|
|
b304a2ff7d | ||
|
|
50ee8021f3 | ||
|
|
ed7e0bd915 |
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -23,5 +23,7 @@ A clear and concise description of what you expected to happen.
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
**Device (please complete the following information):**
|
||||
- The device on which you're running Upsilon (computer, n0110, n0100, etc...)
|
||||
- Upsilon Version: [go to settings > about > Upsilon Version and type the version here]
|
||||
- Upsilon commit: [settings > about > click one time on epsilon version]
|
||||
|
||||
@@ -138,7 +138,7 @@ bool AppsContainer::dispatchEvent(Ion::Events::Event event) {
|
||||
Ion::LED::updateColorWithPlugAndCharge();
|
||||
}
|
||||
if (event == Ion::Events::USBEnumeration) {
|
||||
if (Ion::USB::isPlugged()) {
|
||||
if (Ion::USB::isPlugged() && GlobalPreferences::sharedGlobalPreferences()->getDfuLevel() != 3) {
|
||||
App::Snapshot * activeSnapshot = (s_activeApp == nullptr ? appSnapshotAtIndex(0) : s_activeApp->snapshot());
|
||||
/* Just after a software update, the battery timer does not have time to
|
||||
* fire before the calculator enters DFU mode. As the DFU mode blocks the
|
||||
@@ -147,7 +147,9 @@ bool AppsContainer::dispatchEvent(Ion::Events::Event event) {
|
||||
* pictogram. */
|
||||
updateBatteryState();
|
||||
if (switchTo(usbConnectedAppSnapshot())) {
|
||||
Ion::USB::DFU();
|
||||
Ion::USB::DFU(true, GlobalPreferences::sharedGlobalPreferences()->dfuStatus(), GlobalPreferences::sharedGlobalPreferences()->getDfuLevel());
|
||||
GlobalPreferences::sharedGlobalPreferences()->dfuResetStep();
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuStatus(false);
|
||||
// Update LED when exiting DFU mode
|
||||
Ion::LED::updateColorWithPlugAndCharge();
|
||||
bool switched = switchTo(activeSnapshot);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,15 @@ public:
|
||||
void setTempExamMode(ExamMode examMode);
|
||||
bool showPopUp() const { return m_showPopUp; }
|
||||
void setShowPopUp(bool showPopUp) { m_showPopUp = showPopUp; }
|
||||
bool dfuStatus() const { return m_dfuUnlocked; }
|
||||
void setDfuStatus(bool status) { m_dfuUnlocked=status; }
|
||||
int dfuCurrentStep() const { return m_dfuStep; }
|
||||
void dfuIncreaseStep() { m_dfuStep++; }
|
||||
void dfuResetStep() { m_dfuStep = 0; }
|
||||
int getDfuLevel() const { return m_dfuProtectLevel; }
|
||||
void setDfuLevel(int level) { m_dfuProtectLevel = level; }
|
||||
bool showDfuDeacAlert() const { return m_showDeacAlert; }
|
||||
void setDfuDeacAlert(bool value) { m_showDeacAlert = value; }
|
||||
bool autocomplete() const { return m_autoComplete; }
|
||||
void setAutocomplete(bool autocomple) { m_autoComplete = autocomple; }
|
||||
int brightnessLevel() const { return m_brightnessLevel; }
|
||||
@@ -37,6 +46,7 @@ public:
|
||||
const KDFont * font() const { return m_font; }
|
||||
void setFont(const KDFont * font) { m_font = font; }
|
||||
constexpr static int NumberOfBrightnessStates = 15;
|
||||
constexpr static int DfuUnlockStep = 3;
|
||||
private:
|
||||
static_assert(I18n::NumberOfLanguages > 0, "I18n::NumberOfLanguages is not superior to 0"); // There should already have been an error when processing an empty EPSILON_I18N flag
|
||||
static_assert(I18n::NumberOfCountries > 0, "I18n::NumberOfCountries is not superior to 0"); // There should already have been an error when processing an empty EPSILON_COUNTRIES flag
|
||||
@@ -46,6 +56,10 @@ private:
|
||||
m_examMode(ExamMode::Unknown),
|
||||
m_tempExamMode(ExamMode::Standard),
|
||||
m_showPopUp(true),
|
||||
m_dfuUnlocked(false),
|
||||
m_dfuStep(0),
|
||||
m_dfuProtectLevel(0),
|
||||
m_showDeacAlert(true),
|
||||
m_autoComplete(true),
|
||||
m_brightnessLevel(Ion::Backlight::MaxBrightness),
|
||||
m_font(KDFont::LargeFont) {}
|
||||
@@ -56,6 +70,10 @@ private:
|
||||
mutable ExamMode m_examMode;
|
||||
mutable ExamMode m_tempExamMode;
|
||||
bool m_showPopUp;
|
||||
bool m_dfuUnlocked;
|
||||
int m_dfuStep;
|
||||
int m_dfuProtectLevel; // 0: default; 1: OmegaMode; 2: Paranoid; 3: Paranoid++
|
||||
bool m_showDeacAlert;
|
||||
bool m_autoComplete;
|
||||
int m_brightnessLevel;
|
||||
const KDFont * m_font;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,3 +2,5 @@ Apps = "Anwendungen"
|
||||
AppsCapital = "UPSILON"
|
||||
ForbidenAppInExamMode1 = "Diese Anwendung ist im"
|
||||
ForbidenAppInExamMode2 = "Prüfungsmodus nicht erlaubt."
|
||||
DfuWarning1 = "DFU-Schutzwarnung"
|
||||
DfuWarning2 = "Mehr Informationen: bit.ly/upsiDfu"
|
||||
|
||||
@@ -2,3 +2,5 @@ Apps = "Applications"
|
||||
AppsCapital = "UPSILON"
|
||||
ForbidenAppInExamMode1 = "This application is"
|
||||
ForbidenAppInExamMode2 = "forbidden in exam mode"
|
||||
DfuWarning1 = "DFU Protection Warning"
|
||||
DfuWarning2 = "More informations: bit.ly/upsiDfu"
|
||||
|
||||
@@ -2,3 +2,5 @@ Apps = "Aplicaciones"
|
||||
AppsCapital = "UPSILON"
|
||||
ForbidenAppInExamMode1 = "Esta aplicación está prohibida"
|
||||
ForbidenAppInExamMode2 = "en el modo de examen"
|
||||
DfuWarning1 = "Advertencia de protección DFU"
|
||||
DfuWarning2 = "Más información: bit.ly/upsiDfu"
|
||||
|
||||
@@ -2,3 +2,5 @@ Apps = "Applications"
|
||||
AppsCapital = "UPSILON"
|
||||
ForbidenAppInExamMode1 = "Cette application n'est"
|
||||
ForbidenAppInExamMode2 = "pas autorisée en mode examen."
|
||||
DfuWarning1 = "Alerte protection DFU"
|
||||
DfuWarning2 = "Plus d'infos: bit.ly/upsiDfu"
|
||||
|
||||
@@ -2,3 +2,5 @@ Apps = "Alkalmazások"
|
||||
AppsCapital = "UPSILON"
|
||||
ForbidenAppInExamMode1 = "Ez az alkalmazás"
|
||||
ForbidenAppInExamMode2 = "tilos vizsga módban"
|
||||
DfuWarning1 = "DFU védelmi figyelmeztetés"
|
||||
DfuWarning2 = "További információk: bit.ly/upsiDfu"
|
||||
|
||||
@@ -2,3 +2,5 @@ Apps = "Applicazioni"
|
||||
AppsCapital = "UPSILON"
|
||||
ForbidenAppInExamMode1 = "Questa applicazione è"
|
||||
ForbidenAppInExamMode2 = "proibita nella modalità d'esame"
|
||||
DfuWarning1 = "Avviso protezione DFU"
|
||||
DfuWarning2 = "Più informazioni: bit.ly/upsiDfu"
|
||||
|
||||
@@ -2,3 +2,5 @@ Apps = "Applicaties"
|
||||
AppsCapital = "UPSILON"
|
||||
ForbidenAppInExamMode1 = "Deze applicatie is"
|
||||
ForbidenAppInExamMode2 = "uitgesloten in examenstand"
|
||||
DfuWarning1 = "DFU-beveiligingswaarschuwing"
|
||||
DfuWarning2 = "Meer informatie: bit.ly/upsiDfu"
|
||||
|
||||
@@ -2,3 +2,5 @@ Apps = "Aplicações"
|
||||
AppsCapital = "UPSILON"
|
||||
ForbidenAppInExamMode1 = "Esta aplicação é"
|
||||
ForbidenAppInExamMode2 = "proibida no Modo de Exame"
|
||||
DfuWarning1 = "Aviso de proteção DFU"
|
||||
DfuWarning2 = "Mais informações: bit.ly/upsiDfu"
|
||||
|
||||
@@ -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
|
||||
@@ -87,9 +87,33 @@ Controller::Controller(Responder * parentResponder, SelectableTableViewDataSourc
|
||||
}
|
||||
|
||||
bool Controller::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::Six) {
|
||||
GlobalPreferences::sharedGlobalPreferences()->dfuIncreaseStep();
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->dfuCurrentStep() >= GlobalPreferences::DfuUnlockStep && !GlobalPreferences::sharedGlobalPreferences()->dfuStatus()) {
|
||||
if (!GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
|
||||
Ion::LED::setColor(KDColorPurple);
|
||||
Ion::LED::setBlinking(500, 0.5f);
|
||||
}
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuStatus(true);
|
||||
App::app()->displayWarning(I18n::Message::DfuWarning1, I18n::Message::DfuWarning2);
|
||||
return true;
|
||||
} else if (GlobalPreferences::sharedGlobalPreferences()->dfuStatus()) {
|
||||
if (!GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
|
||||
Ion::LED::setColor(KDColorBlack);
|
||||
}
|
||||
GlobalPreferences::sharedGlobalPreferences()->dfuResetStep();
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuStatus(false);
|
||||
}
|
||||
}
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
AppsContainer * container = AppsContainer::sharedAppsContainer();
|
||||
|
||||
if (!GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
|
||||
Ion::LED::setColor(KDColorBlack);
|
||||
}
|
||||
GlobalPreferences::sharedGlobalPreferences()->dfuResetStep();
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuStatus(false);
|
||||
|
||||
int index = selectionDataSource()->selectedRow()*k_numberOfColumns+selectionDataSource()->selectedColumn()+1;
|
||||
#ifdef HOME_DISPLAY_EXTERNALS
|
||||
if (index >= container->numberOfApps()) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 9.8 KiB |
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ app_settings_src = $(addprefix apps/settings/,\
|
||||
sub_menu/contributors_controller.cpp \
|
||||
sub_menu/math_options_controller.cpp \
|
||||
sub_menu/selectable_view_with_messages.cpp \
|
||||
sub_menu/usb_info_controller.cpp \
|
||||
sub_menu/usb_protection_level_controller.cpp \
|
||||
)
|
||||
|
||||
SFLAGS += -DOMEGA_STATE="$(OMEGA_STATE)"
|
||||
|
||||
@@ -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,6 +15,8 @@ constexpr SettingsMessageTree s_modelFloatDisplayModeChildren[4] = {SettingsMess
|
||||
constexpr SettingsMessageTree s_modelComplexFormatChildren[3] = {SettingsMessageTree(I18n::Message::Real), SettingsMessageTree(I18n::Message::Cartesian), SettingsMessageTree(I18n::Message::Polar)};
|
||||
constexpr SettingsMessageTree s_modelDateTimeChildren[3] = {SettingsMessageTree(I18n::Message::ActivateClock), SettingsMessageTree(I18n::Message::Date), SettingsMessageTree(I18n::Message::Time)};
|
||||
constexpr SettingsMessageTree s_symbolChildren[4] = {SettingsMessageTree(I18n::Message::SymbolMultiplicationCross),SettingsMessageTree(I18n::Message::SymbolMultiplicationMiddleDot),SettingsMessageTree(I18n::Message::SymbolMultiplicationStar),SettingsMessageTree(I18n::Message::SymbolMultiplicationAutoSymbol)};
|
||||
constexpr SettingsMessageTree s_usbLevelSelector[3] = {SettingsMessageTree(I18n::Message::USBDefaultLevel), SettingsMessageTree(I18n::Message::USBLowLevel), SettingsMessageTree(I18n::Message::USBParanoidLevel)}; // , SettingsMessageTree(I18n::Message::USBMegaParanoidLevel)
|
||||
constexpr SettingsMessageTree s_usbSteps[2] = {SettingsMessageTree(I18n::Message::USBProtection), SettingsMessageTree(I18n::Message::USBLevelProtect, s_usbLevelSelector)};
|
||||
constexpr SettingsMessageTree s_symbolFunctionChildren[3] = {SettingsMessageTree(I18n::Message::SymbolDefaultFunction), SettingsMessageTree(I18n::Message::SymbolArgDefaultFunction), SettingsMessageTree(I18n::Message::SymbolArgFunction)};
|
||||
constexpr SettingsMessageTree s_modelMathOptionsChildren[6] = {SettingsMessageTree(I18n::Message::AngleUnit, s_modelAngleChildren), SettingsMessageTree(I18n::Message::DisplayMode, s_modelFloatDisplayModeChildren), SettingsMessageTree(I18n::Message::EditionMode, s_modelEditionModeChildren), SettingsMessageTree(I18n::Message::SymbolFunction, s_symbolFunctionChildren), SettingsMessageTree(I18n::Message::ComplexFormat, s_modelComplexFormatChildren), SettingsMessageTree(I18n::Message::SymbolMultiplication, s_symbolChildren)};
|
||||
constexpr SettingsMessageTree s_accessibilityChildren[6] = {SettingsMessageTree(I18n::Message::AccessibilityInvertColors), SettingsMessageTree(I18n::Message::AccessibilityMagnify),SettingsMessageTree(I18n::Message::AccessibilityGamma),SettingsMessageTree(I18n::Message::AccessibilityGammaRed),SettingsMessageTree(I18n::Message::AccessibilityGammaGreen),SettingsMessageTree(I18n::Message::AccessibilityGammaBlue)};
|
||||
@@ -41,7 +43,8 @@ MainController::MainController(Responder * parentResponder, InputEventHandlerDel
|
||||
m_codeOptionsController(this),
|
||||
m_examModeController(this),
|
||||
m_aboutController(this),
|
||||
m_preferencesController(this)
|
||||
m_preferencesController(this),
|
||||
m_usbInfoController(this)
|
||||
{
|
||||
for (int i = 0; i < k_numberOfSimpleChevronCells; i++) {
|
||||
m_cells[i].setMessageFont(KDFont::LargeFont);
|
||||
@@ -111,6 +114,8 @@ bool MainController::handleEvent(Ion::Events::Event event) {
|
||||
subController = &m_dateTimeController;
|
||||
} else if (title == I18n::Message::MathOptions) {
|
||||
subController = &m_mathOptionsController;
|
||||
} else if (title == I18n::Message::UsbSetting) {
|
||||
subController = &m_usbInfoController;
|
||||
} else if (title == I18n::Message::CodeApp) {
|
||||
subController = &m_codeOptionsController;
|
||||
} else {
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "sub_menu/localization_controller.h"
|
||||
#include "sub_menu/math_options_controller.h"
|
||||
#include "sub_menu/preferences_controller.h"
|
||||
#include "sub_menu/usb_info_controller.h"
|
||||
|
||||
namespace Settings {
|
||||
|
||||
@@ -28,6 +29,8 @@ extern const Shared::SettingsMessageTree s_modelDateTimeChildren[3];
|
||||
extern const Shared::SettingsMessageTree s_accessibilityChildren[6];
|
||||
extern const Shared::SettingsMessageTree s_contributorsChildren[23];
|
||||
extern const Shared::SettingsMessageTree s_modelAboutChildren[9];
|
||||
extern const Shared::SettingsMessageTree s_usbLevelSelector[3];
|
||||
extern const Shared::SettingsMessageTree s_usbSteps[2];
|
||||
extern const Shared::SettingsMessageTree s_model;
|
||||
|
||||
class MainController : public ViewController, public ListViewDataSource, public SelectableTableViewDataSource {
|
||||
@@ -76,6 +79,7 @@ private:
|
||||
ExamModeController m_examModeController;
|
||||
AboutController m_aboutController;
|
||||
PreferencesController m_preferencesController;
|
||||
UsbInfoController m_usbInfoController;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
#endif
|
||||
SettingsMessageTree(I18n::Message::BetaPopUp),
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren),
|
||||
SettingsMessageTree(I18n::Message::UsbSetting, s_usbSteps),
|
||||
SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren)};
|
||||
|
||||
constexpr SettingsMessageTree s_model = SettingsMessageTree(I18n::Message::SettingsApp, s_modelMenu);
|
||||
|
||||
@@ -1,27 +1,30 @@
|
||||
#include "main_controller.h"
|
||||
#include "../exam_mode_configuration.h"
|
||||
#include <apps/i18n.h>
|
||||
|
||||
#include "../exam_mode_configuration.h"
|
||||
#include "main_controller.h"
|
||||
|
||||
using namespace Shared;
|
||||
|
||||
namespace Settings {
|
||||
|
||||
constexpr SettingsMessageTree s_modelMenu[] =
|
||||
{SettingsMessageTree(I18n::Message::MathOptions, s_modelMathOptionsChildren),
|
||||
SettingsMessageTree(I18n::Message::Brightness),
|
||||
SettingsMessageTree(I18n::Message::DateTime, s_modelDateTimeChildren),
|
||||
SettingsMessageTree(I18n::Message::Language),
|
||||
SettingsMessageTree(I18n::Message::Country),
|
||||
SettingsMessageTree(I18n::Message::ExamMode, ExamModeConfiguration::s_modelExamChildren),
|
||||
{SettingsMessageTree(I18n::Message::MathOptions, s_modelMathOptionsChildren),
|
||||
SettingsMessageTree(I18n::Message::Brightness),
|
||||
SettingsMessageTree(I18n::Message::DateTime, s_modelDateTimeChildren),
|
||||
SettingsMessageTree(I18n::Message::Language),
|
||||
SettingsMessageTree(I18n::Message::Country),
|
||||
SettingsMessageTree(I18n::Message::ExamMode, ExamModeConfiguration::s_modelExamChildren),
|
||||
#ifdef HAS_CODE
|
||||
SettingsMessageTree(I18n::Message::CodeApp, s_codeChildren),
|
||||
#endif SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren),
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren)};
|
||||
SettingsMessageTree(I18n::Message::CodeApp, s_codeChildren),
|
||||
#endif
|
||||
SettingsMessageTree(I18n::Message::UsbSetting, s_usbSteps),
|
||||
SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren),
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren)};
|
||||
|
||||
constexpr SettingsMessageTree s_model = SettingsMessageTree(I18n::Message::SettingsApp, s_modelMenu);
|
||||
|
||||
I18n::Message MainController::promptMessage() const {
|
||||
return I18n::Message::Default;
|
||||
return I18n::Message::Default;
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace Settings
|
||||
|
||||
@@ -15,8 +15,10 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
SettingsMessageTree(I18n::Message::ExamMode, ExamModeConfiguration::s_modelExamChildren),
|
||||
#ifdef HAS_CODE
|
||||
SettingsMessageTree(I18n::Message::CodeApp, s_codeChildren),
|
||||
#endif SettingsMessageTree(I18n::Message::UpdatePopUp),
|
||||
#endif
|
||||
SettingsMessageTree(I18n::Message::UpdatePopUp),
|
||||
SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren),
|
||||
SettingsMessageTree(I18n::Message::UsbSetting, s_usbSteps),
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren)};
|
||||
|
||||
constexpr SettingsMessageTree s_model = SettingsMessageTree(I18n::Message::SettingsApp, s_modelMenu);
|
||||
|
||||
@@ -29,7 +29,7 @@ AboutController::AboutController(Responder * parentResponder) :
|
||||
for (int i = 0; i < k_totalNumberOfCell; i++) {
|
||||
m_cells[i].setMessageFont(KDFont::LargeFont);
|
||||
m_cells[i].setAccessoryFont(KDFont::SmallFont);
|
||||
m_cells[i].setAccessoryTextColor(*Palette::SecondaryText);
|
||||
m_cells[i].setAccessoryTextColor(Palette::SecondaryText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,6 +100,22 @@ bool AboutController::handleEvent(Ion::Events::Event event) {
|
||||
|
||||
return true;
|
||||
}
|
||||
if(childLabel == I18n::Message::Battery){
|
||||
MessageTableCellWithBuffer * myCell = (MessageTableCellWithBuffer *)m_selectableTableView.selectedCell();
|
||||
char batteryLevel[15];
|
||||
if(strchr(myCell->accessoryText(), '%') == NULL){
|
||||
int batteryLen = Poincare::Integer((int) ((Ion::Battery::voltage() - 3.6) * 166)).serialize(batteryLevel, 15);
|
||||
batteryLevel[batteryLen] = '%';
|
||||
batteryLevel[batteryLen+1] = '\0';
|
||||
}else{
|
||||
int batteryLen = Poincare::Number::FloatNumber(Ion::Battery::voltage()).serialize(batteryLevel, 15, Poincare::Preferences::PrintFloatMode::Decimal, 3);
|
||||
batteryLevel[batteryLen] = 'V';
|
||||
batteryLevel[batteryLen+1] = '\0';
|
||||
}
|
||||
|
||||
myCell->setAccessoryText(batteryLevel);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ ContributorsController::ContributorsController(Responder * parentResponder) :
|
||||
for (int i = 0; i < k_totalNumberOfCell; i++) {
|
||||
m_cells[i].setMessageFont(KDFont::LargeFont);
|
||||
m_cells[i].setAccessoryFont(KDFont::SmallFont);
|
||||
m_cells[i].setAccessoryTextColor(*Palette::SecondaryText);
|
||||
m_cells[i].setAccessoryTextColor(Palette::SecondaryText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,15 +64,15 @@ void ContributorsController::willDisplayCellForIndex(HighlightCell * cell, int i
|
||||
myTextCell->setTextColor(KDColor::RGB24(0xC03535));
|
||||
} else if (index > 0 && index <= s_numberOfDevelopers) {
|
||||
myTextCell->setAccessoryText(I18n::translate(s_developersUsernames[index - 1]));
|
||||
myTextCell->setTextColor(*Palette::PrimaryText);
|
||||
myTextCell->setTextColor(Palette::PrimaryText);
|
||||
} else if (index == s_numberOfDevelopers + 1) {
|
||||
myTextCell->setAccessoryText("");
|
||||
myTextCell->setTextColor(KDColor::RGB24(0x1ABC9A));
|
||||
} else {
|
||||
myTextCell->setAccessoryText(I18n::translate(s_betaTestersUsernames[index - 2 - s_numberOfDevelopers]));
|
||||
myTextCell->setTextColor(*Palette::PrimaryText);
|
||||
myTextCell->setTextColor(Palette::PrimaryText);
|
||||
}
|
||||
myTextCell->setAccessoryTextColor(*Palette::SecondaryText);
|
||||
myTextCell->setAccessoryTextColor(Palette::SecondaryText);
|
||||
GenericSubController::willDisplayCellForIndex(cell, index);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ void MessageTableCellWithEditableTextWithSeparator::setHighlighted(bool highligh
|
||||
}
|
||||
|
||||
void MessageTableCellWithEditableTextWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), *Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(0, k_separatorThickness, bounds().width(), k_margin-k_separatorThickness), *Palette::BackgroundApps);
|
||||
ctx->fillRect(KDRect(0, 0, bounds().width(), k_separatorThickness), Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(0, k_separatorThickness, bounds().width(), k_margin-k_separatorThickness), Palette::BackgroundApps);
|
||||
}
|
||||
|
||||
int MessageTableCellWithEditableTextWithSeparator::numberOfSubviews() const {
|
||||
|
||||
@@ -14,12 +14,12 @@ SelectableViewWithMessages::SelectableViewWithMessages(SelectableTableView * sel
|
||||
for (int i = 0; i < k_maxNumberOfLines; i++) {
|
||||
m_messageLines[i].setFont(KDFont::SmallFont);
|
||||
m_messageLines[i].setAlignment(0.5f, 0.5f);
|
||||
m_messageLines[i].setBackgroundColor(*Palette::BackgroundApps);
|
||||
m_messageLines[i].setBackgroundColor(Palette::BackgroundApps);
|
||||
}
|
||||
}
|
||||
|
||||
void SelectableViewWithMessages::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(bounds(), *Palette::BackgroundApps);
|
||||
ctx->fillRect(bounds(), Palette::BackgroundApps);
|
||||
}
|
||||
|
||||
void SelectableViewWithMessages::setMessages(I18n::Message * m, int numberOfMessages) {
|
||||
|
||||
134
apps/settings/sub_menu/usb_info_controller.cpp
Normal file
134
apps/settings/sub_menu/usb_info_controller.cpp
Normal file
@@ -0,0 +1,134 @@
|
||||
#include "usb_info_controller.h"
|
||||
|
||||
#include <apps/i18n.h>
|
||||
#include <apps/settings/main_controller.h>
|
||||
#include <assert.h>
|
||||
#include <ion/storage.h>
|
||||
#include <poincare/preferences.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "../../apps_container.h"
|
||||
#include "../../global_preferences.h"
|
||||
|
||||
using namespace Poincare;
|
||||
using namespace Shared;
|
||||
|
||||
namespace Settings {
|
||||
|
||||
UsbInfoController::UsbInfoController(Responder *parentResponder) : GenericSubController(parentResponder),
|
||||
m_usbprotectlevel(this),
|
||||
m_dfuLevel(KDFont::LargeFont, KDFont::SmallFont),
|
||||
m_contentView(&m_selectableTableView) {
|
||||
for (int i = 0; i < k_maxSwitchCells; i++) {
|
||||
m_switchCells[i].setMessageFont(KDFont::LargeFont);
|
||||
//Ancien code au cas ou on souhaite ajouter d'autres éléments dans le menu
|
||||
// m_cell[i].setMessageFont(KDFont::LargeFont);
|
||||
// m_cell[i].setAccessoryFont(KDFont::SmallFont);
|
||||
// m_cell[i].setAccessoryTextColor(Palette::SecondaryText);
|
||||
}
|
||||
}
|
||||
|
||||
bool UsbInfoController::handleEvent(Ion::Events::Event event) {
|
||||
if ((Ion::Events::OK == event || Ion::Events::EXE == event) && selectedRow() == 0) {
|
||||
if(GlobalPreferences::sharedGlobalPreferences()->showDfuDeacAlert()){
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuDeacAlert(false);
|
||||
Container::activeApp()->displayWarning(I18n::Message::USBDeacAlert1, I18n::Message::USBDeacAlert2);
|
||||
return true;
|
||||
}
|
||||
if (!GlobalPreferences::sharedGlobalPreferences()->dfuStatus()) {
|
||||
if (!GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
|
||||
Ion::LED::setColor(KDColorPurple);
|
||||
Ion::LED::setBlinking(500, 0.5f);
|
||||
}
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuStatus(true);
|
||||
Container::activeApp()->displayWarning(I18n::Message::DfuWarning1, I18n::Message::DfuWarning2);
|
||||
} else {
|
||||
if (!GlobalPreferences::sharedGlobalPreferences()->isInExamMode()) {
|
||||
Ion::LED::setColor(KDColorBlack);
|
||||
}
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuStatus(false);
|
||||
}
|
||||
m_selectableTableView.reloadCellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow());
|
||||
AppsContainer::sharedAppsContainer()->redrawWindow(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (GlobalPreferences::sharedGlobalPreferences()->dfuStatus() && event != Ion::Events::USBPlug && event != Ion::Events::USBEnumeration) {
|
||||
Container::activeApp()->displayWarning(I18n::Message::UsbSetting, I18n::Message::USBSettingDeact);
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((Ion::Events::OK == event || Ion::Events::EXE == event) && selectedRow() == 1) {
|
||||
GenericSubController *subController = &m_usbprotectlevel;
|
||||
subController->setMessageTreeModel(m_messageTreeModel->childAtIndex(1));
|
||||
StackViewController *stack = stackController();
|
||||
m_lastSelect = selectedRow();
|
||||
stack->push(subController);
|
||||
return true;
|
||||
}
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuDeacAlert(true);
|
||||
return GenericSubController::handleEvent(event);
|
||||
}
|
||||
|
||||
HighlightCell *UsbInfoController::reusableCell(int index, int type) {
|
||||
assert(type == 2 || type == 1);
|
||||
if (type == 2) {
|
||||
assert(index >= 0 && index < k_maxSwitchCells);
|
||||
return &m_switchCells[index];
|
||||
}
|
||||
return &m_dfuLevel;
|
||||
}
|
||||
|
||||
int UsbInfoController::reusableCellCount(int type) {
|
||||
assert(type == 2 || type == 1);
|
||||
if (type == 2) {
|
||||
return k_maxSwitchCells;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
void UsbInfoController::willDisplayCellForIndex(HighlightCell *cell, int index) {
|
||||
GenericSubController::willDisplayCellForIndex(cell, index);
|
||||
|
||||
if (index == 0) {
|
||||
MessageTableCellWithSwitch *myCell = (MessageTableCellWithSwitch *)cell;
|
||||
SwitchView *mySwitch = (SwitchView *)myCell->accessoryView();
|
||||
mySwitch->setState(!GlobalPreferences::sharedGlobalPreferences()->dfuStatus());
|
||||
} else if (index == 1) {
|
||||
MessageTableCellWithChevronAndMessage *mcell = (MessageTableCellWithChevronAndMessage *)cell;
|
||||
int currentLevel = GlobalPreferences::sharedGlobalPreferences()->getDfuLevel();
|
||||
if (currentLevel == 0) {
|
||||
// mcell->setSubtitle(I18n::Message::USBDefaultLevel);
|
||||
mcell->setSubtitle(I18n::Message::USBDefaultLevelDesc);
|
||||
} else if (currentLevel == 1) {
|
||||
// mcell->setSubtitle(I18n::Message::USBLowLevel);
|
||||
mcell->setSubtitle(I18n::Message::USBLowLevelDesc);
|
||||
} else if (currentLevel == 2) {
|
||||
// mcell->setSubtitle(I18n::Message::USBParanoidLevel);
|
||||
mcell->setSubtitle(I18n::Message::USBParanoidLevelDesc);
|
||||
} else {
|
||||
// mcell->setSubtitle(I18n::Message::USBMegaParanoidLevel);
|
||||
mcell->setSubtitle(I18n::Message::USBMegaParanoidLevelDesc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int UsbInfoController::typeAtLocation(int i, int j) {
|
||||
switch (j) {
|
||||
case 0:
|
||||
return 2;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
void UsbInfoController::didEnterResponderChain(Responder *previousFirstResponder) {
|
||||
m_contentView.reload();
|
||||
|
||||
if (numberOfInfoLines() > 0) {
|
||||
I18n::Message infoMessages[] = {I18n::Message::USBE16_expl1, I18n::Message::USBE16_expl2, I18n::Message::USBE16_expl3};
|
||||
m_contentView.setMessages(infoMessages, numberOfInfoLines());
|
||||
}
|
||||
}
|
||||
}
|
||||
36
apps/settings/sub_menu/usb_info_controller.h
Normal file
36
apps/settings/sub_menu/usb_info_controller.h
Normal file
@@ -0,0 +1,36 @@
|
||||
#ifndef SETTINGS_USB_INFO_CONTROLLER_H
|
||||
#define SETTINGS_USB_INFO_CONTROLLER_H
|
||||
|
||||
#include "generic_sub_controller.h"
|
||||
#include "preferences_controller.h"
|
||||
#include "selectable_view_with_messages.h"
|
||||
#include "usb_protection_level_controller.h"
|
||||
|
||||
namespace Settings {
|
||||
|
||||
class UsbInfoController : public GenericSubController {
|
||||
public:
|
||||
UsbInfoController(Responder* parentResponder);
|
||||
View* view() override { return &m_contentView; }
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
TELEMETRY_ID("UsbInfo");
|
||||
void didEnterResponderChain(Responder* previousFirstResponder) override;
|
||||
|
||||
HighlightCell* reusableCell(int index, int type) override;
|
||||
int reusableCellCount(int type) override;
|
||||
void willDisplayCellForIndex(HighlightCell* cell, int index) override;
|
||||
int typeAtLocation(int i, int j) override;
|
||||
|
||||
private:
|
||||
static constexpr int k_numberOfInfoE16MessageLines = 3;
|
||||
int numberOfInfoLines() const { return k_numberOfInfoE16MessageLines; };
|
||||
static constexpr int k_maxSwitchCells = 1;
|
||||
MessageTableCellWithSwitch m_switchCells[k_maxSwitchCells];
|
||||
UsbProtectionLevelController m_usbprotectlevel;
|
||||
MessageTableCellWithChevronAndMessage m_dfuLevel;
|
||||
SelectableViewWithMessages m_contentView;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
77
apps/settings/sub_menu/usb_protection_level_controller.cpp
Normal file
77
apps/settings/sub_menu/usb_protection_level_controller.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
#include "usb_protection_level_controller.h"
|
||||
|
||||
#include <apps/i18n.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "../../apps_container.h"
|
||||
#include "../../global_preferences.h"
|
||||
|
||||
using namespace Poincare;
|
||||
using namespace Shared;
|
||||
|
||||
namespace Settings {
|
||||
UsbProtectionLevelController::UsbProtectionLevelController(Responder *parentResponder) : GenericSubController(parentResponder) {
|
||||
for (int i = 0; i < k_maxNumberOfCells; i++) {
|
||||
m_cell[i].setMessageFont(KDFont::LargeFont);
|
||||
m_cell[i].setAccessoryFont(KDFont::SmallFont);
|
||||
}
|
||||
}
|
||||
|
||||
bool UsbProtectionLevelController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
for (int i = 0; i < k_maxNumberOfCells; i++) {
|
||||
m_cell[i].setAccessoryText("");
|
||||
}
|
||||
if (m_messageTreeModel->childAtIndex(selectedRow())->label() == I18n::Message::USBLowLevel) {
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuLevel(1);
|
||||
} else if (m_messageTreeModel->childAtIndex(selectedRow())->label() == I18n::Message::USBDefaultLevel) {
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuLevel(0);
|
||||
} else if (m_messageTreeModel->childAtIndex(selectedRow())->label() == I18n::Message::USBParanoidLevel) {
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuLevel(2);
|
||||
} else if (m_messageTreeModel->childAtIndex(selectedRow())->label() == I18n::Message::USBMegaParanoidLevel) {
|
||||
GlobalPreferences::sharedGlobalPreferences()->setDfuLevel(3);
|
||||
}
|
||||
|
||||
StackViewController * stack = stackController();
|
||||
stack->pop();
|
||||
return true;
|
||||
} else {
|
||||
return GenericSubController::handleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
HighlightCell *UsbProtectionLevelController::reusableCell(int index, int type) {
|
||||
assert(index >= 0 && index < k_maxNumberOfCells);
|
||||
return &m_cell[index];
|
||||
}
|
||||
|
||||
int UsbProtectionLevelController::reusableCellCount(int type) {
|
||||
return k_maxNumberOfCells;
|
||||
}
|
||||
|
||||
void UsbProtectionLevelController::willDisplayCellForIndex(HighlightCell *cell, int index) {
|
||||
GenericSubController::willDisplayCellForIndex(cell, index);
|
||||
I18n::Message childLabel = m_messageTreeModel->childAtIndex(index)->label();
|
||||
MessageTableCellWithBuffer *messageComp = (MessageTableCellWithBuffer *)cell;
|
||||
|
||||
int currentLevel = GlobalPreferences::sharedGlobalPreferences()->getDfuLevel();
|
||||
|
||||
if (childLabel == I18n::Message::USBLowLevel && currentLevel == 1) {
|
||||
// messageComp->setTextColor(Palette::Green);
|
||||
messageComp->setAccessoryText("√");
|
||||
} else if (childLabel == I18n::Message::USBDefaultLevel && currentLevel == 0) {
|
||||
// messageComp->setTextColor(Palette::Green);
|
||||
messageComp->setAccessoryText("√");
|
||||
} else if (childLabel == I18n::Message::USBParanoidLevel && currentLevel == 2) {
|
||||
// messageComp->setTextColor(Palette::Green);
|
||||
messageComp->setAccessoryText("√");
|
||||
} else if (childLabel == I18n::Message::USBMegaParanoidLevel && currentLevel == 3) {
|
||||
// messageComp->setTextColor(Palette::Green);
|
||||
messageComp->setAccessoryText("√");
|
||||
}
|
||||
}
|
||||
|
||||
int UsbProtectionLevelController::typeAtLocation(int i, int j) {
|
||||
return 0;
|
||||
}
|
||||
} // namespace Settings
|
||||
24
apps/settings/sub_menu/usb_protection_level_controller.h
Normal file
24
apps/settings/sub_menu/usb_protection_level_controller.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifndef SETTINGS_USB_PROTECTION_LEVEL_CONTROLLER_H
|
||||
#define SETTINGS_USB_PROTECTION_LEVEL_CONTROLLER_H
|
||||
|
||||
#include "generic_sub_controller.h"
|
||||
#include <escher.h>
|
||||
|
||||
namespace Settings {
|
||||
|
||||
class UsbProtectionLevelController : public GenericSubController {
|
||||
public:
|
||||
UsbProtectionLevelController(Responder * parentResponder);
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
HighlightCell * reusableCell(int index, int type) override;
|
||||
int reusableCellCount(int type) override;
|
||||
void willDisplayCellForIndex(HighlightCell * cell, int index) override;
|
||||
int typeAtLocation(int i, int j) override;
|
||||
private:
|
||||
static constexpr int k_maxNumberOfCells = 3;
|
||||
MessageTableCellWithBuffer m_cell[k_maxNumberOfCells];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -99,3 +99,15 @@ ExamModeModeStandard = "Standard "
|
||||
ExamModeModeNoSym = "Kein Symbol "
|
||||
ExamModeModeNoSymNoText = "Kein Symbol kein Text "
|
||||
ExamModeModeDutch = "Niederländisch "
|
||||
USBE16_expl1= "USB-Schutz schützt Ihren"
|
||||
USBE16_expl2= "Taschenrechner vor"
|
||||
USBE16_expl3= "unbeabsichtigter Verriegelung"
|
||||
USBProtection= "USB-Schutz"
|
||||
USBSettingDeact = "Bitte schalte den Schutz ein"
|
||||
USBLevelProtect = "Akzeptierte Updates"
|
||||
USBDefaultLevel = "Basierend auf Upsilon"
|
||||
USBLowLevel = "Basierend auf Omega"
|
||||
USBParanoidLevel = "Nur Python"
|
||||
USBMegaParanoidLevel = "Nichts"
|
||||
USBDeacAlert1 = "Ändern Sie diesen Parameter nur,"
|
||||
USBDeacAlert2 = "wenn Sie wissen, was Sie tun!"
|
||||
|
||||
@@ -99,3 +99,15 @@ ExamModeModeStandard = "Standard "
|
||||
ExamModeModeNoSym = "No sym "
|
||||
ExamModeModeNoSymNoText = "No sym no text "
|
||||
ExamModeModeDutch = "Dutch "
|
||||
USBE16_expl1= "The USB protection protects"
|
||||
USBE16_expl2= "the calculator from"
|
||||
USBE16_expl3= "unintentional locking"
|
||||
USBProtection= "USB Protection"
|
||||
USBSettingDeact = "Please turn on the protection"
|
||||
USBLevelProtect = "Updates accepted"
|
||||
USBDefaultLevel = "Based on Upsilon"
|
||||
USBLowLevel = "Based on Omega"
|
||||
USBParanoidLevel = "Python Only"
|
||||
USBMegaParanoidLevel = "None"
|
||||
USBDeacAlert1 = "Change this parameter only if"
|
||||
USBDeacAlert2 = "you know what you are doing !"
|
||||
|
||||
@@ -99,3 +99,15 @@ ExamModeModeStandard = "Estándar "
|
||||
ExamModeModeNoSym = "Sin simbólico "
|
||||
ExamModeModeNoSymNoText = "Sin simbólico sin texto "
|
||||
ExamModeModeDutch = "Holandés "
|
||||
USBE16_expl1= "La protección USB protege"
|
||||
USBE16_expl2= "su calculadora del"
|
||||
USBE16_expl3= "bloqueo involuntario"
|
||||
USBProtection= "Protección USB"
|
||||
USBSettingDeact = "Enciende la protección"
|
||||
USBLevelProtect = "Actualizaciones aceptadas"
|
||||
USBDefaultLevel = "Basado en Upsilon"
|
||||
USBLowLevel = "Basado en Omega"
|
||||
USBParanoidLevel = "Solo Python"
|
||||
USBMegaParanoidLevel = "Ninguno"
|
||||
USBDeacAlert1 = "¡Cambie este parámetro solo"
|
||||
USBDeacAlert2 = "si sabe lo que está haciendo!"
|
||||
|
||||
@@ -99,3 +99,15 @@ ExamModeModeStandard = "Standard "
|
||||
ExamModeModeNoSym = "Sans symbolique "
|
||||
ExamModeModeNoSymNoText = "Sans symbolique ni texte "
|
||||
ExamModeModeDutch = "Dutch "
|
||||
USBE16_expl1= "La protection USB protège votre"
|
||||
USBE16_expl2= "calculatrice contre un verrouillage"
|
||||
USBE16_expl3= "non-intentionnel"
|
||||
USBProtection= "Protection USB"
|
||||
USBSettingDeact = "Veuillez activer la protection"
|
||||
USBLevelProtect = "Mise à jour acceptées"
|
||||
USBDefaultLevel = "Basées sur Upsilon"
|
||||
USBLowLevel = "Basées sur Omega"
|
||||
USBParanoidLevel = "Aucune"
|
||||
USBMegaParanoidLevel = "Aucune"
|
||||
USBDeacAlert1 = "Ne modifiez ce paramètre que"
|
||||
USBDeacAlert2 = "si vous savez ce que vous faites !"
|
||||
|
||||
@@ -99,3 +99,15 @@ ExamModeModeStandard = "Normál "
|
||||
ExamModeModeNoSym = "Szimbólikus nélkül "
|
||||
ExamModeModeNoSymNoText = "Szimbólikus és szöveg nélkül "
|
||||
ExamModeModeDutch = "Holland "
|
||||
USBE16_expl1= "Az USB-védelem megvédi"
|
||||
USBE16_expl2= "a számológépet a nem"
|
||||
USBE16_expl3= "szándékos reteszeléstől"
|
||||
USBProtection= "USB védelem"
|
||||
USBSettingDeact = "Kérjük, kapcsolja be a védelmet"
|
||||
USBLevelProtect = "Elfogadott frissítések"
|
||||
USBDefaultLevel = "Upsilon alapján"
|
||||
USBLowLevel = "Omega alapján"
|
||||
USBParanoidLevel = "Csak Python"
|
||||
USBMegaParanoidLevel = "Egyik sem"
|
||||
USBDeacAlert1 = "Csak akkor módosítsa ezt a"
|
||||
USBDeacAlert2 = "paramétert, ha tudja, mit csinál!"
|
||||
|
||||
@@ -99,3 +99,15 @@ ExamModeModeStandard = "Standard "
|
||||
ExamModeModeNoSym = "Nessun simbolo "
|
||||
ExamModeModeNoSymNoText = "Nessun simbolo nessun testo "
|
||||
ExamModeModeDutch = "Olandese "
|
||||
USBE16_expl1= "La protezione USB protegge"
|
||||
USBE16_expl2= "la calcolatrice dal"
|
||||
USBE16_expl3= "blocco involontario"
|
||||
USBProtection= "Protezione USB"
|
||||
USBSettingDeact = "Si prega di attivare la protezione"
|
||||
USBLevelProtect = "Aggiornamenti accettati"
|
||||
USBDefaultLevel = "Basato su Upsilon"
|
||||
USBLowLevel = "A base di Omega"
|
||||
USBParanoidLevel = "Solo Python"
|
||||
USBMegaParanoidLevel = "Nessuno"
|
||||
USBDeacAlert1 = "Cambia questo parametro solo"
|
||||
USBDeacAlert2 = "se sai cosa stai facendo !"
|
||||
|
||||
@@ -99,3 +99,15 @@ ExamModeModeStandard = "Standaard "
|
||||
ExamModeModeNoSym = "Geen sym "
|
||||
ExamModeModeNoSymNoText = "Geen sym geen tekst "
|
||||
ExamModeModeDutch = "Nederlands "
|
||||
USBE16_expl1= "USB-beveiliging beschermt uw"
|
||||
USBE16_expl2= "rekenmachine tegen"
|
||||
USBE16_expl3= "onbedoelde vergrendeling"
|
||||
USBProtection= "USB-beveiliging"
|
||||
USBSettingDeact = "Schakel a.u.b. de bescherming in"
|
||||
USBLevelProtect = "Updates geaccepteerd"
|
||||
USBDefaultLevel = "Gebaseerd op Upsilon"
|
||||
USBLowLevel = "Op basis van Omega"
|
||||
USBParanoidLevel = "Alleen Python"
|
||||
USBMegaParanoidLevel = "Geen"
|
||||
USBDeacAlert1 = "Wijzig deze parameter alleen"
|
||||
USBDeacAlert2 = "als u weet wat u doet!"
|
||||
|
||||
@@ -99,3 +99,15 @@ ExamModeModeStandard = "Padrão "
|
||||
ExamModeModeNoSym = "Sem sym "
|
||||
ExamModeModeNoSymNoText = "Sem sym sem texto "
|
||||
ExamModeModeDutch = "holandês "
|
||||
USBE16_expl1= "A proteção USB protege"
|
||||
USBE16_expl2= "sua calculadora contra"
|
||||
USBE16_expl3= "bloqueios não intencionais"
|
||||
USBProtection= "Proteção USB"
|
||||
USBSettingDeact = "Por favor, ligue a proteção"
|
||||
USBLevelProtect = "Atualizações aceitas"
|
||||
USBDefaultLevel = "Baseado em Upsilon"
|
||||
USBLowLevel = "Baseado em Ômega"
|
||||
USBParanoidLevel = "Apenas Python"
|
||||
USBMegaParanoidLevel = "Nenhum"
|
||||
USBDeacAlert1 = "Mude este parâmetro somente"
|
||||
USBDeacAlert2 = "se você souber o que está fazendo!"
|
||||
|
||||
@@ -458,6 +458,11 @@ HartreeConstant = "4.3597447222071·10^-18_J"
|
||||
MagneticFluxQuantum = "2.067833848·10^-15_Wb"
|
||||
ConductanceQuantum = "7.748091729·10^-5_S"
|
||||
CirculationQuantum = "3.6369475516·10^-4_m^2_s^-1"
|
||||
UsbSetting = "USB"
|
||||
USBDefaultLevelDesc = "L0"
|
||||
USBLowLevelDesc = "L1"
|
||||
USBParanoidLevelDesc = "L2"
|
||||
USBMegaParanoidLevelDesc = "L3"
|
||||
Cndcvt_Silver = "6.30·10^7_S_m^-1"
|
||||
Cndcvt_Copper = "5.96·10^7_S_m^-1"
|
||||
Cndcvt_Gold = "4.11·10^7_S_m^-1"
|
||||
|
||||
@@ -12,9 +12,9 @@ public:
|
||||
KDSize minimalSizeForOptimalDisplay() const override;
|
||||
KDCoordinate minimalHeightForOptimalDisplayGivenWidth(KDCoordinate width) const;
|
||||
void reload() { layoutSubviews(); }
|
||||
static const KDFont * Font() { return KDFont::SmallFont; }
|
||||
static const KDColor TextColor() { return *Palette::PrimaryText; }
|
||||
static const KDColor BackgroundColor() { return *Palette::SubMenuBackground; }
|
||||
static constexpr const KDFont * Font() { return KDFont::SmallFont; }
|
||||
static constexpr KDColor TextColor() { return Palette::PrimaryText; }
|
||||
static constexpr KDColor BackgroundColor() { return Palette::SubMenuBackground; }
|
||||
private:
|
||||
static constexpr KDCoordinate LineSpacing = 2;
|
||||
int numberOfSubviews() const override = 0;
|
||||
|
||||
@@ -24,18 +24,18 @@ void BufferTextViewWithTextField::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
|
||||
// Fill margins with white
|
||||
// Left margin
|
||||
ctx->fillRect(KDRect(0, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), *Palette::BackgroundHard);
|
||||
ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), *Palette::BackgroundHard);
|
||||
ctx->fillRect(KDRect(0, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), Palette::BackgroundHard);
|
||||
ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), Palette::BackgroundHard);
|
||||
// Right margin
|
||||
ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), *Palette::BackgroundHard);
|
||||
ctx->fillRect(KDRect(bounds().width() - Metric::TitleBarExternHorizontalMargin, 0, Metric::TitleBarExternHorizontalMargin, bounds().height()), Palette::BackgroundHard);
|
||||
// Above the text field
|
||||
ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, 0, textFieldRect.width() + 2*k_borderWidth, bounds().height()), *Palette::BackgroundHard);
|
||||
ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, 0, textFieldRect.width() + 2*k_borderWidth, bounds().height()), Palette::BackgroundHard);
|
||||
// Under the text field
|
||||
ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, textFieldRect.bottom() + k_borderWidth, textFieldRect.width() + 2*k_borderWidth, bounds().height()), *Palette::BackgroundHard);
|
||||
ctx->fillRect(KDRect(textFieldRect.x() - k_borderWidth, textFieldRect.bottom() + k_borderWidth, textFieldRect.width() + 2*k_borderWidth, bounds().height()), Palette::BackgroundHard);
|
||||
|
||||
// Draw the text field border
|
||||
KDRect borderRect = KDRect(textFieldRect.x()-k_borderWidth, textFieldRect.y()-k_borderWidth, textFieldRect.width()+2*k_borderWidth, textFieldRect.height()+2*k_borderWidth);
|
||||
ctx->strokeRect(borderRect, *Palette::ListCellBorder);
|
||||
ctx->strokeRect(borderRect, Palette::ListCellBorder);
|
||||
}
|
||||
|
||||
void BufferTextViewWithTextField::didBecomeFirstResponder() {
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
#include "button_with_separator.h"
|
||||
|
||||
ButtonWithSeparator::ButtonWithSeparator(Responder * parentResponder, I18n::Message message, Invocation invocation) :
|
||||
Button(parentResponder, message, invocation, KDFont::LargeFont, *Palette::ButtonText)
|
||||
Button(parentResponder, message, invocation, KDFont::LargeFont, Palette::ButtonText)
|
||||
{
|
||||
}
|
||||
|
||||
void ButtonWithSeparator::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate width = bounds().width();
|
||||
KDCoordinate height = bounds().height();
|
||||
ctx->fillRect(KDRect(0, 0, width, k_lineThickness), *Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(0, k_lineThickness, width, k_margin-k_lineThickness), *Palette::BackgroundApps);
|
||||
ctx->fillRect(KDRect(0, 0, width, k_lineThickness), Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(0, k_lineThickness, width, k_margin-k_lineThickness), Palette::BackgroundApps);
|
||||
// Draw rectangle around cell
|
||||
ctx->fillRect(KDRect(0, k_margin, width, k_lineThickness), *Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(0, k_margin+k_lineThickness, k_lineThickness, height-k_margin), *Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(width-k_lineThickness, k_lineThickness+k_margin, k_lineThickness, height-k_margin), *Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(0, height-3*k_lineThickness, width, k_lineThickness), *Palette::ButtonBorderOut);
|
||||
ctx->fillRect(KDRect(0, height-2*k_lineThickness, width, k_lineThickness), *Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(k_lineThickness, height-k_lineThickness, width-2*k_lineThickness, k_lineThickness), *Palette::ButtonShadow);
|
||||
ctx->fillRect(KDRect(0, k_margin, width, k_lineThickness), Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(0, k_margin+k_lineThickness, k_lineThickness, height-k_margin), Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(width-k_lineThickness, k_lineThickness+k_margin, k_lineThickness, height-k_margin), Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(0, height-3*k_lineThickness, width, k_lineThickness), Palette::ButtonBorderOut);
|
||||
ctx->fillRect(KDRect(0, height-2*k_lineThickness, width, k_lineThickness), Palette::ListCellBorder);
|
||||
ctx->fillRect(KDRect(k_lineThickness, height-k_lineThickness, width-2*k_lineThickness, k_lineThickness), Palette::ButtonShadow);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace Shared {
|
||||
void CursorView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
KDCoordinate width = bounds().width();
|
||||
KDCoordinate height = bounds().height();
|
||||
ctx->fillRect(KDRect((width-1)/2, 0, 1, height), *Palette::PrimaryText);
|
||||
ctx->fillRect(KDRect(0, (height-1)/2, width, 1), *Palette::PrimaryText);
|
||||
ctx->fillRect(KDRect((width-1)/2, 0, 1, height), Palette::PrimaryText);
|
||||
ctx->fillRect(KDRect(0, (height-1)/2, width, 1), Palette::PrimaryText);
|
||||
}
|
||||
|
||||
KDSize CursorView::minimalSizeForOptimalDisplay() const {
|
||||
|
||||
@@ -286,7 +286,7 @@ void CurveView::drawLabel(KDContext * ctx, KDRect rect, float xPosition, float y
|
||||
KDPoint position = positionLabel(xCoordinate, yCoordinate, labelSize, horizontalPosition, verticalPosition);
|
||||
if (rect.intersects(KDRect(position, labelSize))) {
|
||||
// TODO: should we blend?
|
||||
ctx->drawString(label, position, k_font, color, *Palette::BackgroundApps);
|
||||
ctx->drawString(label, position, k_font, color, Palette::BackgroundApps);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ void CurveView::drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis
|
||||
labelPosition,
|
||||
k_labelGraduationLength,
|
||||
1);
|
||||
ctx->fillRect(graduation, *Palette::PrimaryText);
|
||||
ctx->fillRect(graduation, Palette::PrimaryText);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ void CurveView::drawLabelsAndGraduations(KDContext * ctx, KDRect rect, Axis axis
|
||||
|
||||
DrawLabel:
|
||||
if (rect.intersects(KDRect(position, textSize))) {
|
||||
ctx->drawString(labelI, position, k_font, *Palette::PrimaryText, backgroundColor);
|
||||
ctx->drawString(labelI, position, k_font, Palette::PrimaryText, backgroundColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -557,8 +557,8 @@ void CurveView::drawArrow(KDContext * ctx, KDRect rect, float x, float y, float
|
||||
}
|
||||
|
||||
void CurveView::drawGrid(KDContext * ctx, KDRect rect) const {
|
||||
KDColor boldColor = *Palette::GridPrimaryLine;
|
||||
KDColor lightColor = *Palette::GridSecondaryLine;
|
||||
KDColor boldColor = Palette::GridPrimaryLine;
|
||||
KDColor lightColor = Palette::GridSecondaryLine;
|
||||
drawGridLines(ctx, rect, Axis::Vertical, m_curveViewRange->xGridUnit(), boldColor, lightColor);
|
||||
drawGridLines(ctx, rect, Axis::Horizontal, m_curveViewRange->yGridUnit(), boldColor, lightColor);
|
||||
}
|
||||
@@ -569,7 +569,7 @@ void CurveView::drawAxes(KDContext * ctx, KDRect rect) const {
|
||||
}
|
||||
|
||||
void CurveView::drawAxis(KDContext * ctx, KDRect rect, Axis axis) const {
|
||||
drawLine(ctx, rect, axis, 0.0f, *Palette::PrimaryText, 1);
|
||||
drawLine(ctx, rect, axis, 0.0f, Palette::PrimaryText, 1);
|
||||
}
|
||||
|
||||
constexpr KDCoordinate thinCircleDiameter = 1;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user