mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Merge branch 'omega-dev' of https://github.com/MixedMatched/Omega into MixedMatched-omega-dev
This commit is contained in:
@@ -15,7 +15,6 @@ app_settings_src = $(addprefix apps/settings/,\
|
||||
sub_menu/preferences_controller.cpp \
|
||||
sub_menu/contributors_controller.cpp \
|
||||
sub_menu/math_options_controller.cpp \
|
||||
sub_menu/symbol_controller.cpp \
|
||||
)
|
||||
|
||||
app_src += $(app_settings_src)
|
||||
|
||||
@@ -42,8 +42,8 @@ AccessibilityGammaRed = "Red gamma"
|
||||
AccessibilityGammaGreen = "Green gamma"
|
||||
AccessibilityGammaBlue = "Blue gamma"
|
||||
MathOptions = "Math options"
|
||||
SymbolMultiplication = "Multiplication sign"
|
||||
SymbolMultiplicationCross = "Cross"
|
||||
SymbolMultiplicationMiddleDot = "Middle dot"
|
||||
SymbolMultiplicationStar = "Star"
|
||||
SymbolMultiplicationAutoSymbol = "Automatic"
|
||||
SymbolMultiplication = "Multiply sign"
|
||||
SymbolMultiplicationCross = "Cross "
|
||||
SymbolMultiplicationMiddleDot = "Dot "
|
||||
SymbolMultiplicationStar = "Star "
|
||||
SymbolMultiplicationAutoSymbol = "Auto "
|
||||
|
||||
@@ -42,8 +42,8 @@ AccessibilityGammaRed = "Gamma roja"
|
||||
AccessibilityGammaGreen = "Gamma verde"
|
||||
AccessibilityGammaBlue = "Gamma azul"
|
||||
MathOptions = "Matemáticas"
|
||||
SymbolMultiplication = "signo de multiplicación"
|
||||
SymbolMultiplicationCross = "contrariar"
|
||||
SymbolMultiplicationMiddleDot = "punto medio"
|
||||
SymbolMultiplicationStar = "estrella"
|
||||
SymbolMultiplicationAutoSymbol = "automático"
|
||||
SymbolMultiplication = "Signo de multiplicación"
|
||||
SymbolMultiplicationCross = "Contrariar "
|
||||
SymbolMultiplicationMiddleDot = "Punto "
|
||||
SymbolMultiplicationStar = "Estrella "
|
||||
SymbolMultiplicationAutoSymbol = "Auto "
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "sub_menu/exam_mode_controller.h"
|
||||
#include "sub_menu/language_controller.h"
|
||||
#include "sub_menu/math_options_controller.h"
|
||||
#include "sub_menu/symbol_controller.h"
|
||||
|
||||
namespace Settings {
|
||||
|
||||
|
||||
@@ -9,8 +9,7 @@ namespace Settings {
|
||||
MathOptionsController::MathOptionsController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate) :
|
||||
GenericSubController(parentResponder),
|
||||
m_preferencesController(this),
|
||||
m_displayModeController(this, inputEventHandlerDelegate),
|
||||
m_symbolController(this)
|
||||
m_displayModeController(this, inputEventHandlerDelegate)
|
||||
{
|
||||
for (int i = 0; i < k_totalNumberOfCell; i++) {
|
||||
m_cells[i].setMessageFont(KDFont::LargeFont);
|
||||
@@ -22,8 +21,6 @@ bool MathOptionsController::handleEvent(Ion::Events::Event event) {
|
||||
GenericSubController * subController = nullptr;
|
||||
if (m_messageTreeModel->children(selectedRow())->label() == I18n::Message::DisplayMode)
|
||||
subController = &m_displayModeController;
|
||||
else if (m_messageTreeModel->children(selectedRow())->label() == I18n::Message::SymbolMultiplication)
|
||||
subController = &m_symbolController;
|
||||
else
|
||||
subController = &m_preferencesController;
|
||||
subController->setMessageTreeModel(m_messageTreeModel->children(selectedRow()));
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "generic_sub_controller.h"
|
||||
#include <escher.h>
|
||||
#include "display_mode_controller.h"
|
||||
#include "symbol_controller.h"
|
||||
#include "preferences_controller.h"
|
||||
|
||||
namespace Settings {
|
||||
@@ -21,7 +20,6 @@ private:
|
||||
MessageTableCellWithChevronAndMessage m_cells[k_totalNumberOfCell];
|
||||
PreferencesController m_preferencesController;
|
||||
DisplayModeController m_displayModeController;
|
||||
SymbolController m_symbolController;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -130,6 +130,22 @@ Layout PreferencesController::layoutForPreferences(I18n::Message message) {
|
||||
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..?
|
||||
{
|
||||
const char * text = "×";
|
||||
return LayoutHelper::String(text, strlen(text), k_layoutFont);
|
||||
}
|
||||
case I18n::Message::SymbolMultiplicationMiddleDot:
|
||||
{
|
||||
const char * text = "·";
|
||||
return LayoutHelper::String(text, strlen(text), k_layoutFont);
|
||||
}
|
||||
case I18n::Message::SymbolMultiplicationStar:
|
||||
return CodePointLayout::Builder('*', k_layoutFont);
|
||||
case I18n::Message::SymbolMultiplicationAutoSymbol:
|
||||
return CodePointLayout::Builder(' ', k_layoutFont);
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
return Layout();
|
||||
@@ -167,6 +183,8 @@ void PreferencesController::setPreferenceWithValueIndex(I18n::Message message, i
|
||||
preferences->setComplexFormat((Preferences::ComplexFormat)valueIndex);
|
||||
} else if (message == I18n::Message::LEDColor) {
|
||||
preferences->setColorOfLED((Preferences::LEDColor)valueIndex);
|
||||
} else if (message == I18n::Message::SymbolMultiplication) {
|
||||
preferences->setSymbolMultiplication((Preferences::SymbolMultiplication)valueIndex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,6 +205,9 @@ int PreferencesController::valueIndexForPreference(I18n::Message message) {
|
||||
if (message == I18n::Message::LEDColor) {
|
||||
return (int)preferences->colorOfLED();
|
||||
}
|
||||
if (message == I18n::Message::SymbolMultiplication) {
|
||||
return (int)preferences->symbolofMultiplication();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
#include "symbol_controller.h"
|
||||
#include <assert.h>
|
||||
#include <poincare/preferences.h>
|
||||
|
||||
using namespace Shared;
|
||||
using namespace Poincare;
|
||||
|
||||
namespace Settings {
|
||||
|
||||
SymbolController::SymbolController(Responder * parentResponder) :
|
||||
GenericSubController(parentResponder)
|
||||
{
|
||||
for (int i = 0; i < k_totalNumberOfSwitchCells; i++) {
|
||||
m_switchCells[i].setMessageFont(KDFont::LargeFont);
|
||||
}
|
||||
}
|
||||
|
||||
bool SymbolController::handleEvent(Ion::Events::Event event) {
|
||||
Preferences * preferences = Preferences::sharedPreferences();
|
||||
Poincare::Preferences::SymbolMultiplication oldSymbolOfMultiplication = preferences->symbolofMultiplication();
|
||||
Poincare::Preferences::SymbolMultiplication newSymbolOfMultiplication = preferences->symbolofMultiplication();
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE){
|
||||
switch(selectedRow()){
|
||||
case 0:
|
||||
{
|
||||
newSymbolOfMultiplication = Poincare::Preferences::SymbolMultiplication::Cross;
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
newSymbolOfMultiplication = Poincare::Preferences::SymbolMultiplication::MiddleDot;
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
newSymbolOfMultiplication = Poincare::Preferences::SymbolMultiplication::Star;
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
newSymbolOfMultiplication = Poincare::Preferences::SymbolMultiplication::Auto;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
GenericSubController::handleEvent(event);
|
||||
}
|
||||
}
|
||||
if (oldSymbolOfMultiplication == newSymbolOfMultiplication) {
|
||||
if (newSymbolOfMultiplication == Poincare::Preferences::SymbolMultiplication::Auto) {
|
||||
preferences->setSymbolMultiplication(Poincare::Preferences::SymbolMultiplication::Cross);
|
||||
} else {
|
||||
preferences->setSymbolMultiplication(Poincare::Preferences::SymbolMultiplication::Auto);
|
||||
}
|
||||
} else {
|
||||
preferences->setSymbolMultiplication(newSymbolOfMultiplication);
|
||||
}
|
||||
m_selectableTableView.reloadData();
|
||||
return true;
|
||||
} else {
|
||||
return GenericSubController::handleEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
HighlightCell * SymbolController::reusableCell(int index, int type) {
|
||||
assert(type == 1 || type == 2);
|
||||
if (type == 2) {
|
||||
assert(index >= 0 && index < k_totalNumberOfSwitchCells);
|
||||
return &m_switchCells[index];
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int SymbolController::reusableCellCount(int type) {
|
||||
assert(type == 1 || type == 2);
|
||||
if (type == 2) {
|
||||
return k_totalNumberOfSwitchCells;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void SymbolController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
GenericSubController::willDisplayCellForIndex(cell, index);
|
||||
|
||||
MessageTableCellWithSwitch * mySwitchCell = (MessageTableCellWithSwitch *)cell;
|
||||
|
||||
Preferences * preferences = Preferences::sharedPreferences();
|
||||
Poincare::Preferences::SymbolMultiplication symbolofMultiplication = preferences->symbolofMultiplication();
|
||||
|
||||
if (index == 0) {
|
||||
SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView();
|
||||
if(symbolofMultiplication == Poincare::Preferences::SymbolMultiplication::Cross){
|
||||
mySwitch->setState(true);
|
||||
} else {
|
||||
mySwitch->setState(false);
|
||||
}
|
||||
}
|
||||
else if (index == 1) {
|
||||
SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView();
|
||||
if(symbolofMultiplication == Poincare::Preferences::SymbolMultiplication::MiddleDot){
|
||||
mySwitch->setState(true);
|
||||
} else {
|
||||
mySwitch->setState(false);
|
||||
}
|
||||
}
|
||||
else if (index == 2) {
|
||||
SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView();
|
||||
if (symbolofMultiplication == Poincare::Preferences::SymbolMultiplication::Star){
|
||||
mySwitch->setState(true);
|
||||
} else {
|
||||
mySwitch->setState(false);
|
||||
}
|
||||
}
|
||||
else if (index == 3){
|
||||
SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView();
|
||||
if(symbolofMultiplication == Poincare::Preferences::SymbolMultiplication::Auto){
|
||||
mySwitch->setState(true);
|
||||
} else {
|
||||
mySwitch->setState(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int SymbolController::typeAtLocation(int i, int j) {
|
||||
switch (j) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
return 2;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
#ifndef SETTINGS_SYMBOLCONTROLLER_CONTROLLER_H
|
||||
#define SETTINGS_SYMBOLCONTROLLER_CONTROLLER_H
|
||||
|
||||
#include "generic_sub_controller.h"
|
||||
|
||||
namespace Settings {
|
||||
|
||||
class SymbolController : public GenericSubController {
|
||||
public:
|
||||
SymbolController(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:
|
||||
constexpr static int k_totalNumberOfSwitchCells = 4;
|
||||
MessageTableCellWithSwitch m_switchCells[k_totalNumberOfSwitchCells];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -36,13 +36,13 @@ public:
|
||||
Radian = 1,
|
||||
Gradian = 2
|
||||
};
|
||||
enum class LEDColor {
|
||||
enum class LEDColor : uint8_t {
|
||||
White = 0,
|
||||
Green = 1,
|
||||
Blue = 2,
|
||||
Yellow = 3
|
||||
};
|
||||
enum class SymbolMultiplication {
|
||||
enum class SymbolMultiplication : uint8_t {
|
||||
Cross = 0,
|
||||
MiddleDot = 1,
|
||||
Star = 2,
|
||||
@@ -71,7 +71,7 @@ private:
|
||||
ComplexFormat m_complexFormat;
|
||||
uint8_t m_numberOfSignificantDigits;
|
||||
LEDColor m_colorOfLED;
|
||||
SymbolMultiplication m_symbolMultiplication;
|
||||
SymbolMultiplication m_symbolMultiplication;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user