mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-19 05:40:38 +01:00
Merge branch 'pythonfont' of https://github.com/MixedMatched/Omega into MixedMatched-pythonfont
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include <apps/i18n.h>
|
||||
#include <assert.h>
|
||||
#include <escher/metric.h>
|
||||
#include <poincare/preferences.h>
|
||||
#include "../apps_container.h"
|
||||
|
||||
extern "C" {
|
||||
@@ -27,7 +28,7 @@ ConsoleController::ConsoleController(Responder * parentResponder, App * pythonDe
|
||||
TextFieldDelegate(),
|
||||
MicroPython::ExecutionEnvironment(),
|
||||
m_pythonDelegate(pythonDelegate),
|
||||
m_rowHeight(k_font->glyphSize().height()),
|
||||
m_rowHeight(Poincare::Preferences::sharedPreferences()->KDPythonFont()->glyphSize().height()),
|
||||
m_importScriptsWhenViewAppears(false),
|
||||
m_selectableTableView(this, this, this, this),
|
||||
m_editCell(this, pythonDelegate, this),
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <escher.h>
|
||||
#include <python/port/port.h>
|
||||
#include <poincare/preferences.h>
|
||||
|
||||
#include "console_edit_cell.h"
|
||||
#include "console_line_cell.h"
|
||||
@@ -16,7 +17,6 @@ class App;
|
||||
|
||||
class ConsoleController : public ViewController, public ListViewDataSource, public SelectableTableViewDataSource, public SelectableTableViewDelegate, public TextFieldDelegate, public MicroPython::ExecutionEnvironment {
|
||||
public:
|
||||
static constexpr const KDFont * k_font = KDFont::LargeFont;
|
||||
|
||||
ConsoleController(Responder * parentResponder, App * pythonDelegate, ScriptStore * scriptStore
|
||||
#if EPSILON_GETOPT
|
||||
|
||||
@@ -9,8 +9,8 @@ namespace Code {
|
||||
ConsoleEditCell::ConsoleEditCell(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate, TextFieldDelegate * delegate) :
|
||||
HighlightCell(),
|
||||
Responder(parentResponder),
|
||||
m_promptView(ConsoleController::k_font, nullptr, 0, 0.5),
|
||||
m_textField(this, nullptr, TextField::maxBufferSize(), TextField::maxBufferSize(), inputEventHandlerDelegate, delegate, ConsoleController::k_font)
|
||||
m_promptView(Poincare::Preferences::sharedPreferences()->KDPythonFont(), nullptr, 0, 0.5),
|
||||
m_textField(this, nullptr, TextField::maxBufferSize(), TextField::maxBufferSize(), inputEventHandlerDelegate, delegate, Poincare::Preferences::sharedPreferences()->KDPythonFont())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <escher/text_field.h>
|
||||
#include <escher/text_field_delegate.h>
|
||||
#include <escher/pointer_text_view.h>
|
||||
#include <poincare/preferences.h>
|
||||
|
||||
namespace Code {
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <kandinsky/point.h>
|
||||
#include <kandinsky/coordinate.h>
|
||||
#include <apps/i18n.h>
|
||||
#include <poincare/preferences.h>
|
||||
|
||||
namespace Code {
|
||||
|
||||
@@ -18,11 +19,11 @@ 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, ConsoleController::k_font, textColor(m_line), isHighlighted()? Palette::CodeBackgroundSelected : Palette::CodeBackground);
|
||||
ctx->drawString(m_line->text(), KDPointZero, Poincare::Preferences::sharedPreferences()->KDPythonFont(), textColor(m_line), isHighlighted()? Palette::CodeBackgroundSelected : Palette::CodeBackground);
|
||||
}
|
||||
|
||||
KDSize ConsoleLineCell::ScrollableConsoleLineView::ConsoleLineView::minimalSizeForOptimalDisplay() const {
|
||||
return ConsoleController::k_font->stringSize(m_line->text());
|
||||
return Poincare::Preferences::sharedPreferences()->KDPythonFont()->stringSize(m_line->text());
|
||||
}
|
||||
|
||||
ConsoleLineCell::ScrollableConsoleLineView::ScrollableConsoleLineView(Responder * parentResponder) :
|
||||
@@ -34,7 +35,7 @@ ConsoleLineCell::ScrollableConsoleLineView::ScrollableConsoleLineView(Responder
|
||||
ConsoleLineCell::ConsoleLineCell(Responder * parentResponder) :
|
||||
HighlightCell(),
|
||||
Responder(parentResponder),
|
||||
m_promptView(ConsoleController::k_font, I18n::Message::ConsolePrompt, 0, 0.5),
|
||||
m_promptView(Poincare::Preferences::sharedPreferences()->KDPythonFont(), I18n::Message::ConsolePrompt, 0, 0.5),
|
||||
m_scrollableView(this),
|
||||
m_line()
|
||||
{
|
||||
@@ -79,7 +80,7 @@ View * ConsoleLineCell::subviewAtIndex(int index) {
|
||||
|
||||
void ConsoleLineCell::layoutSubviews() {
|
||||
if (m_line.isCommand()) {
|
||||
KDSize promptSize = ConsoleController::k_font->stringSize(I18n::translate(I18n::Message::ConsolePrompt));
|
||||
KDSize promptSize = Poincare::Preferences::sharedPreferences()->KDPythonFont()->stringSize(I18n::translate(I18n::Message::ConsolePrompt));
|
||||
m_promptView.setFrame(KDRect(KDPointZero, promptSize.width(), bounds().height()));
|
||||
m_scrollableView.setFrame(KDRect(KDPoint(promptSize.width(), 0), bounds().width() - promptSize.width(), bounds().height()));
|
||||
return;
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
#include "editor_view.h"
|
||||
#include <poincare/integer.h>
|
||||
#include <escher/app.h>
|
||||
#include <poincare/preferences.h>
|
||||
|
||||
namespace Code {
|
||||
|
||||
/* EditorView */
|
||||
|
||||
static constexpr const KDFont * editorFont = KDFont::LargeFont;
|
||||
|
||||
EditorView::EditorView(Responder * parentResponder, App * pythonDelegate) :
|
||||
Responder(parentResponder),
|
||||
View(),
|
||||
m_textArea(parentResponder, pythonDelegate, editorFont),
|
||||
m_gutterView(editorFont)
|
||||
m_textArea(parentResponder, pythonDelegate, Poincare::Preferences::sharedPreferences()->KDPythonFont()),
|
||||
m_gutterView(Poincare::Preferences::sharedPreferences()->KDPythonFont())
|
||||
{
|
||||
m_textArea.setScrollViewDelegate(this);
|
||||
}
|
||||
@@ -51,7 +50,6 @@ void EditorView::layoutSubviews() {
|
||||
|
||||
EditorView::GutterView::GutterView(const KDFont * font) :
|
||||
View(),
|
||||
m_font(font),
|
||||
m_offset(0)
|
||||
{
|
||||
}
|
||||
@@ -62,7 +60,7 @@ void EditorView::GutterView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
|
||||
ctx->fillRect(rect, backgroundColor);
|
||||
|
||||
KDSize glyphSize = m_font->glyphSize();
|
||||
KDSize glyphSize = Poincare::Preferences::sharedPreferences()->KDPythonFont()->glyphSize();
|
||||
|
||||
KDCoordinate firstLine = m_offset / glyphSize.height();
|
||||
KDCoordinate firstLinePixelOffset = m_offset - firstLine * glyphSize.height();
|
||||
@@ -76,7 +74,7 @@ void EditorView::GutterView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->drawString(
|
||||
lineNumber,
|
||||
KDPoint(k_margin + leftPadding, i*glyphSize.height() - firstLinePixelOffset),
|
||||
m_font,
|
||||
Poincare::Preferences::sharedPreferences()->KDPythonFont(),
|
||||
textColor,
|
||||
backgroundColor
|
||||
);
|
||||
@@ -94,7 +92,7 @@ void EditorView::GutterView::setOffset(KDCoordinate offset) {
|
||||
|
||||
KDSize EditorView::GutterView::minimalSizeForOptimalDisplay() const {
|
||||
int numberOfChars = 2; // TODO: Could be computed
|
||||
return KDSize(2 * k_margin + numberOfChars * m_font->glyphSize().width(), 0);
|
||||
return KDSize(2 * k_margin + numberOfChars * Poincare::Preferences::sharedPreferences()->KDPythonFont()->glyphSize().width(), 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ private:
|
||||
KDSize minimalSizeForOptimalDisplay() const override;
|
||||
private:
|
||||
static constexpr KDCoordinate k_margin = 2;
|
||||
const KDFont * m_font;
|
||||
KDCoordinate m_offset;
|
||||
};
|
||||
|
||||
|
||||
@@ -50,4 +50,7 @@ SymbolMultiplication = "Multiplikation"
|
||||
SymbolMultiplicationCross = "Kreuz "
|
||||
SymbolMultiplicationMiddleDot = "Mittelpunkt "
|
||||
SymbolMultiplicationStar = "Stern "
|
||||
SymbolMultiplicationAutoSymbol = "automatisch "
|
||||
SymbolMultiplicationAutoSymbol = "automatisch "
|
||||
PythonFont = "Python schriftart"
|
||||
Large = "Groß "
|
||||
Small = "Klein "
|
||||
|
||||
@@ -50,4 +50,7 @@ SymbolMultiplication = "Multiply"
|
||||
SymbolMultiplicationCross = "Cross "
|
||||
SymbolMultiplicationMiddleDot = "Dot "
|
||||
SymbolMultiplicationStar = "Star "
|
||||
SymbolMultiplicationAutoSymbol = "Auto "
|
||||
SymbolMultiplicationAutoSymbol = "Auto "
|
||||
PythonFont = "Python Font"
|
||||
Large = "Large "
|
||||
Small = "Small "
|
||||
|
||||
@@ -50,4 +50,7 @@ SymbolMultiplication = "Multiplicación"
|
||||
SymbolMultiplicationCross = "Contrariar "
|
||||
SymbolMultiplicationMiddleDot = "Punto "
|
||||
SymbolMultiplicationStar = "Estrella "
|
||||
SymbolMultiplicationAutoSymbol = "Auto "
|
||||
SymbolMultiplicationAutoSymbol = "Auto "
|
||||
PythonFont = "Fuente Python"
|
||||
Large = "Grande "
|
||||
Small = "Pequeña "
|
||||
|
||||
@@ -50,4 +50,7 @@ SymbolMultiplication = "Multiplication"
|
||||
SymbolMultiplicationCross = "Croix "
|
||||
SymbolMultiplicationMiddleDot = "Point "
|
||||
SymbolMultiplicationStar = "Etoile "
|
||||
SymbolMultiplicationAutoSymbol = "Automatique "
|
||||
SymbolMultiplicationAutoSymbol = "Automatique "
|
||||
PythonFont = "Police Python"
|
||||
Large = "Grand "
|
||||
Small = "Petit "
|
||||
|
||||
@@ -50,4 +50,7 @@ SymbolMultiplication = "Multiplicação"
|
||||
SymbolMultiplicationCross = "crómio "
|
||||
SymbolMultiplicationMiddleDot = "ponto médio "
|
||||
SymbolMultiplicationStar = "estrela "
|
||||
SymbolMultiplicationAutoSymbol = "automático "
|
||||
SymbolMultiplicationAutoSymbol = "automático "
|
||||
PythonFont = "Fonte Python"
|
||||
Large = "Ampla "
|
||||
Small = "Pequeno "
|
||||
|
||||
@@ -17,7 +17,8 @@ MainController::MainController(Responder * parentResponder, InputEventHandlerDel
|
||||
m_languageController(this, 13),
|
||||
m_accessibilityController(this),
|
||||
m_examModeController(this),
|
||||
m_aboutController(this)
|
||||
m_aboutController(this),
|
||||
m_preferencesController(this)
|
||||
{
|
||||
for (int i = 0; i < k_numberOfSimpleChevronCells; i++) {
|
||||
m_cells[i].setMessageFont(KDFont::LargeFont);
|
||||
@@ -83,6 +84,8 @@ bool MainController::handleEvent(Ion::Events::Event event) {
|
||||
subController = &m_accessibilityController;
|
||||
} else if (model()->children(selectedRow())->label() == I18n::Message::MathOptions) {
|
||||
subController = &m_mathOptionsController;
|
||||
} else {
|
||||
subController = &m_preferencesController;
|
||||
}
|
||||
subController->setMessageTreeModel(model()->children(selectedRow()));
|
||||
StackViewController * stack = stackController();
|
||||
@@ -141,6 +144,7 @@ int MainController::typeAtLocation(int i, int j) {
|
||||
|
||||
void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
GlobalPreferences * globalPreferences = GlobalPreferences::sharedGlobalPreferences();
|
||||
Preferences * preferences = Preferences::sharedPreferences();
|
||||
MessageTableCell * myCell = (MessageTableCell *)cell;
|
||||
I18n::Message thisLabel = model()->children(index)->label();
|
||||
myCell->setMessage(thisLabel);
|
||||
@@ -157,12 +161,18 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
static_cast<MessageTableCellWithChevronAndMessage *>(cell)->setSubtitle(I18n::LanguageNames[index]);
|
||||
return;
|
||||
}
|
||||
if (thisLabel == I18n::Message::PythonFont) {
|
||||
int childIndex = (int)preferences->pythonFont();
|
||||
static_cast<MessageTableCellWithChevronAndMessage *>(cell)->setSubtitle(model()->children(index)->children(childIndex)->label());
|
||||
return;
|
||||
}
|
||||
if (hasPrompt() && (thisLabel == I18n::Message::UpdatePopUp || thisLabel == I18n::Message::BetaPopUp)) {
|
||||
MessageTableCellWithSwitch * mySwitchCell = (MessageTableCellWithSwitch *)cell;
|
||||
SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView();
|
||||
mySwitch->setState(globalPreferences->showPopUp());
|
||||
return;
|
||||
}
|
||||
static_cast<MessageTableCellWithChevronAndMessage *>(cell)->setSubtitle(I18n::Message::Default);
|
||||
}
|
||||
|
||||
void MainController::viewWillAppear() {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "sub_menu/exam_mode_controller.h"
|
||||
#include "sub_menu/language_controller.h"
|
||||
#include "sub_menu/math_options_controller.h"
|
||||
#include "sub_menu/preferences_controller.h"
|
||||
|
||||
namespace Settings {
|
||||
|
||||
@@ -31,7 +32,7 @@ private:
|
||||
StackViewController * stackController() const;
|
||||
I18n::Message promptMessage() const;
|
||||
bool hasPrompt() const { return promptMessage() != I18n::Message::Default; }
|
||||
constexpr static int k_numberOfSimpleChevronCells = 5;
|
||||
constexpr static int k_numberOfSimpleChevronCells = 6;
|
||||
MessageTableCellWithChevronAndMessage m_cells[k_numberOfSimpleChevronCells];
|
||||
MessageTableCellWithGauge m_brightnessCell;
|
||||
MessageTableCellWithSwitch m_popUpCell;
|
||||
@@ -41,6 +42,7 @@ private:
|
||||
AccessibilityController m_accessibilityController;
|
||||
ExamModeController m_examModeController;
|
||||
AboutController m_aboutController;
|
||||
PreferencesController m_preferencesController;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ constexpr SettingsMessageTree s_symbolChildren[4] = {SettingsMessageTree(I18n::M
|
||||
//sub-menus
|
||||
constexpr SettingsMessageTree s_modelMathOptionsChildren[5] = {SettingsMessageTree(I18n::Message::AngleUnit, s_modelAngleChildren, 3), SettingsMessageTree(I18n::Message::DisplayMode, s_modelFloatDisplayModeChildren, 4), SettingsMessageTree(I18n::Message::EditionMode, s_modelEditionModeChildren, 2), SettingsMessageTree(I18n::Message::ComplexFormat, s_modelComplexFormatChildren, 3), SettingsMessageTree(I18n::Message::SymbolMultiplication, s_symbolChildren, 4)};
|
||||
constexpr SettingsMessageTree s_modelExamChildren[3] = {SettingsMessageTree(I18n::Message::LEDColor, s_ledColorChildren, 4), SettingsMessageTree(I18n::Message::ExamModeMode, s_examModeMode, 3), SettingsMessageTree(I18n::Message::ActivateExamMode)};
|
||||
constexpr SettingsMessageTree s_pythonFont[2] = {SettingsMessageTree(I18n::Message::Large), SettingsMessageTree(I18n::Message::Small)};
|
||||
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)};
|
||||
#ifdef USERNAME
|
||||
constexpr SettingsMessageTree s_modelAboutChildren[7] = {SettingsMessageTree(I18n::Message::Username), SettingsMessageTree(I18n::Message::SoftwareVersion), SettingsMessageTree(I18n::Message::CustomSoftwareVersion), SettingsMessageTree(I18n::Message::MicroPythonVersion), SettingsMessageTree(I18n::Message::SerialNumber), SettingsMessageTree(I18n::Message::FccId), SettingsMessageTree(I18n::Message::Contributors, s_contributorsChildren, 7)};
|
||||
@@ -27,7 +28,8 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
{SettingsMessageTree(I18n::Message::MathOptions, s_modelMathOptionsChildren, 5),
|
||||
SettingsMessageTree(I18n::Message::Brightness),
|
||||
SettingsMessageTree(I18n::Message::Language),
|
||||
SettingsMessageTree(I18n::Message::ExamMode, s_modelExamChildren, 4),
|
||||
SettingsMessageTree(I18n::Message::ExamMode, s_modelExamChildren, 3),
|
||||
SettingsMessageTree(I18n::Message::PythonFont, s_pythonFont, 2),
|
||||
SettingsMessageTree(I18n::Message::BetaPopUp),
|
||||
SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren, 6),
|
||||
#ifdef USERNAME
|
||||
@@ -36,7 +38,7 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren, 6)};
|
||||
#endif
|
||||
|
||||
constexpr SettingsMessageTree s_model = SettingsMessageTree(I18n::Message::SettingsApp, s_modelMenu, 7);
|
||||
constexpr SettingsMessageTree s_model = SettingsMessageTree(I18n::Message::SettingsApp, s_modelMenu, 8);
|
||||
|
||||
I18n::Message MainController::promptMessage() const {
|
||||
return I18n::Message::BetaPopUp;
|
||||
|
||||
@@ -17,6 +17,7 @@ constexpr SettingsMessageTree s_symbolChildren[4] = {SettingsMessageTree(I18n::M
|
||||
//sub-menus
|
||||
constexpr SettingsMessageTree s_modelMathOptionsChildren[5] = {SettingsMessageTree(I18n::Message::AngleUnit, s_modelAngleChildren, 3), SettingsMessageTree(I18n::Message::DisplayMode, s_modelFloatDisplayModeChildren, 4), SettingsMessageTree(I18n::Message::EditionMode, s_modelEditionModeChildren, 2), SettingsMessageTree(I18n::Message::ComplexFormat, s_modelComplexFormatChildren, 3), SettingsMessageTree(I18n::Message::SymbolMultiplication, s_symbolChildren, 4)};
|
||||
constexpr SettingsMessageTree s_modelExamChildren[3] = {SettingsMessageTree(I18n::Message::LEDColor, s_ledColorChildren, 4), SettingsMessageTree(I18n::Message::ExamModeMode, s_examModeMode, 3), SettingsMessageTree(I18n::Message::ActivateExamMode)};
|
||||
constexpr SettingsMessageTree s_pythonFont[2] = {SettingsMessageTree(I18n::Message::Large), SettingsMessageTree(I18n::Message::Small)};
|
||||
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)};
|
||||
#ifdef USERNAME
|
||||
constexpr SettingsMessageTree s_modelAboutChildren[7] = {SettingsMessageTree(I18n::Message::Username), SettingsMessageTree(I18n::Message::SoftwareVersion), SettingsMessageTree(I18n::Message::CustomSoftwareVersion), SettingsMessageTree(I18n::Message::MicroPythonVersion), SettingsMessageTree(I18n::Message::SerialNumber), SettingsMessageTree(I18n::Message::FccId), SettingsMessageTree(I18n::Message::Contributors, s_contributorsChildren, 7)};
|
||||
@@ -29,6 +30,7 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
SettingsMessageTree(I18n::Message::Brightness),
|
||||
SettingsMessageTree(I18n::Message::Language),
|
||||
SettingsMessageTree(I18n::Message::ExamMode, s_modelExamChildren, 3),
|
||||
SettingsMessageTree(I18n::Message::PythonFont, s_pythonFont, 2),
|
||||
SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren, 6),
|
||||
#ifdef USERNAME
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren, 7)};
|
||||
@@ -36,7 +38,7 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren, 6)};
|
||||
#endif
|
||||
|
||||
constexpr SettingsMessageTree s_model = SettingsMessageTree(I18n::Message::SettingsApp, s_modelMenu, 6);
|
||||
constexpr SettingsMessageTree s_model = SettingsMessageTree(I18n::Message::SettingsApp, s_modelMenu, 7);
|
||||
|
||||
I18n::Message MainController::promptMessage() const {
|
||||
return I18n::Message::Default;
|
||||
|
||||
@@ -16,6 +16,7 @@ constexpr SettingsMessageTree s_symbolChildren[4] = {SettingsMessageTree(I18n::M
|
||||
//sub-menus
|
||||
constexpr SettingsMessageTree s_modelMathOptionsChildren[5] = {SettingsMessageTree(I18n::Message::AngleUnit, s_modelAngleChildren, 3), SettingsMessageTree(I18n::Message::DisplayMode, s_modelFloatDisplayModeChildren, 4), SettingsMessageTree(I18n::Message::EditionMode, s_modelEditionModeChildren, 2), SettingsMessageTree(I18n::Message::ComplexFormat, s_modelComplexFormatChildren, 3), SettingsMessageTree(I18n::Message::SymbolMultiplication, s_symbolChildren, 4)};
|
||||
constexpr SettingsMessageTree s_modelExamChildren[3] = {SettingsMessageTree(I18n::Message::LEDColor, s_ledColorChildren, 4), SettingsMessageTree(I18n::Message::ExamModeMode, s_examModeMode, 3), SettingsMessageTree(I18n::Message::ActivateExamMode)};
|
||||
constexpr SettingsMessageTree s_pythonFont[2] = {SettingsMessageTree(I18n::Message::Large), SettingsMessageTree(I18n::Message::Small)};
|
||||
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)};
|
||||
#ifdef USERNAME
|
||||
constexpr SettingsMessageTree s_modelAboutChildren[7] = {SettingsMessageTree(I18n::Message::Username), SettingsMessageTree(I18n::Message::SoftwareVersion), SettingsMessageTree(I18n::Message::CustomSoftwareVersion), SettingsMessageTree(I18n::Message::MicroPythonVersion), SettingsMessageTree(I18n::Message::SerialNumber), SettingsMessageTree(I18n::Message::FccId), SettingsMessageTree(I18n::Message::Contributors, s_contributorsChildren, 7)};
|
||||
@@ -27,7 +28,8 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
{SettingsMessageTree(I18n::Message::MathOptions, s_modelMathOptionsChildren, 5),
|
||||
SettingsMessageTree(I18n::Message::Brightness),
|
||||
SettingsMessageTree(I18n::Message::Language),
|
||||
SettingsMessageTree(I18n::Message::ExamMode, s_modelExamChildren, 4),
|
||||
SettingsMessageTree(I18n::Message::ExamMode, s_modelExamChildren, 3),
|
||||
SettingsMessageTree(I18n::Message::PythonFont, s_pythonFont, 2),
|
||||
SettingsMessageTree(I18n::Message::UpdatePopUp),
|
||||
SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren, 6),
|
||||
#ifdef USERNAME
|
||||
@@ -36,7 +38,7 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren, 6)};
|
||||
#endif
|
||||
|
||||
constexpr SettingsMessageTree s_model = SettingsMessageTree(I18n::Message::SettingsApp, s_modelMenu, 7);
|
||||
constexpr SettingsMessageTree s_model = SettingsMessageTree(I18n::Message::SettingsApp, s_modelMenu, 8);
|
||||
|
||||
I18n::Message MainController::promptMessage() const {
|
||||
return I18n::Message::UpdatePopUp;
|
||||
|
||||
@@ -128,7 +128,7 @@ Layout PreferencesController::layoutForPreferences(I18n::Message message) {
|
||||
const char * text = " ";
|
||||
return LayoutHelper::String(text, strlen(text), k_layoutFont);
|
||||
}
|
||||
|
||||
|
||||
// Exam mode modes
|
||||
case I18n::Message::ExamModeModeStandard:
|
||||
{
|
||||
@@ -145,7 +145,7 @@ Layout PreferencesController::layoutForPreferences(I18n::Message message) {
|
||||
const char * text = " ";
|
||||
return LayoutHelper::String(text, strlen(text), k_layoutFont);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Symbol controller
|
||||
case I18n::Message::SymbolMultiplicationCross: // × and · aren't single characters, so they cannot be constructed into codepoints..?
|
||||
@@ -163,6 +163,12 @@ Layout PreferencesController::layoutForPreferences(I18n::Message message) {
|
||||
case I18n::Message::SymbolMultiplicationAutoSymbol:
|
||||
return CodePointLayout::Builder(' ', k_layoutFont);
|
||||
|
||||
// Font size
|
||||
case I18n::Message::Large:
|
||||
return LayoutHelper::String("000", 3, KDFont::LargeFont);
|
||||
case I18n::Message::Small:
|
||||
return LayoutHelper::String("000", 3, KDFont::SmallFont);
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
return Layout();
|
||||
@@ -204,6 +210,8 @@ void PreferencesController::setPreferenceWithValueIndex(I18n::Message message, i
|
||||
GlobalPreferences::sharedGlobalPreferences()->setTempExamMode((GlobalPreferences::ExamMode)((uint8_t)valueIndex + 1));
|
||||
} else if (message == I18n::Message::SymbolMultiplication) {
|
||||
preferences->setSymbolMultiplication((Preferences::SymbolMultiplication)valueIndex);
|
||||
} else if (message == I18n::Message::PythonFont) {
|
||||
preferences->setPythonFont((Preferences::PythonFont)valueIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,6 +235,9 @@ int PreferencesController::valueIndexForPreference(I18n::Message message) const
|
||||
if (message == I18n::Message::SymbolMultiplication) {
|
||||
return (int)preferences->symbolofMultiplication();
|
||||
}
|
||||
if (message == I18n::Message::PythonFont) {
|
||||
return (int)preferences->pythonFont();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define POINCARE_PREFERENCES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <kandinsky.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
@@ -48,6 +49,10 @@ public:
|
||||
Star = 2,
|
||||
Auto = 3
|
||||
};
|
||||
enum class PythonFont : uint8_t {
|
||||
Large = 0,
|
||||
Small = 1
|
||||
};
|
||||
Preferences();
|
||||
static Preferences * sharedPreferences();
|
||||
AngleUnit angleUnit() const { return m_angleUnit; }
|
||||
@@ -62,8 +67,11 @@ public:
|
||||
void setNumberOfSignificantDigits(uint8_t numberOfSignificantDigits) { m_numberOfSignificantDigits = numberOfSignificantDigits; }
|
||||
LEDColor colorOfLED() const { return m_colorOfLED; }
|
||||
void setColorOfLED(LEDColor color) { m_colorOfLED = color; }
|
||||
SymbolMultiplication symbolofMultiplication() const {return m_symbolMultiplication;}
|
||||
void setSymbolMultiplication(SymbolMultiplication symbolofMultiplication) {m_symbolMultiplication = symbolofMultiplication;}
|
||||
SymbolMultiplication symbolofMultiplication() const { return m_symbolMultiplication; }
|
||||
void setSymbolMultiplication(SymbolMultiplication symbolofMultiplication) { m_symbolMultiplication = symbolofMultiplication; }
|
||||
PythonFont pythonFont() const { return m_pythonFont; }
|
||||
void setPythonFont(PythonFont pythonFont) { m_pythonFont = pythonFont; }
|
||||
const KDFont * KDPythonFont() const { return (m_pythonFont == PythonFont::Small) ? KDFont::SmallFont : KDFont::LargeFont; }
|
||||
private:
|
||||
AngleUnit m_angleUnit;
|
||||
PrintFloatMode m_displayMode;
|
||||
@@ -72,6 +80,7 @@ private:
|
||||
uint8_t m_numberOfSignificantDigits;
|
||||
LEDColor m_colorOfLED;
|
||||
SymbolMultiplication m_symbolMultiplication;
|
||||
PythonFont m_pythonFont;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,8 @@ Preferences::Preferences() :
|
||||
m_complexFormat(Preferences::ComplexFormat::Real),
|
||||
m_numberOfSignificantDigits(PrintFloat::k_numberOfPrintedSignificantDigits),
|
||||
m_colorOfLED(Preferences::LEDColor::White),
|
||||
m_symbolMultiplication(Preferences::SymbolMultiplication::Auto)
|
||||
m_symbolMultiplication(Preferences::SymbolMultiplication::Auto),
|
||||
m_pythonFont(Preferences::PythonFont::Large)
|
||||
{}
|
||||
|
||||
Preferences * Preferences::sharedPreferences() {
|
||||
|
||||
Reference in New Issue
Block a user