mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
Compare commits
61 Commits
upsilon-de
...
upsilon-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
352cf39602 | ||
|
|
eed6683c74 | ||
|
|
9d5904396d | ||
|
|
7dec23dd91 | ||
|
|
e5fb5f390e | ||
|
|
e3887ca077 | ||
|
|
46a30a6061 | ||
|
|
32ccd8530c | ||
|
|
6ff8b007be | ||
|
|
0834cbd054 | ||
|
|
a138ecaa9e | ||
|
|
f8e6ee64ef | ||
|
|
5fbc7feaa1 | ||
|
|
1a2a61a43c | ||
|
|
25766967e2 | ||
|
|
52ac8e2acb | ||
|
|
8cc09405e1 | ||
|
|
efdf2a379f | ||
|
|
26496fbf00 | ||
|
|
668641ce95 | ||
|
|
72dfb76cc8 | ||
|
|
0dafa539df | ||
|
|
36c984c73b | ||
|
|
fd5fba07e5 | ||
|
|
6e6ba6a985 | ||
|
|
57078755a3 | ||
|
|
710930d8e1 | ||
|
|
5c9bccdd99 | ||
|
|
6ffb70e513 | ||
|
|
b42d4197c9 | ||
|
|
17be5934e0 | ||
|
|
18e7926500 | ||
|
|
559d5d26dd | ||
|
|
89c08acc7f | ||
|
|
04cf7bb0bf | ||
|
|
73f2a7ecac | ||
|
|
9c9758fcb6 | ||
|
|
83ce9d5e86 | ||
|
|
d4f0c7d3e8 | ||
|
|
2837b240e9 | ||
|
|
0906dc919b | ||
|
|
9cda9d9e59 | ||
|
|
553f3fc682 | ||
|
|
9fdedecbff | ||
|
|
83c63a7011 | ||
|
|
9636964cb9 | ||
|
|
69d6ad5205 | ||
|
|
f9a123cc08 | ||
|
|
56f735e302 | ||
|
|
0a5e9e0889 | ||
|
|
8c949d7048 | ||
|
|
2f7edc5024 | ||
|
|
cd40938b26 | ||
|
|
0b54bf13f4 | ||
|
|
f5f11c6478 | ||
|
|
efda561425 | ||
|
|
15c96cefa6 | ||
|
|
400d03ebdb | ||
|
|
6f48adde7d | ||
|
|
3a573b1204 | ||
|
|
48598296cf |
1
.github/workflows/metric-workflow.yml
vendored
1
.github/workflows/metric-workflow.yml
vendored
@@ -31,7 +31,6 @@ jobs:
|
||||
- name: Add comment
|
||||
uses: actions/github-script@v3.0.0
|
||||
with:
|
||||
github-token: ${{ secrets.OMEGA_ROBOT_TOKEN }}
|
||||
script: |
|
||||
await github.issues.createComment({
|
||||
owner: context.repo.owner,
|
||||
|
||||
17
Makefile
17
Makefile
@@ -13,7 +13,18 @@ include build/variants.mak
|
||||
include build/helpers.mk
|
||||
|
||||
ifeq (${MODEL}, n0100)
|
||||
EPSILON_APPS := $(filter-out reader,$(EPSILON_APPS))
|
||||
ifeq ($(filter reader,$(apps_list)),)
|
||||
$(warning reader app included, removing it on n0100. )
|
||||
EPSILON_APPS := $(filter-out reader,$(EPSILON_APPS))
|
||||
endif
|
||||
ifneq ($(words $(EPSILON_I18N)), 1)
|
||||
$(warning Only use 1 language on n0100, defaulting to en. )
|
||||
EPSILON_I18N := en
|
||||
endif
|
||||
ifeq ($(INCLUDE_ULAB), 1)
|
||||
$(warning Removing uLab on n0100. )
|
||||
INCLUDE_ULAB := 0
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (${MODEL}, n0110)
|
||||
@@ -26,6 +37,10 @@ ifdef FORCE_EXTERNAL
|
||||
apps_list = ${EPSILON_APPS}
|
||||
endif
|
||||
|
||||
ifeq ($(INCLUDE_ULAB), 1)
|
||||
SFLAGS += -DINCLUDE_ULAB
|
||||
endif
|
||||
|
||||
ifdef HOME_DISPLAY_EXTERNALS
|
||||
ifneq ($(filter external,$(apps_list)),)
|
||||
SFLAGS += -DHOME_DISPLAY_EXTERNALS
|
||||
|
||||
@@ -143,6 +143,10 @@ Si vous avez besoin d'aide, n'hésitez pas à rejoindre notre serveur discord :
|
||||
<a href="https://discord.gg/Q9buEMduXG"><p align="center"><img alt="Omega Banner Discord" src="https://user-images.githubusercontent.com/12123721/86287349-54ef5800-bbe8-11ea-80c1-34eb1f93eebd.png" /></p></a>
|
||||
---
|
||||
|
||||
## Liens utiles
|
||||
* [Upsilon external (pour installer des applications supplémentaires et des fonds d'écran)](https://lauryy06.github.io/Upsilon-External/)
|
||||
* [Documentation d'ulab](https://micropython-ulab.readthedocs.io/en/latest/)
|
||||
|
||||
## Contribution
|
||||
|
||||
Pour contribuer, merci de lire le [Wiki d'Omega](https://github.com/Omega-Numworks/Omega/wiki/Contributing), les mêmes règles s'appliquent ici.
|
||||
|
||||
13
README.md
13
README.md
@@ -7,7 +7,7 @@
|
||||
<a href="https://discord.gg/Q9buEMduXG"><img alt="Discord" src="https://img.shields.io/discord/663420259851567114?color=blue&labelColor=292929&label=chat%20-%20discord&logo=discord&style=for-the-badge" /></a>
|
||||
</p>
|
||||
|
||||
> Vous ne comprenez pas l'anglais ? vous êtes francophone ? Regardez le [*LISEZ-MOI* français](./README.fr.md) !
|
||||
> Vous ne comprenez pas l'anglais ? Vous êtes francophone ? Regardez le [*LISEZ-MOI* français](./README.fr.md) !
|
||||
|
||||
## About
|
||||
|
||||
@@ -18,7 +18,7 @@ Upsilon is a fork of Omega, an user-made OS that runs on the Numworks calculator
|
||||
|
||||
### Some new features
|
||||
- Enhancements for the Kandinsky python module
|
||||
- A support for wallpapers
|
||||
- Support for wallpapers
|
||||
- Exernal apps
|
||||
- A custom theme
|
||||
- Operator overload for python
|
||||
@@ -259,15 +259,18 @@ Don't forget to put your pseudo instead of `{your pseudo, max 15 char}`. If you
|
||||
|
||||
<br>
|
||||
|
||||
If you need help, you can join our Discord server here : https://discord.gg/Q9buEMduXG
|
||||
If you need help, you can join our Discord server here : https://discord.gg/NFvzdCBTQn
|
||||
|
||||
<a href="https://discord.gg/Q9buEMduXG"><p align="center"><img alt="Omega Banner Discord" src="https://user-images.githubusercontent.com/12123721/86287349-54ef5800-bbe8-11ea-80c1-34eb1f93eebd.png" /></p></a>
|
||||
<a href="https://discord.gg/NFvzdCBTQn"><p align="center"><img alt="Omega Banner Discord" src="https://user-images.githubusercontent.com/12123721/86287349-54ef5800-bbe8-11ea-80c1-34eb1f93eebd.png" /></p></a>
|
||||
---
|
||||
## Useful links
|
||||
* [Upsilon external (to install additional apps and wallpapers)](https://lauryy06.github.io/Upsilon-External/)
|
||||
* [Ulab documentation](https://micropython-ulab.readthedocs.io/en/latest/)
|
||||
|
||||
## Contributing
|
||||
|
||||
To contribute, please refer to [Omega's Wiki](https://github.com/Omega-Numworks/Omega/wiki/Contributing), the same rules apply here.
|
||||
|
||||
|
||||
## Related repositories
|
||||
|
||||
Here are the main links toward Omega's different websites and repositories, that have been used for the creation of Upsilon.
|
||||
|
||||
@@ -75,7 +75,7 @@ public:
|
||||
|
||||
VariableBoxController * variableBoxController() { return &m_variableBoxController; }
|
||||
|
||||
static constexpr int k_pythonHeapSize = 100000;
|
||||
static constexpr int k_pythonHeapSize = 67000;
|
||||
|
||||
private:
|
||||
/* Python delegate:
|
||||
|
||||
@@ -62,6 +62,7 @@ PythonFloor = "Abrunden"
|
||||
PythonFmod = "a modulo b"
|
||||
PythonFrExp = "Mantisse und Exponent von x: (m,e)"
|
||||
PythonGamma = "Gamma-Funktion"
|
||||
PythonGetKeys = "Gedrückte Tasten erhalten"
|
||||
PythonGetPalette = "Themenpalette erhalten"
|
||||
PythonGetPixel = "Farbe von Pixel (x,y) zurückgeben"
|
||||
PythonGetrandbits = "Ganzzahl mit k Zufallsbits"
|
||||
@@ -77,11 +78,19 @@ PythonImportMatplotlibPyplot = "Matplotlib.pyplot-Modul importieren"
|
||||
PythonImportNumpy = "Ulab.numpy-Modul importieren"
|
||||
PythonImportScipy = "Ulab.scipy-Modul importieren"
|
||||
PythonImportOs = "OS-Modul importieren"
|
||||
PythonImportSys = "SYS-Modul importieren"
|
||||
PythonOsUname = "Informationen über das System holen"
|
||||
PythonOsGetlogin = "Benutzernamen holen"
|
||||
PythonOsRemove = "Datei namens Dateiname entfernen"
|
||||
PythonOsRename = "Datei umbenennen von Alt nach Neu"
|
||||
PythonOsListdir = "Dateien im Speicher auflisten"
|
||||
PythonSysExit = "Terminate current program"
|
||||
PythonSysPrintexception = "Print exception"
|
||||
PythonSysByteorder = "The byte order of the system"
|
||||
PythonSysImplementation = "Information about Python"
|
||||
PythonSysModules = "Dictionary of loaded modules"
|
||||
PythonSysVersion = "Python language version (string)"
|
||||
PythonSysVersioninfo = "Python language version (tuple)"
|
||||
PythonImportTime = "Time-Modul importieren"
|
||||
PythonImportTurtle = "Turtle-Modul importieren"
|
||||
PythonIndex = "Index des ersten x-Vorkommens"
|
||||
@@ -145,7 +154,7 @@ PythonSleep = "Ausführung aussetzen für t Sekunden"
|
||||
PythonLocalTime = "Zeit in Tupel umwandeln"
|
||||
PythonMktime = "Tupel in Zeit umwandeln"
|
||||
PythonTime = "Abrufen des aktuellen Zeitstempels"
|
||||
PythonSetLocaltime = "Zeit aus einem Tupel von localtime()"
|
||||
PythonSetLocaltime = "Zeit aus einem Tupel einstellen"
|
||||
PythonRTCmode = "Aktuellen RTC-Modus abrufen"
|
||||
PythonSetRTCmode = "RTC-Modus festlegen"
|
||||
PythonSort = "Die Liste sortieren"
|
||||
|
||||
@@ -62,6 +62,7 @@ PythonFloor = "Floor"
|
||||
PythonFmod = "a modulo b"
|
||||
PythonFrExp = "Mantissa and exponent of x: (m,e)"
|
||||
PythonGamma = "Gamma function"
|
||||
PythonGetKeys = "Get keys pressed"
|
||||
PythonGetPalette = "Get theme palette"
|
||||
PythonGetPixel = "Return pixel (x,y) color"
|
||||
PythonGetrandbits = "Integer with k random bits"
|
||||
@@ -139,7 +140,7 @@ PythonSleep = "Suspend the execution for t seconds"
|
||||
PythonLocalTime = "Convert time into tuple"
|
||||
PythonMktime = "Convert tuple into time"
|
||||
PythonTime = "Get the current timestamp"
|
||||
PythonSetLocaltime = "Set time from a tuple of localtime()"
|
||||
PythonSetLocaltime = "Set time from a tuple"
|
||||
PythonRTCmode = "Get current RTC mode"
|
||||
PythonSetRTCmode = "Set RTC mode"
|
||||
PythonSort = "Sort the list"
|
||||
@@ -175,11 +176,19 @@ PythonTurtleWrite = "Display a text"
|
||||
PythonUniform = "Floating point number in [a,b]"
|
||||
PythonImportTime = "Import time module"
|
||||
PythonImportOs = "Import os module"
|
||||
PythonImportSys = "Import sys module"
|
||||
PythonOsUname = "Get infos about the system"
|
||||
PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Remove file named filename"
|
||||
PythonOsRename = "Rename file oldname to newname"
|
||||
PythonOsListdir = "List files in memory"
|
||||
PythonSysExit = "Terminate current program"
|
||||
PythonSysPrintexception = "Print exception"
|
||||
PythonSysByteorder = "The byte order of the system"
|
||||
PythonSysImplementation = "Information about Python"
|
||||
PythonSysModules = "Dictionary of loaded modules"
|
||||
PythonSysVersion = "Python language version (string)"
|
||||
PythonSysVersioninfo = "Python language version (tuple)"
|
||||
PythonTimePrefix = "time module function prefix"
|
||||
PythonTimeSleep = "Wait for n second"
|
||||
PythonMonotonic = "Return monotonic time"
|
||||
|
||||
@@ -62,6 +62,7 @@ PythonFloor = "Floor"
|
||||
PythonFmod = "a modulo b"
|
||||
PythonFrExp = "Mantissa and exponent of x: (m,e)"
|
||||
PythonGamma = "Gamma function"
|
||||
PythonGetKeys = "Obtener teclas presionadas"
|
||||
PythonGetPalette = "Get theme palette"
|
||||
PythonGetPixel = "Return pixel (x,y) color"
|
||||
PythonGetrandbits = "Integer with k random bits"
|
||||
@@ -139,7 +140,7 @@ PythonSleep = "Suspend the execution for t seconds"
|
||||
PythonLocalTime = "Convertir el tiempo en tupla"
|
||||
PythonMktime = "Convertir tupla en tiempo"
|
||||
PythonTime = "Obtener la marca de tiempo actual"
|
||||
PythonSetLocaltime = "Establecer tiempo desde una tupla de localtime()"
|
||||
PythonSetLocaltime = "Establecer tiempo desde una tupla"
|
||||
PythonRTCmode = "Obtener el modo RTC actual"
|
||||
PythonSetRTCmode = "Establecer modo RTC"
|
||||
PythonSort = "Sort the list"
|
||||
@@ -175,11 +176,19 @@ PythonTurtleWrite = "Display a text"
|
||||
PythonUniform = "Floating point number in [a,b]"
|
||||
PythonImportTime = "Import time module"
|
||||
PythonImportOs = "Import os module"
|
||||
PythonImportSys = "Import sys module"
|
||||
PythonOsUname = " Información del sistema "
|
||||
PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Eliminar un archivo"
|
||||
PythonOsRename = "Renombrar archivo"
|
||||
PythonOsListdir = "Archivos de la lista"
|
||||
PythonSysExit = "Terminate current program"
|
||||
PythonSysPrintexception = "Print exception"
|
||||
PythonSysByteorder = "The byte order of the system"
|
||||
PythonSysImplementation = "Information about Python"
|
||||
PythonSysModules = "Dictionary of loaded modules"
|
||||
PythonSysVersion = "Python language version (string)"
|
||||
PythonSysVersioninfo = "Python language version (tuple)"
|
||||
PythonTimePrefix = "time module function prefix"
|
||||
PythonTimeSleep = "Esperar n segundos"
|
||||
PythonMonotonic = "Tiempo monótono de retorno"
|
||||
|
||||
@@ -62,6 +62,7 @@ PythonFloor = "Partie entière"
|
||||
PythonFmod = "a modulo b"
|
||||
PythonFrExp = "Mantisse et exposant de x : (m,e)"
|
||||
PythonGamma = "Fonction gamma"
|
||||
PythonGetKeys = "Obtenir les touches pressées"
|
||||
PythonGetPalette = "Obtient la palette du thème"
|
||||
PythonGetPixel = "Renvoie la couleur du pixel (x,y)"
|
||||
PythonGetrandbits = "Nombre aléatoire sur k bits"
|
||||
@@ -139,7 +140,7 @@ PythonSleep = "Suspend l'exécution t secondes"
|
||||
PythonLocalTime = "Convertir le temps en tuple"
|
||||
PythonMktime = "Convertir le tuple en temps"
|
||||
PythonTime = "Obtenir l'horodatage actuel"
|
||||
PythonSetLocaltime = "Définir l'heure à partir d'un tuple de localtime()"
|
||||
PythonSetLocaltime = "Définir l'heure à partir d'un tuple"
|
||||
PythonRTCmode = "Obtenir le mode RTC actuel"
|
||||
PythonSetRTCmode = "Définir le mode RTC"
|
||||
PythonSort = "Trie la liste"
|
||||
@@ -175,11 +176,19 @@ PythonTurtleWrite = "Affiche un texte"
|
||||
PythonUniform = "Nombre décimal dans [a,b]"
|
||||
PythonImportTime = "Importation du module temps"
|
||||
PythonImportOs = "Importation du module os"
|
||||
PythonImportSys = "Importation du module sys"
|
||||
PythonOsUname = "Donne des infos sur le système"
|
||||
PythonOsGetlogin = "Donne le nom d'utilisateur"
|
||||
PythonOsRemove = "Supprime le fichier nommé filename"
|
||||
PythonOsRename = "Renomme oldname en newname"
|
||||
PythonOsListdir = "Liste les fichiers"
|
||||
PythonSysExit = "Termine le programme"
|
||||
PythonSysPrintexception = "Imprime une exception"
|
||||
PythonSysByteorder = "L'ordre des octets du système"
|
||||
PythonSysImplementation = "Information sur Python"
|
||||
PythonSysModules = "Dictionnaire des modules chargés"
|
||||
PythonSysVersion = "Version du langage Python (string)"
|
||||
PythonSysVersioninfo = "Version du langage Python (tuple)"
|
||||
PythonTimePrefix = "Préfixe fonction du module temps"
|
||||
PythonTimeSleep = "Attendre n secondes"
|
||||
PythonMonotonic = "Retourne le temps monotone"
|
||||
|
||||
@@ -62,6 +62,7 @@ PythonFloor = "Egész része"
|
||||
PythonFmod = "a modulo b"
|
||||
PythonFrExp = "X mantissája és kiállítója"
|
||||
PythonGamma = "Gamma funkció"
|
||||
PythonGetKeys = "Billentyűk lenyomva"
|
||||
PythonGetPalette = "Téma paletta beszerzése"
|
||||
PythonGetPixel = "Visszatéríti (x,y) színét"
|
||||
PythonGetrandbits = "Váletlenszám visszatérítése k biten"
|
||||
@@ -139,7 +140,7 @@ PythonSleep = "t másodpercre meg állitani a programmot"
|
||||
PythonLocalTime = "Idő konvertálása csomóvá"
|
||||
PythonMktime = "A tuple konvertálása az időben"
|
||||
PythonTime = "Az aktuális időbélyeg letöltése"
|
||||
PythonSetLocaltime = "Állítsd be az időt egy tufából a localtime()"
|
||||
PythonSetLocaltime = "Idő beállítása egy csomóból"
|
||||
PythonRTCmode = "Aktuális RTC mód"
|
||||
PythonSetRTCmode = "RTC mód beállítása"
|
||||
PythonSort = "A listát rendezni"
|
||||
@@ -199,3 +200,11 @@ PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Fájl törlése"
|
||||
PythonOsRename = "Fájl átnevezése"
|
||||
PythonOsListdir = "Fájlok listája"
|
||||
PythonImportSys = "sys modul importálása"
|
||||
PythonSysExit = "Terminate current program"
|
||||
PythonSysPrintexception = "Print exception"
|
||||
PythonSysByteorder = "The byte order of the system"
|
||||
PythonSysImplementation = "Information about Python"
|
||||
PythonSysModules = "Dictionary of loaded modules"
|
||||
PythonSysVersion = "Python language version (string)"
|
||||
PythonSysVersioninfo = "Python language version (tuple)"
|
||||
|
||||
@@ -62,6 +62,7 @@ PythonFloor = "Parte intera"
|
||||
PythonFmod = "a modulo b"
|
||||
PythonFrExp = "Mantissa ed esponente di x : (m,e)"
|
||||
PythonGamma = "Funzione gamma"
|
||||
PythonGetKeys = "Premere i tasti"
|
||||
PythonGetPalette = "Ottieni la tavolozza del tema"
|
||||
PythonGetPixel = "Restituisce colore del pixel(x,y)"
|
||||
PythonGetrandbits = "Numero aleatorio con k bit"
|
||||
@@ -84,6 +85,14 @@ PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Rimuovere un file"
|
||||
PythonOsRename = "Rinomina file"
|
||||
PythonOsListdir = "Elenca file"
|
||||
PythonImportSys = "Importa modulo sys"
|
||||
PythonSysExit = "Terminate current program"
|
||||
PythonSysPrintexception = "Print exception"
|
||||
PythonSysByteorder = "The byte order of the system"
|
||||
PythonSysImplementation = "Information about Python"
|
||||
PythonSysModules = "Dictionary of loaded modules"
|
||||
PythonSysVersion = "Python language version (string)"
|
||||
PythonSysVersioninfo = "Python language version (tuple)"
|
||||
PythonIndex = "Indice prima occorrenza di x"
|
||||
PythonInput = "Inserire un valore"
|
||||
PythonInsert = "Inserire x in posizione i-esima"
|
||||
@@ -145,7 +154,7 @@ PythonSleep = "Sospende l'esecuzione t secondi"
|
||||
PythonLocalTime = "Converti il tempo in tuple"
|
||||
PythonMktime = "Converti tuple in tempo"
|
||||
PythonTime = "Ottieni il timestamp corrente"
|
||||
PythonSetLocaltime = "Imposta il tempo da una tupla di localtime()"
|
||||
PythonSetLocaltime = "Imposta il tempo da una tupla"
|
||||
PythonRTCmode = "Ottieni la modalità RTC corrente"
|
||||
PythonSetRTCmode = "Imposta modalità RTC"
|
||||
PythonSort = "Ordina l'elenco"
|
||||
|
||||
@@ -62,6 +62,7 @@ PythonFloor = "Vloer"
|
||||
PythonFmod = "a modulo b"
|
||||
PythonFrExp = "Mantisse en exponent van x: (m,e)"
|
||||
PythonGamma = "Gammafunctie"
|
||||
PythonGetKeys = "Get toetsen ingedrukt"
|
||||
PythonGetPalette = "Thema palet krijgen"
|
||||
PythonGetPixel = "Geef pixel (x,y) kleur (rgb)"
|
||||
PythonGetrandbits = "Integer met k willekeurige bits"
|
||||
@@ -83,6 +84,15 @@ PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Een bestand verwijderen"
|
||||
PythonOsRename = "Hernoem bestand"
|
||||
PythonOsListdir = "Lijstbestanden"
|
||||
PythonImportSys = "Importeer sys module"
|
||||
PythonImportSys = "Importeer sys module"
|
||||
PythonSysExit = "Terminate current program"
|
||||
PythonSysPrintexception = "Print exception"
|
||||
PythonSysByteorder = "The byte order of the system"
|
||||
PythonSysImplementation = "Information about Python"
|
||||
PythonSysModules = "Dictionary of loaded modules"
|
||||
PythonSysVersion = "Python language version (string)"
|
||||
PythonSysVersioninfo = "Python language version (tuple)"
|
||||
PythonImportTurtle = "Importeer turtle module"
|
||||
PythonIndex = "Index van de eerste x aanwezigheden"
|
||||
PythonInput = "Wijs een waarde toe"
|
||||
@@ -145,7 +155,7 @@ PythonSleep = "Stel executie voor t seconden uit"
|
||||
PythonLocalTime = "Zet tijd om in tuple"
|
||||
PythonMktime = "Tuple omzetten in tijd"
|
||||
PythonTime = "Haal de huidige tijdstempel"
|
||||
PythonSetLocaltime = "Stel de tijd in vanaf een tuple van localtime()"
|
||||
PythonSetLocaltime = "Stel de tijd in vanaf een tuple"
|
||||
PythonRTCmode = "Huidige RTC-modus kregen"
|
||||
PythonSetRTCmode = "RTC-modus instellen"
|
||||
PythonSort = "Sorteer de lijst"
|
||||
|
||||
@@ -62,6 +62,7 @@ PythonFloor = "Parte inteira"
|
||||
PythonFmod = "a módulo b"
|
||||
PythonFrExp = "Coeficiente e expoente de x: (m, e)"
|
||||
PythonGamma = "Função gama"
|
||||
PythonGetKeys = "Obter teclas pressionadas"
|
||||
PythonGetPalette = "Obter paleta temática"
|
||||
PythonGetPixel = "Devolve a cor do pixel (x,y)"
|
||||
PythonGetrandbits = "Número inteiro aleatório com k bits"
|
||||
@@ -139,7 +140,7 @@ PythonSleep = "Suspender a execução por t segundos"
|
||||
PythonLocalTime = "Convert o tempo em tupla"
|
||||
PythonMktime = "Convert tuple em tempo"
|
||||
PythonTime = "Obter o estamp de tempo atual"
|
||||
PythonSetLocaltime = "Definir tempo a partir de uma tupla de localtime()"
|
||||
PythonSetLocaltime = "Definir tempo a partir de uma tupla"
|
||||
PythonRTCmode = "Obter o modo RTC atual"
|
||||
PythonSetRTCmode = "Definir o modo RTC"
|
||||
PythonSort = "Ordenar a lista"
|
||||
@@ -180,6 +181,14 @@ PythonOsGetlogin = "Get username"
|
||||
PythonOsRemove = "Remover um ficheiro"
|
||||
PythonOsRename = "Renomear ficheiro"
|
||||
PythonOsListdir = "Listar ficheiros"
|
||||
PythonImportSys = "Import sys module"
|
||||
PythonSysExit = "Terminate current program"
|
||||
PythonSysPrintexception = "Print exception"
|
||||
PythonSysByteorder = "The byte order of the system"
|
||||
PythonSysImplementation = "Information about Python"
|
||||
PythonSysModules = "Dictionary of loaded modules"
|
||||
PythonSysVersion = "Python language version (string)"
|
||||
PythonSysVersioninfo = "Python language version (tuple)"
|
||||
PythonTimePrefix = "time module function prefix"
|
||||
PythonTimeSleep = "Wait for n second"
|
||||
PythonMonotonic = "Return monotonic time"
|
||||
|
||||
@@ -69,6 +69,7 @@ PythonCommandFloor = "floor(x)"
|
||||
PythonCommandFmod = "fmod(a,b)"
|
||||
PythonCommandFrExp = "frexp(x)"
|
||||
PythonCommandGamma = "gamma(x)"
|
||||
PythonCommandGetKeys = "get_keys()"
|
||||
PythonCommandGetPalette = "get_palette()"
|
||||
PythonCommandGetPixel = "get_pixel(x,y)"
|
||||
PythonCommandGetrandbits = "getrandbits(k)"
|
||||
@@ -95,6 +96,8 @@ PythonCommandImportFromScipy = "from ulab import scipy as spy"
|
||||
PythonCommandImportRandom = "import random"
|
||||
PythonCommandImportOs = "import os"
|
||||
PythonCommandImportFromOs = "from os import *"
|
||||
PythonCommandImportSys = "import sys"
|
||||
PythonCommandImportFromSys = "from sys import *"
|
||||
PythonCommandImportTime = "import time"
|
||||
PythonCommandImportTurtle = "import turtle"
|
||||
PythonCommandIndex = "list.index(x)"
|
||||
@@ -204,6 +207,9 @@ PythonCommandNumpyTranspose = "ndarray.transpose()"
|
||||
PythonCommandNumpyTransposeWithoutArg = ".transpose()"
|
||||
PythonCommandNumpySort = "ndarray.sort()"
|
||||
PythonCommandNumpySortWithoutArg = ".sort()"
|
||||
PythonCommandNumpyFromBuffer = "ndarray.frombuffer(b)"
|
||||
PythonCommandNumpyToBytes = "ndarray.tobytes()"
|
||||
PythonCommandNumpyToBytesWithoutArg = ".tobytes()"
|
||||
PythonCommandNumpySetPrintOptions = "np.set_printoptions()"
|
||||
PythonCommandNumpyGetPrintOptions = "np.get_printoptions()"
|
||||
PythonCommandNumpyNdinfo = "np.ndinfo(a)"
|
||||
@@ -369,6 +375,14 @@ PythonOsCommandRename = "rename(oldname, newname)"
|
||||
PythonOsCommandRemoveWithoutArg = "remove(\x11)"
|
||||
PythonOsCommandRenameWithoutArg = "rename(\x11,)"
|
||||
PythonOsCommandListdir = "listdir()"
|
||||
PythonSysCommandExit = "exit()"
|
||||
PythonSysCommandPrintexception = "print_exception(exc)"
|
||||
PythonSysCommandPrintexceptionWithoutArg = "print_exception(\x11)"
|
||||
PythonSysCommandByteorder = "byteorder"
|
||||
PythonSysCommandImplementation = "implementation"
|
||||
PythonSysCommandModules = "modules"
|
||||
PythonSysCommandVersion = "version"
|
||||
PythonSysCommandVersioninfo = "version_info"
|
||||
PythonTurtleCommandBackward = "backward(x)"
|
||||
PythonTurtleCommandCircle = "circle(r)"
|
||||
PythonTurtleCommandColor = "color('c')"
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <escher/palette.h>
|
||||
#include <ion/unicode/utf8_helper.h>
|
||||
#include <python/port/port.h>
|
||||
#include "../global_preferences.h"
|
||||
|
||||
extern "C" {
|
||||
#include "py/nlr.h"
|
||||
@@ -444,6 +445,11 @@ void PythonTextArea::addAutocompletion() {
|
||||
}
|
||||
|
||||
bool PythonTextArea::addAutocompletionTextAtIndex(int nextIndex, int * currentIndexToUpdate) {
|
||||
// If Autocomplete disable, skip this step
|
||||
if(!GlobalPreferences::sharedGlobalPreferences()->autocomplete()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// The variable box should be loaded at this point
|
||||
const char * autocompletionTokenBeginning = nullptr;
|
||||
const char * autocompletionLocation = const_cast<char *>(cursorLocation());
|
||||
|
||||
@@ -135,7 +135,9 @@ const ToolboxMessageTree MatplotlibPyplotModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandColorGray, I18n::Message::PythonColorGray, false)
|
||||
};
|
||||
|
||||
const ToolboxMessageTree NumpyNdarrayModuleChildren[] = {
|
||||
#if defined(INCLUDE_ULAB)
|
||||
|
||||
const ToolboxMessageTree NumpyNdarrayModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyArray),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyArange),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyConcatenate),
|
||||
@@ -147,15 +149,17 @@ const ToolboxMessageTree MatplotlibPyplotModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyFull),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyLinspace),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyLogspace),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyCopy),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyDtype),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyFlat),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyFlatten),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyShape),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyReshape),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpySize),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyTranspose),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpySort),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyFromBuffer),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyCopy, I18n::Message::Default, false, I18n::Message::PythonCommandNumpyCopyWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyDtype, I18n::Message::Default, false, I18n::Message::PythonCommandNumpyDtypeWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyFlat, I18n::Message::Default, false, I18n::Message::PythonCommandNumpyFlatWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyFlatten, I18n::Message::Default, false, I18n::Message::PythonCommandNumpyFlattenWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyShape, I18n::Message::Default, false, I18n::Message::PythonCommandNumpyShapeWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyReshape, I18n::Message::Default, false, I18n::Message::PythonCommandNumpyReshapeWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpySize, I18n::Message::Default, false, I18n::Message::PythonCommandNumpySizeWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyTranspose, I18n::Message::Default, false, I18n::Message::PythonCommandNumpyTransposeWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpySort, I18n::Message::Default, false, I18n::Message::PythonCommandNumpySortWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandNumpyToBytes, I18n::Message::Default, false, I18n::Message::PythonCommandNumpyToBytesWithoutArg)
|
||||
};
|
||||
|
||||
const ToolboxMessageTree NumpyFunctionsModuleChildren[] = {
|
||||
@@ -254,7 +258,6 @@ const ToolboxMessageTree NumpyModuleChildren[] = {
|
||||
ToolboxMessageTree::Node(I18n::Message::NumpyLinalgModule, NumpyLinalgModuleChildren)
|
||||
};
|
||||
|
||||
#if !defined(DEVICE_N0100)
|
||||
const ToolboxMessageTree ScipyLinalgModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandScipyLinalgFunction, I18n::Message::PythonScipyLinalgFunction, false, I18n::Message::PythonCommandScipyLinalgFunctionWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandScipyLinalgChoSolve),
|
||||
@@ -291,16 +294,14 @@ const ToolboxMessageTree ScipyModuleChildren[] = {
|
||||
ToolboxMessageTree::Node(I18n::Message::ScipySpecialModule, ScipySpecialModuleChildren),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
const ToolboxMessageTree UlabModuleChildren[] = {
|
||||
ToolboxMessageTree::Node(I18n::Message::NumpyModule, NumpyModuleChildren),
|
||||
#if !defined(DEVICE_N0100)
|
||||
ToolboxMessageTree::Node(I18n::Message::ScipyModule, ScipyModuleChildren),
|
||||
#endif
|
||||
ToolboxMessageTree::Leaf(I18n::Message::UlabDocumentation, I18n::Message::UlabDocumentationLink)
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
const ToolboxMessageTree TurtleModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportTurtle, I18n::Message::PythonImportTurtle, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromTurtle, I18n::Message::PythonImportTurtle, false),
|
||||
@@ -364,8 +365,8 @@ const ToolboxMessageTree KandinskyModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandFillRect, I18n::Message::PythonFillRect),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandFillCircle, I18n::Message::PythonFillCircle),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandFillPolygon, I18n::Message::PythonFillPolygon),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGetPalette, I18n::Message::PythonGetPalette)
|
||||
};
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGetKeys, I18n::Message::PythonGetKeys),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandGetPalette, I18n::Message::PythonGetPalette)};
|
||||
|
||||
const ToolboxMessageTree IonModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportIon, I18n::Message::PythonImportIon, false),
|
||||
@@ -402,16 +403,31 @@ const ToolboxMessageTree OsModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonOsCommandListdir, I18n::Message::PythonOsListdir, false)
|
||||
};
|
||||
|
||||
const ToolboxMessageTree SysModuleChildren[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportSys, I18n::Message::PythonImportSys, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonCommandImportFromSys, I18n::Message::PythonImportSys, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandExit, I18n::Message::PythonSysExit, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandPrintexception, I18n::Message::PythonSysPrintexception, false, I18n::Message::PythonSysCommandPrintexceptionWithoutArg),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandByteorder, I18n::Message::PythonSysByteorder, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandImplementation, I18n::Message::PythonSysImplementation, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandModules, I18n::Message::PythonSysModules, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandVersion, I18n::Message::PythonSysVersion, false),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::PythonSysCommandVersioninfo, I18n::Message::PythonSysVersioninfo, false)
|
||||
};
|
||||
|
||||
const ToolboxMessageTree modulesChildren[] = {
|
||||
ToolboxMessageTree::Node(I18n::Message::MathModule, MathModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::CmathModule, CMathModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::MatplotlibPyplotModule, MatplotlibPyplotModuleChildren),
|
||||
#if defined(INCLUDE_ULAB)
|
||||
ToolboxMessageTree::Node(I18n::Message::UlabModule, UlabModuleChildren),
|
||||
#endif
|
||||
ToolboxMessageTree::Node(I18n::Message::TurtleModule, TurtleModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::RandomModule, RandomModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::KandinskyModule, KandinskyModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::IonModule, IonModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::OsModule, OsModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::SysModule, SysModuleChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::TimeModule, TimeModuleChildren)
|
||||
};
|
||||
|
||||
@@ -678,9 +694,11 @@ KDCoordinate PythonToolbox::rowHeight(int j) {
|
||||
|
||||
bool PythonToolbox::selectLeaf(int selectedRow) {
|
||||
ToolboxMessageTree * node = (ToolboxMessageTree *)m_messageTreeModel->childAtIndex(selectedRow);
|
||||
#if defined(INCLUDE_ULAB)
|
||||
if(node->text() == I18n::Message::UlabDocumentationLink){
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
m_selectableTableView.deselectTable();
|
||||
if(node->insertedText() == I18n::Message::IonSelector){
|
||||
m_ionKeys.setSender(sender());
|
||||
|
||||
@@ -13,6 +13,7 @@ ScipySignalModule = "signal"
|
||||
ScipySpecialModule = "special"
|
||||
NumpyNdarray = "ndarray"
|
||||
OsModule = "os"
|
||||
SysModule = "sys"
|
||||
TimeModule = "time"
|
||||
TurtleModule = "turtle"
|
||||
UlabModule = "ulab"
|
||||
|
||||
@@ -43,9 +43,9 @@ public:
|
||||
|
||||
private:
|
||||
constexpr static size_t k_maxNumberOfDisplayedItems = (Ion::Display::Height - Metric::TitleBarHeight - Metric::PopUpTopMargin) / ScriptNodeCell::k_simpleItemHeight + 2; // +2 if the cells are cropped on top and at the bottom
|
||||
constexpr static size_t k_maxScriptNodesCount = 32; // Chosen without particular reasons
|
||||
constexpr static size_t k_maxScriptNodesCount = 64; // Chosen without particular reasons (Number of functions in the variables box)
|
||||
constexpr static int k_totalBuiltinNodesCount = 107;
|
||||
constexpr static uint8_t k_scriptOriginsCount = 3;
|
||||
constexpr static uint8_t k_scriptOriginsCount = 8; // Number of scripts loaded in the variable box
|
||||
constexpr static uint8_t k_subtitleCellType = NodeCellType; // We don't care as it is not selectable
|
||||
constexpr static uint8_t k_itemCellType = LeafCellType; // So that upper class NestedMenuController knows it's a leaf
|
||||
constexpr static KDCoordinate k_subtitleRowHeight = 23;
|
||||
|
||||
@@ -30,6 +30,8 @@ public:
|
||||
void setTempExamMode(ExamMode examMode);
|
||||
bool showPopUp() const { return m_showPopUp; }
|
||||
void setShowPopUp(bool showPopUp) { m_showPopUp = showPopUp; }
|
||||
bool autocomplete() const { return m_autoComplete; }
|
||||
void setAutocomplete(bool autocomple) { m_autoComplete = autocomple; }
|
||||
int brightnessLevel() const { return m_brightnessLevel; }
|
||||
void setBrightnessLevel(int brightnessLevel);
|
||||
const KDFont * font() const { return m_font; }
|
||||
@@ -44,6 +46,7 @@ private:
|
||||
m_examMode(ExamMode::Unknown),
|
||||
m_tempExamMode(ExamMode::Standard),
|
||||
m_showPopUp(true),
|
||||
m_autoComplete(true),
|
||||
m_brightnessLevel(Ion::Backlight::MaxBrightness),
|
||||
m_font(KDFont::LargeFont) {}
|
||||
I18n::Language m_language;
|
||||
@@ -53,6 +56,7 @@ private:
|
||||
mutable ExamMode m_examMode;
|
||||
mutable ExamMode m_tempExamMode;
|
||||
bool m_showPopUp;
|
||||
bool m_autoComplete;
|
||||
int m_brightnessLevel;
|
||||
const KDFont * m_font;
|
||||
};
|
||||
|
||||
@@ -711,6 +711,54 @@ const ToolboxMessageTree Electromagnetism[] = {
|
||||
|
||||
};
|
||||
|
||||
const ToolboxMessageTree Resistivity[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Silver, I18n::Message::Rstvt_Silver, false, I18n::Message::Rstvt_Silver),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Copper, I18n::Message::Rstvt_Copper, false, I18n::Message::Rstvt_Copper),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Gold, I18n::Message::Rstvt_Gold, false, I18n::Message::Rstvt_Gold),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Aluminium, I18n::Message::Rstvt_Aluminium, false, I18n::Message::Rstvt_Aluminium),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Calcium, I18n::Message::Rstvt_Calcium, false, I18n::Message::Rstvt_Calcium),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Tungsten, I18n::Message::Rstvt_Tungsten, false, I18n::Message::Rstvt_Tungsten),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Zinc, I18n::Message::Rstvt_Zinc, false, I18n::Message::Rstvt_Zinc),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Cobalt, I18n::Message::Rstvt_Cobalt, false, I18n::Message::Rstvt_Cobalt),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Nickel, I18n::Message::Rstvt_Nickel, false, I18n::Message::Rstvt_Nickel),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Lithium, I18n::Message::Rstvt_Lithium, false, I18n::Message::Rstvt_Lithium),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Iron, I18n::Message::Rstvt_Iron, false, I18n::Message::Rstvt_Iron),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Platinum, I18n::Message::Rstvt_Platinum, false, I18n::Message::Rstvt_Platinum),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Tin, I18n::Message::Rstvt_Tin, false, I18n::Message::Rstvt_Tin),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Sea_water, I18n::Message::Rstvt_Sea_water, false, I18n::Message::Rstvt_Sea_water),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Water, I18n::Message::Rstvt_Water, false, I18n::Message::Rstvt_Water),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Air, I18n::Message::Rstvt_Air, false, I18n::Message::Rstvt_Air),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Wood, I18n::Message::Rstvt_Wood, false, I18n::Message::Rstvt_Wood),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Glass, I18n::Message::Rstvt_Glass, false, I18n::Message::Rstvt_Glass)
|
||||
};
|
||||
|
||||
const ToolboxMessageTree Conductivity[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Silver, I18n::Message::Cndcvt_Silver, false, I18n::Message::Cndcvt_Silver),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Copper, I18n::Message::Cndcvt_Copper, false, I18n::Message::Cndcvt_Copper),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Gold, I18n::Message::Cndcvt_Gold, false, I18n::Message::Cndcvt_Gold),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Aluminium, I18n::Message::Cndcvt_Aluminium, false, I18n::Message::Cndcvt_Aluminium),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Calcium, I18n::Message::Cndcvt_Calcium, false, I18n::Message::Cndcvt_Calcium),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Tungsten, I18n::Message::Cndcvt_Tungsten, false, I18n::Message::Cndcvt_Tungsten),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Zinc, I18n::Message::Cndcvt_Zinc, false, I18n::Message::Cndcvt_Zinc),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Cobalt, I18n::Message::Cndcvt_Cobalt, false, I18n::Message::Cndcvt_Cobalt),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Nickel, I18n::Message::Cndcvt_Nickel, false, I18n::Message::Cndcvt_Nickel),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Lithium, I18n::Message::Cndcvt_Lithium, false, I18n::Message::Cndcvt_Lithium),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Iron, I18n::Message::Cndcvt_Iron, false, I18n::Message::Cndcvt_Iron),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Platinum, I18n::Message::Cndcvt_Platinum, false, I18n::Message::Cndcvt_Platinum),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Tin, I18n::Message::Cndcvt_Tin, false, I18n::Message::Cndcvt_Tin),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Sea_water, I18n::Message::Cndcvt_Sea_water, false, I18n::Message::Cndcvt_Sea_water),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Water, I18n::Message::Cndcvt_Water, false, I18n::Message::Cndcvt_Water),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Air, I18n::Message::Cndcvt_Air, false, I18n::Message::Cndcvt_Air),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Wood, I18n::Message::Cndcvt_Wood, false, I18n::Message::Cndcvt_Wood),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::Glass, I18n::Message::Cndcvt_Glass, false, I18n::Message::Cndcvt_Glass)
|
||||
};
|
||||
|
||||
const ToolboxMessageTree Electricity[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::ElementalChargeTag, I18n::Message::ElementalCharge, false, I18n::Message::ElementalCharge),
|
||||
ToolboxMessageTree::Node(I18n::Message::ResistivityConstants, Resistivity),
|
||||
ToolboxMessageTree::Node(I18n::Message::ConductivityConstants, Conductivity)
|
||||
};
|
||||
|
||||
const ToolboxMessageTree ParticleMass[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::ElectronMassTag, I18n::Message::ElectronMass, false, I18n::Message::ElectronMass),
|
||||
ToolboxMessageTree::Leaf(I18n::Message::MuonMassTag, I18n::Message::MuonMass, false, I18n::Message::MuonMass),
|
||||
@@ -788,6 +836,7 @@ const ToolboxMessageTree PlanckUnits[] = {
|
||||
const ToolboxMessageTree Physics[] = {
|
||||
ToolboxMessageTree::Node(I18n::Message::FundamentalConstants, FundamentalConstants),
|
||||
ToolboxMessageTree::Node(I18n::Message::Electromagnetism, Electromagnetism),
|
||||
ToolboxMessageTree::Node(I18n::Message::Electricity, Electricity),
|
||||
ToolboxMessageTree::Node(I18n::Message::NuclearConstants, Nuclear),
|
||||
ToolboxMessageTree::Node(I18n::Message::Thermodynamics, Thermodynamics),
|
||||
ToolboxMessageTree::Node(I18n::Message::Gravitation, Gravitation),
|
||||
@@ -805,15 +854,15 @@ const ToolboxMessageTree menu[] = {
|
||||
ToolboxMessageTree::Leaf(I18n::Message::LogCommandWithArg, I18n::Message::BasedLogarithm),
|
||||
ToolboxMessageTree::Node(I18n::Message::Calculation, calculChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::ComplexNumber, complexChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::Combinatorics, combinatoricsChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::Probability, probabilityChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::Unit, unitChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::Arithmetic, arithmeticChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::Matrices, matricesChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::Probability, probabilityChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::Vectors, vectorsChildren),
|
||||
#if LIST_ARE_DEFINED
|
||||
ToolboxMessageTree::Node(I18n::Message::Lists,listsChildren),
|
||||
#endif
|
||||
ToolboxMessageTree::Node(I18n::Message::Unit, unitChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::Combinatorics, combinatoricsChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::RandomAndApproximation, randomAndApproximationChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::HyperbolicTrigonometry, trigonometryChildren),
|
||||
ToolboxMessageTree::Node(I18n::Message::Fluctuation, predictionChildren),
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
apps += Reader::App
|
||||
app_headers += apps/reader/app.h
|
||||
|
||||
SFLAGS += -DHAS_READER
|
||||
|
||||
app_sreader_src = $(addprefix apps/reader/,\
|
||||
app.cpp \
|
||||
list_book_controller.cpp \
|
||||
utility.cpp \
|
||||
read_book_controller \
|
||||
word_wrap_view.cpp \
|
||||
tex_parser.cpp \
|
||||
)
|
||||
|
||||
apps_src += $(app_sreader_src)
|
||||
|
||||
29
apps/reader/README.md
Normal file
29
apps/reader/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Thanks
|
||||
Thanks to [Gabriel79](https://github.com/Gabriel79) for the original reader app, his source code available [here](https://github.com/Gabriel79/OmegaWithReaderTutorial) and the [tutorial](https://www.codingame.com/playgrounds/55846/reader-faire-une-application-pour-omega-sur-numworks/introduction) to code it !
|
||||
|
||||
---
|
||||
|
||||
# Rich text format
|
||||
Reader app supports now a rich text format :
|
||||
|
||||
* `$` around a LaTeX expression to render it
|
||||
* `%` around a color-code (see below) to change the color of the text
|
||||
### LaTeX expressions
|
||||
You can read the documentation for the LaTeX Parser [here](TexParser.md).
|
||||
### Color codes :
|
||||
|code|color|
|
||||
| --:| ---:|
|
||||
|`%\last_color%`|Stop using last color|
|
||||
|`%r%`|Red|
|
||||
|`%rl%`|Light red|
|
||||
|`%m%`|Magenta|
|
||||
|`%t%`|Turquoise|
|
||||
|`%pk%`|Pink|
|
||||
|`%pp%`|Purple|
|
||||
|`%b%`|Blue|
|
||||
|`%bl%`|Light blue|
|
||||
|`%br%`|Brown|
|
||||
|`%o%`|Orange|
|
||||
|`%g%`|Green|
|
||||
|`%gl%`|Light green|
|
||||
|`%c%`|Cyan|
|
||||
1901
apps/reader/TexParser.html
Normal file
1901
apps/reader/TexParser.html
Normal file
File diff suppressed because it is too large
Load Diff
51
apps/reader/TexParser.md
Normal file
51
apps/reader/TexParser.md
Normal file
@@ -0,0 +1,51 @@
|
||||
# LaTeX Parser
|
||||
|
||||
In the reader app, you can read a txt file. You can also read a txt file with LaTeX expression inside of it.
|
||||
|
||||
All the symbols you can use are listed here :
|
||||
|
||||
|Command|Output||Command|Output|
|
||||
|--:|:--:|--:|--:|:--:|
|
||||
|Math|Expressions||||
|
||||
|`\frac{ab}{cd}`|$\frac{ab}{cd}$||`\sqrt[n]{x}`|$\sqrt[n]{x}$|
|
||||
|Math|Symbols|||
|
||||
|`\times`|$\times$||`\div`|$\div$|
|
||||
|`\forall`|$\forall$||`\exists`|$\exists$|
|
||||
|`\partial`|$\partial$||`\pm`|$\pm$|
|
||||
|`\infty`|$\infty$||`\approx`|$\approx$|
|
||||
|`\neq`|$\neq$||`\equiv`|$\equiv$|
|
||||
|`\leq`|$\leq$||`\geq`|$\geq$|
|
||||
|Simple|Arrows||Double|Arrows|
|
||||
|`\leftarrow`|$\leftarrow$||`\Leftarrow`|$\Leftarrow$|
|
||||
|`\rightarrow`|$\rightarrow$||`\Rightarrow`|$\Rightarrow$|
|
||||
|`\uparrow`|$\uparrow$||`\Uparrow`|$\Uparrow$|
|
||||
|`\downarrow`|$\downarrow$||`\Downarrow`|$\Downarrow$|
|
||||
|`\leftrightarrow`|$\leftrightarrow$||||
|
||||
|`\updownarrow`|$\updownarrow$||||
|
||||
|Greek Capital|Letters||Greek Small|Letters|
|
||||
|`\Alpha`|$\Alpha$||`\alpha`|$\alpha$|
|
||||
|`\Beta`|$\Beta$||`\beta`|$\beta$|
|
||||
|`\Gamma`|$\Gamma$||`\gamma`|$\gamma$|
|
||||
|`\Delta`|$\Delta$||`\delta`|$\delta$|
|
||||
|`\Epsilon`|$\Epsilon$||`\epsilon`|$\epsilon$|
|
||||
|`\Zeta`|$\Zeta$||`\zeta`|$\zeta$|
|
||||
|`\Eta`|$\Eta$||`\eta`|$\eta$|
|
||||
|`\Theta`|$\Theta$||`\theta`|$\theta$|
|
||||
|`\Iota`|$\Iota$||`\iota`|$\iota$|
|
||||
|`\Kappa`|$\Kappa$||`\kappa`|$\kappa$|
|
||||
|`\Lambda`|$\Lambda$||`\lambda`|$\lambda$|
|
||||
|`\Mu`|$\Mu$||`\mu`|$\mu$|
|
||||
|`\Nu`|$\Nu$||`\nu`|$\nu$|
|
||||
|`\Xi`|$\Xi$||`\xi`|$\xi$|
|
||||
|`\Omicron`|$\Omicron$|||
|
||||
|`\Pi`|$\Pi$||`\pi`|$\pi$|
|
||||
|`\Rho`|$\Rho$||`\rho`|$\rho$|
|
||||
|`\Sigma`|$\Sigma$||`\sigma`|$\sigma$|
|
||||
|`\Tau`|$\Tau$||`\tau`|$\tau$|
|
||||
|`\Upsilon`|$\Upsilon$||`\upsilon`|$\upsilon$|
|
||||
|`\Phi`|$\Phi$||`\phi`|$\phi$|
|
||||
|`\Chi`|$\Chi$||`\chi`|$\chi$|
|
||||
|`\Psi`|$\Psi$||`\psi`|$\psi$|
|
||||
|`\Omega`|$\Omega$||`\omega`|$\omega$|
|
||||
|
||||
|
||||
@@ -27,19 +27,21 @@ bool ReadBookController::handleEvent(Ion::Events::Event event) {
|
||||
m_readerView.previousPage();
|
||||
return true;
|
||||
}
|
||||
if(event == Ion::Events::Back || event == Ion::Events::Home) {
|
||||
savePosition();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ReadBookController::viewDidDisappear() {
|
||||
savePosition();
|
||||
}
|
||||
|
||||
void ReadBookController::savePosition() const {
|
||||
int pageOffset = m_readerView.getPageOffset();
|
||||
Ion::Storage::Record::ErrorStatus status = Ion::Storage::sharedStorage()->createRecordWithFullName(m_file->name, &pageOffset, sizeof(pageOffset));
|
||||
BookSave save = m_readerView.getBookSave();
|
||||
|
||||
Ion::Storage::Record::ErrorStatus status = Ion::Storage::sharedStorage()->createRecordWithFullName(m_file->name, &save, sizeof(save));
|
||||
if(Ion::Storage::Record::ErrorStatus::NameTaken == status) {
|
||||
Ion::Storage::Record::Data data;
|
||||
data.buffer = &pageOffset;
|
||||
data.size = sizeof(pageOffset);
|
||||
data.buffer = &save;
|
||||
data.size = sizeof(save);
|
||||
status = Ion::Storage::sharedStorage()->recordNamed(m_file->name).setValue(data);
|
||||
}
|
||||
}
|
||||
@@ -47,11 +49,14 @@ void ReadBookController::savePosition() const {
|
||||
void ReadBookController::loadPosition() {
|
||||
Ion::Storage::Record r = Ion::Storage::sharedStorage()->recordNamed(m_file->name);
|
||||
if(Ion::Storage::sharedStorage()->hasRecord(r)) {
|
||||
int pageOffset = *(static_cast<const int*>(r.value().buffer));
|
||||
m_readerView.setPageOffset(pageOffset);
|
||||
BookSave save = *(static_cast<const BookSave*>(r.value().buffer));
|
||||
m_readerView.setBookSave(save);
|
||||
}
|
||||
else {
|
||||
m_readerView.setPageOffset(0);
|
||||
m_readerView.setBookSave({
|
||||
0,
|
||||
Palette::PrimaryText
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,10 +11,9 @@ class ReadBookController : public ViewController {
|
||||
public:
|
||||
ReadBookController(Responder * parentResponder);
|
||||
View * view() override;
|
||||
|
||||
void setBook(const External::Archive::File& file);
|
||||
bool handleEvent(Ion::Events::Event event) override;
|
||||
|
||||
void viewDidDisappear() override;
|
||||
void savePosition() const;
|
||||
void loadPosition();
|
||||
private:
|
||||
|
||||
210
apps/reader/tex_parser.cpp
Normal file
210
apps/reader/tex_parser.cpp
Normal file
@@ -0,0 +1,210 @@
|
||||
#include "tex_parser.h"
|
||||
#include <ion/unicode/utf8_decoder.h>
|
||||
|
||||
namespace Reader {
|
||||
|
||||
// List of available Symbols
|
||||
static constexpr char const * k_SymbolsCommands[] = {
|
||||
"times", "div", "forall", "partial", "exists", "pm", "approx", "infty", "neq", "equiv", "leq", "geq",
|
||||
"leftarrow", "uparrow", "rightarrow", "downarrow", "leftrightarrow", "updownarrow", "Leftarrow", "Uparrow", "Rightarrow", "Downarrow",
|
||||
"Alpha", "Beta", "Gamma", "Delta", "Epsilon", "Zeta", "Eta", "Theta", "Iota", "Kappa", "Lambda",
|
||||
"Mu", "Nu", "Xi", "Omicron", "Pi", "Rho", "Sigma", "Tau", "Upsilon", "Phi", "Chi", "Psi","Omega",
|
||||
"alpha", "beta", "gamma", "delta", "epsilon", "zeta", "eta", "theta", "iota", "kappa", "lambda",
|
||||
"mu", "nu", "xi", "omicron", "pi", "rho", "sigma", "tau", "upsilon", "phi", "chi", "psi", "omega",
|
||||
};
|
||||
|
||||
//List of the available Symbol's CodePoints in the same order of the Symbol's list
|
||||
static constexpr uint32_t const k_SymbolsCodePoints[] = {
|
||||
0xd7, 0xf7, 0x2200, 0x2202, 0x2203, 0xb1, 0x2248, 0x221e, 0x2260, 0x2261, 0x2264, 0x2265,
|
||||
0x2190, 0x2191, 0x2192, 0x2193, 0x2194, 0x2195, 0x21d0, 0x21d1, 0x21d2, 0x21d3,
|
||||
0x391, 0x392, 0x393, 0x394, 0x395, 0x396, 0x397, 0x398, 0x399, 0x39a, 0x39b,
|
||||
0x39c, 0x39d, 0x39e, 0x39f, 0x3a0, 0x3a1, 0x3a3, 0x3a4, 0x3a5, 0x3a6, 0x3a7, 0x3a8, 0x3a9,
|
||||
0x3b1, 0x3b2, 0x3b3, 0x3b4, 0x3b5, 0x3b6, 0x3b7, 0x3b8, 0x3b9, 0x3ba, 0x3bb,
|
||||
0x3bc, 0x3bd, 0x3be, 0x3bf, 0x3c0, 0x3c1, 0x3c3, 0x3c4, 0x3c5, 0x3c6, 0x3c7, 0x3c8, 0x3c9
|
||||
};
|
||||
|
||||
// List of available Function Commands that don't require a specific handling
|
||||
static constexpr char const * k_FunctionCommands[] = {
|
||||
"arcos", "arcsin", "arctan", "arg", "cos", "cosh", "cot", "coth",
|
||||
"csc", "deg", "det", "dim", "exp", "gcd", "hom", "inf",
|
||||
"ker", "lg", "lim", "liminf", "limsup", "ln", "log", "max",
|
||||
"min", "Pr", "sec", "sin", "sinh", "sup", "tan", "tanh"
|
||||
};
|
||||
|
||||
TexParser::TexParser(const char * text, const char * endOfText) :
|
||||
m_text(text),
|
||||
m_endOfText(endOfText),
|
||||
m_hasError(false)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Layout TexParser::getLayout() {
|
||||
Layout layout = popText(0);
|
||||
|
||||
if (m_hasError) {
|
||||
return CodePointLayout::Builder(CodePoint(0xfffd));
|
||||
}
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
Layout TexParser::popBlock() {
|
||||
while (*m_text == ' ') {
|
||||
m_text ++;
|
||||
}
|
||||
|
||||
if (*m_text == '{') {
|
||||
m_text ++;
|
||||
return popText('}');
|
||||
}
|
||||
|
||||
if (*m_text == '\\') {
|
||||
m_text ++;
|
||||
return popCommand();
|
||||
}
|
||||
|
||||
if (m_text >= m_endOfText) {
|
||||
m_hasError = true;
|
||||
}
|
||||
|
||||
UTF8Decoder decoder(m_text);
|
||||
m_text ++;
|
||||
return CodePointLayout::Builder(decoder.nextCodePoint());
|
||||
}
|
||||
|
||||
Layout TexParser::popText(char stop) {
|
||||
HorizontalLayout layout = HorizontalLayout::Builder();
|
||||
const char * start = m_text;
|
||||
|
||||
while (m_text < m_endOfText && *m_text != stop) {
|
||||
switch (*m_text) {
|
||||
// TODO: Factorize this code
|
||||
case '\\':
|
||||
if (start != m_text) {
|
||||
layout.addOrMergeChildAtIndex(LayoutHelper::String(start, m_text - start), layout.numberOfChildren(), false);
|
||||
}
|
||||
m_text ++;
|
||||
layout.addOrMergeChildAtIndex(popCommand(), layout.numberOfChildren(), false);
|
||||
start = m_text;
|
||||
break;
|
||||
case ' ':
|
||||
if (start != m_text) {
|
||||
layout.addOrMergeChildAtIndex(LayoutHelper::String(start, m_text - start), layout.numberOfChildren(), false);
|
||||
}
|
||||
m_text ++;
|
||||
start = m_text;
|
||||
break;
|
||||
case '^':
|
||||
if (start != m_text) {
|
||||
layout.addOrMergeChildAtIndex(LayoutHelper::String(start, m_text - start), layout.numberOfChildren(), false);
|
||||
}
|
||||
m_text ++;
|
||||
layout.addOrMergeChildAtIndex(VerticalOffsetLayout::Builder(popBlock(), VerticalOffsetLayoutNode::Position::Superscript), layout.numberOfChildren(), false);
|
||||
start = m_text;
|
||||
break;
|
||||
case '_':
|
||||
if (start != m_text) {
|
||||
layout.addOrMergeChildAtIndex(LayoutHelper::String(start, m_text - start), layout.numberOfChildren(), false);
|
||||
}
|
||||
m_text ++;
|
||||
layout.addOrMergeChildAtIndex(VerticalOffsetLayout::Builder(popBlock(), VerticalOffsetLayoutNode::Position::Subscript), layout.numberOfChildren(), false);
|
||||
start = m_text;
|
||||
break;
|
||||
default:
|
||||
m_text ++;
|
||||
}
|
||||
}
|
||||
|
||||
if (start != m_text) {
|
||||
layout.addOrMergeChildAtIndex(LayoutHelper::String(start, m_text - start), layout.numberOfChildren(), false);
|
||||
}
|
||||
|
||||
m_text ++;
|
||||
|
||||
if (layout.numberOfChildren() == 1) {
|
||||
return layout.squashUnaryHierarchyInPlace();
|
||||
}
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
Layout TexParser::popCommand() {
|
||||
// TODO: Factorize this code
|
||||
if (strncmp(k_fracCommand, m_text, strlen(k_fracCommand)) == 0) {
|
||||
if (isCommandEnded(*(m_text + strlen(k_fracCommand)))) {
|
||||
m_text += strlen(k_fracCommand);
|
||||
return popFracCommand();
|
||||
}
|
||||
}
|
||||
if (strncmp(k_sqrtCommand, m_text, strlen(k_sqrtCommand)) == 0) {
|
||||
if (isCommandEnded(*(m_text + strlen(k_sqrtCommand)))) {
|
||||
m_text += strlen(k_sqrtCommand);
|
||||
return popSqrtCommand();
|
||||
}
|
||||
}
|
||||
if (strncmp(k_overrightArrowCommand, m_text, strlen(k_overrightArrowCommand)) == 0) {
|
||||
if (isCommandEnded(*(m_text + strlen(k_overrightArrowCommand)))) {
|
||||
m_text += strlen(k_overrightArrowCommand);
|
||||
return popOverrightarrowCommand();
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < k_NumberOfSymbols; i++) {
|
||||
if (strncmp(k_SymbolsCommands[i], m_text, strlen(k_SymbolsCommands[i])) == 0) {
|
||||
if (isCommandEnded(*(m_text + strlen(k_SymbolsCommands[i])))) {
|
||||
m_text += strlen(k_SymbolsCommands[i]);
|
||||
return popSymbolCommand(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < k_NumberOfFunctionCommands; i++) {
|
||||
if (strncmp(k_FunctionCommands[i], m_text, strlen(k_FunctionCommands[i])) == 0) {
|
||||
if (isCommandEnded(*(m_text + strlen(k_FunctionCommands[i])))) {
|
||||
m_text += strlen(k_FunctionCommands[i]);
|
||||
return LayoutHelper::String(k_FunctionCommands[i], strlen(k_FunctionCommands[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_hasError = true;
|
||||
return LayoutHelper::String(m_text, strlen(m_text));
|
||||
}
|
||||
|
||||
// Expressions
|
||||
Layout TexParser::popFracCommand() {
|
||||
Layout numerator = popBlock();
|
||||
Layout denominator = popBlock();
|
||||
FractionLayout l = FractionLayout::Builder(numerator, denominator);
|
||||
return l;
|
||||
}
|
||||
|
||||
Layout TexParser::popSqrtCommand() {
|
||||
while (*m_text == ' ') {
|
||||
m_text ++;
|
||||
}
|
||||
if (*m_text == '[') {
|
||||
m_text ++;
|
||||
Layout rootFactor = popText(']');
|
||||
Layout belowRoot = popBlock();
|
||||
return NthRootLayout::Builder(belowRoot, rootFactor);
|
||||
}
|
||||
else {
|
||||
return NthRootLayout::Builder(popBlock());
|
||||
}
|
||||
}
|
||||
|
||||
Layout TexParser::popOverrightarrowCommand() {
|
||||
return VectorLayout::Builder(popBlock());
|
||||
}
|
||||
|
||||
Layout TexParser::popSymbolCommand(int SymbolIndex) {
|
||||
uint32_t codePoint = k_SymbolsCodePoints[SymbolIndex];
|
||||
return CodePointLayout::Builder(codePoint);
|
||||
}
|
||||
|
||||
inline bool TexParser::isCommandEnded(char c) const {
|
||||
return !(c >= 'a' && c <= 'z') && !(c >= 'A' && c <= 'Z');
|
||||
}
|
||||
}
|
||||
47
apps/reader/tex_parser.h
Normal file
47
apps/reader/tex_parser.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef __TEX_PARSER_H__
|
||||
#define __TEX_PARSER_H__
|
||||
|
||||
#include <poincare_layouts.h>
|
||||
#include <poincare/layout_helper.h>
|
||||
#include <string.h>
|
||||
|
||||
using namespace Poincare;
|
||||
|
||||
namespace Reader
|
||||
{
|
||||
/// @brief Class used in the WordWrapTextView class to parse a Tex expression
|
||||
class TexParser {
|
||||
public:
|
||||
TexParser(const char * text, const char * endOfText);
|
||||
Layout getLayout();
|
||||
private:
|
||||
Layout popBlock();
|
||||
Layout popText(char stop);
|
||||
Layout popCommand();
|
||||
|
||||
// Expressions
|
||||
Layout popFracCommand();
|
||||
Layout popSqrtCommand();
|
||||
Layout popOverrightarrowCommand();
|
||||
|
||||
//Symbols
|
||||
Layout popSymbolCommand(int SymbolIndex);
|
||||
|
||||
const char * m_text;
|
||||
const char * m_endOfText;
|
||||
bool m_hasError;
|
||||
|
||||
inline bool isCommandEnded(char c) const;
|
||||
|
||||
// Expressions that require specific handling
|
||||
static constexpr char const * k_fracCommand = "frac";
|
||||
static constexpr char const * k_sqrtCommand = "sqrt";
|
||||
static constexpr char const * k_overrightArrowCommand = "overrightarrow";
|
||||
|
||||
static constexpr int const k_NumberOfSymbols = 70;
|
||||
static constexpr int const k_NumberOfFunctionCommands = 32;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -110,4 +110,38 @@ int filesWithExtension(const char* extension, External::Archive::File* files, in
|
||||
}
|
||||
#endif
|
||||
|
||||
const char * EndOfPrintableWord(const char * word, const char * end) {
|
||||
if (word == end) {
|
||||
return word;
|
||||
}
|
||||
UTF8Decoder decoder(word);
|
||||
CodePoint codePoint = decoder.nextCodePoint();
|
||||
const char * result = word;
|
||||
while (codePoint != '\n' && codePoint != ' ' && codePoint != '%' && codePoint != '$') {
|
||||
result = decoder.stringPosition();
|
||||
if (result >= end) {
|
||||
break;
|
||||
}
|
||||
codePoint = decoder.nextCodePoint();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
const char * StartOfPrintableWord(const char * word, const char * start) {
|
||||
if (word == start) {
|
||||
return word;
|
||||
}
|
||||
UTF8Decoder decoder(start, word);
|
||||
CodePoint codePoint = decoder.previousCodePoint();
|
||||
const char * result = word;
|
||||
while (codePoint != '\n' && codePoint != ' ' && codePoint != '%' && codePoint != '$') {
|
||||
result = decoder.stringPosition();
|
||||
if (result >= start) {
|
||||
break;
|
||||
}
|
||||
codePoint = decoder.previousCodePoint();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
#define __UTILITY_H__
|
||||
|
||||
#include <apps/external/archive.h>
|
||||
#include <ion/unicode/code_point.h>
|
||||
#include <ion/unicode/utf8_decoder.h>
|
||||
|
||||
namespace Reader
|
||||
{
|
||||
@@ -9,6 +11,8 @@ namespace Reader
|
||||
bool stringEndsWith(const char* str, const char* end);
|
||||
int filesWithExtension(const char* extension, External::Archive::File* files, int filesSize);
|
||||
void stringNCopy(char* dest, int max, const char* src, int len);
|
||||
|
||||
const char * EndOfPrintableWord(const char * word, const char * end);
|
||||
const char * StartOfPrintableWord(const char * word, const char * start);
|
||||
|
||||
}
|
||||
#endif
|
||||
@@ -1,10 +1,23 @@
|
||||
|
||||
#include "word_wrap_view.h"
|
||||
#include "utility.h"
|
||||
#include "tex_parser.h"
|
||||
#include <poincare/expression.h>
|
||||
#include "../shared/poincare_helpers.h"
|
||||
#include <poincare/undefined.h>
|
||||
|
||||
namespace Reader
|
||||
{
|
||||
|
||||
WordWrapTextView::WordWrapTextView() :
|
||||
PointerTextView(GlobalPreferences::sharedGlobalPreferences()->font()),
|
||||
m_pageOffset(0),
|
||||
m_nextPageOffset(0),
|
||||
m_length(0)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void WordWrapTextView::nextPage() {
|
||||
if(m_nextPageOffset >= m_length) {
|
||||
return;
|
||||
@@ -26,15 +39,47 @@ void WordWrapTextView::previousPage() {
|
||||
const int charWidth = m_font->glyphSize().width();
|
||||
const int charHeight = m_font->glyphSize().height();
|
||||
|
||||
const char * endOfWord = text() + m_pageOffset - 1;
|
||||
const char * startOfWord = UTF8Helper::BeginningOfWord(text(), endOfWord);
|
||||
const char * endOfFile = text() + m_length;
|
||||
const char * endOfWord = text() + m_pageOffset;
|
||||
const char * startOfWord = StartOfPrintableWord(endOfWord, text());
|
||||
|
||||
KDSize textSize = KDSizeZero;
|
||||
|
||||
KDPoint textEndPosition(m_frame.width() - k_margin, m_frame.height() - k_margin);
|
||||
|
||||
while(startOfWord>=text()) {
|
||||
startOfWord = UTF8Helper::BeginningOfWord(text(), endOfWord);
|
||||
endOfWord = UTF8Helper::EndOfWord(startOfWord);
|
||||
KDSize textSize = m_font->stringSizeUntil(startOfWord, endOfWord);
|
||||
startOfWord = StartOfPrintableWord(endOfWord-1, text());
|
||||
//endOfWord = EndOfPrintableWord(startOfWord, endOfFile);
|
||||
|
||||
if (*startOfWord == '%') {
|
||||
if (updateTextColorBackward(startOfWord)) {
|
||||
endOfWord = startOfWord - 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (*endOfWord == '$') {
|
||||
startOfWord = endOfWord - 1;
|
||||
while (*startOfWord != '$') {
|
||||
if (startOfWord < text()) {
|
||||
break; // File isn't rightly formated
|
||||
}
|
||||
startOfWord --;
|
||||
}
|
||||
startOfWord --;
|
||||
|
||||
TexParser parser = TexParser(startOfWord + 1, endOfWord - 2);
|
||||
Poincare::Layout layout = parser.getLayout();
|
||||
textSize = layout.layoutSize();
|
||||
}
|
||||
else {
|
||||
if (*startOfWord == '\\' || *(startOfWord + 1) == '$') {
|
||||
textSize = m_font->stringSizeUntil(startOfWord + 1, endOfWord);
|
||||
}
|
||||
else {
|
||||
textSize = m_font->stringSizeUntil(startOfWord, endOfWord);
|
||||
}
|
||||
}
|
||||
KDPoint textStartPosition = KDPoint(textEndPosition.x()-textSize.width(), textEndPosition.y());
|
||||
|
||||
if(textStartPosition.x() < k_margin) {
|
||||
@@ -74,7 +119,7 @@ void WordWrapTextView::previousPage() {
|
||||
m_pageOffset = 0;
|
||||
}
|
||||
else {
|
||||
m_pageOffset = UTF8Helper::EndOfWord(startOfWord) - text() + 1;
|
||||
m_pageOffset = EndOfPrintableWord(startOfWord, endOfFile) - text() + 1;
|
||||
}
|
||||
markRectAsDirty(bounds());
|
||||
}
|
||||
@@ -84,37 +129,98 @@ void WordWrapTextView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
|
||||
const char * endOfFile = text() + m_length;
|
||||
const char * startOfWord = text() + m_pageOffset;
|
||||
const char * endOfWord = UTF8Helper::EndOfWord(startOfWord);
|
||||
const char * endOfWord;
|
||||
|
||||
if (*startOfWord != '$') {
|
||||
endOfWord = EndOfPrintableWord(startOfWord, endOfFile);
|
||||
} // Else we don't need to update endOfWord
|
||||
|
||||
KDPoint textPosition(k_margin, k_margin);
|
||||
|
||||
const int wordMaxLength = 128;
|
||||
char word[wordMaxLength];
|
||||
|
||||
Poincare::Layout layout;
|
||||
|
||||
enum class ToDraw {
|
||||
Text,
|
||||
Expression,
|
||||
Nothing
|
||||
};
|
||||
|
||||
ToDraw toDraw = ToDraw::Text;
|
||||
|
||||
const int charWidth = m_font->glyphSize().width();
|
||||
const int charHeight = m_font->glyphSize().height();
|
||||
|
||||
int nextLineOffset = charHeight;
|
||||
|
||||
KDSize textSize = KDSizeZero;
|
||||
|
||||
|
||||
while(startOfWord < endOfFile) {
|
||||
KDSize textSize = m_font->stringSizeUntil(startOfWord, endOfWord);
|
||||
|
||||
if (*startOfWord == '%') { // Look for color keyword (ex '%bl%')
|
||||
if (updateTextColorForward(startOfWord)) {
|
||||
startOfWord = endOfWord + 1;
|
||||
endOfWord = EndOfPrintableWord(startOfWord, endOfFile);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (*startOfWord == '$') { // Look for expression
|
||||
endOfWord = startOfWord + 1;
|
||||
while (*endOfWord != '$') {
|
||||
if (endOfWord > endOfFile) {
|
||||
break; // If we are here, it's bad...
|
||||
}
|
||||
endOfWord ++;
|
||||
}
|
||||
endOfWord ++;
|
||||
|
||||
TexParser parser = TexParser(startOfWord + 1, endOfWord - 1);
|
||||
layout = parser.getLayout();
|
||||
textSize = layout.layoutSize();
|
||||
toDraw = ToDraw::Expression;
|
||||
}
|
||||
else {
|
||||
if (*startOfWord == '\\' || *(startOfWord + 1) == '$') {
|
||||
startOfWord ++;
|
||||
}
|
||||
textSize = m_font->stringSizeUntil(startOfWord, endOfWord);
|
||||
stringNCopy(word, wordMaxLength, startOfWord, endOfWord-startOfWord);
|
||||
toDraw = ToDraw::Text;
|
||||
}
|
||||
|
||||
KDPoint nextTextPosition = KDPoint(textPosition.x()+textSize.width(), textPosition.y());
|
||||
|
||||
if(nextTextPosition.x() > m_frame.width() - k_margin) { // Right overflow
|
||||
textPosition = KDPoint(k_margin, textPosition.y() + textSize.height());
|
||||
textPosition = KDPoint(k_margin, textPosition.y() + nextLineOffset);
|
||||
nextTextPosition = KDPoint(k_margin + textSize.width(), textPosition.y());
|
||||
nextLineOffset = charHeight;
|
||||
}
|
||||
if (nextLineOffset < textSize.height()) {
|
||||
nextLineOffset = textSize.height();
|
||||
}
|
||||
|
||||
if(textPosition.y() + textSize.height() > m_frame.height() - k_margin) { // Bottom overflow
|
||||
break;
|
||||
}
|
||||
|
||||
stringNCopy(word, wordMaxLength, startOfWord, endOfWord-startOfWord);
|
||||
ctx->drawString(word, textPosition, m_font, m_textColor, m_backgroundColor);
|
||||
if (toDraw == ToDraw::Expression) {
|
||||
layout.draw(ctx, textPosition, m_textColor);
|
||||
}
|
||||
else if (toDraw == ToDraw::Text) {
|
||||
ctx->drawString(word, textPosition, m_font, m_textColor, m_backgroundColor);
|
||||
}
|
||||
|
||||
while(*endOfWord == ' ' || *endOfWord == '\n') {
|
||||
if(*endOfWord == ' ') {
|
||||
nextTextPosition = KDPoint(nextTextPosition.x() + charWidth, nextTextPosition.y());
|
||||
}
|
||||
else {
|
||||
nextTextPosition = KDPoint(k_margin, nextTextPosition.y() + charHeight);
|
||||
nextTextPosition = KDPoint(k_margin, nextTextPosition.y() + nextLineOffset);
|
||||
nextLineOffset = charHeight;
|
||||
}
|
||||
++endOfWord;
|
||||
}
|
||||
@@ -123,6 +229,10 @@ void WordWrapTextView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
//two times the same word if the break below is used
|
||||
startOfWord = endOfWord;
|
||||
|
||||
if (endOfWord >= endOfFile) {
|
||||
break;
|
||||
}
|
||||
|
||||
if(nextTextPosition.y() + textSize.height() > m_frame.height() - k_margin) { // If out of page, quit
|
||||
break;
|
||||
}
|
||||
@@ -130,22 +240,184 @@ void WordWrapTextView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
nextTextPosition = KDPoint(k_margin, nextTextPosition.y());
|
||||
}
|
||||
if(nextTextPosition.x() > m_frame.width() - k_margin) { // Go to line if right overflow
|
||||
nextTextPosition = KDPoint(k_margin, nextTextPosition.y() + textSize.height());
|
||||
nextTextPosition = KDPoint(k_margin, nextTextPosition.y() + nextLineOffset);
|
||||
nextLineOffset = charHeight;
|
||||
}
|
||||
|
||||
textPosition = nextTextPosition;
|
||||
endOfWord = UTF8Helper::EndOfWord(startOfWord);
|
||||
|
||||
if (*startOfWord != '$') {
|
||||
endOfWord = EndOfPrintableWord(startOfWord+1, endOfFile);
|
||||
} // Else we don't need to update endOfWord
|
||||
}
|
||||
|
||||
m_nextPageOffset = startOfWord - text();
|
||||
};
|
||||
|
||||
int WordWrapTextView::getPageOffset() const {
|
||||
return m_pageOffset;
|
||||
BookSave WordWrapTextView::getBookSave() const {
|
||||
return {
|
||||
m_pageOffset,
|
||||
m_textColor
|
||||
};
|
||||
}
|
||||
|
||||
void WordWrapTextView::setPageOffset(int o) {
|
||||
m_pageOffset = o;
|
||||
void WordWrapTextView::setBookSave(BookSave save) {
|
||||
m_pageOffset = save.offset;
|
||||
m_textColor = save.color;
|
||||
}
|
||||
|
||||
}
|
||||
bool WordWrapTextView::updateTextColorForward(const char * colorStart) const {
|
||||
|
||||
if (*(colorStart + 1) == '\\') {
|
||||
m_textColor = Palette::PrimaryText;
|
||||
return (*(colorStart + 3) == '%' || *(colorStart + 4) == '%');
|
||||
}
|
||||
|
||||
int keySize = 1;
|
||||
KDColor lastColor = m_textColor;
|
||||
|
||||
switch (*(colorStart+1))
|
||||
{
|
||||
case 'r':
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = Palette::RedLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = Palette::Red;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
m_textColor = Palette::Magenta;
|
||||
break;
|
||||
case 't':
|
||||
m_textColor = Palette::Turquoise;
|
||||
break;
|
||||
case 'p':
|
||||
if (*(colorStart+2) == 'k') {
|
||||
m_textColor = Palette::Pink;
|
||||
keySize = 2;
|
||||
}
|
||||
else if (*(colorStart+2) == 'p') {
|
||||
m_textColor = Palette::Purple;
|
||||
keySize = 2;
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if (*(colorStart+2) == 'r') {
|
||||
m_textColor = Palette::Brown;
|
||||
keySize = 2;
|
||||
}
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = Palette::BlueLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = Palette::Blue;
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
m_textColor = Palette::Orange;
|
||||
break;
|
||||
case 'g':
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = Palette::GreenLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = Palette::Green;
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
m_textColor = Palette::Cyan;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*(colorStart + keySize + 1) != '%') {
|
||||
m_textColor = lastColor;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WordWrapTextView::updateTextColorBackward(const char * colorStart) const {
|
||||
|
||||
if (*(colorStart++) != '\\') {
|
||||
return false;
|
||||
}
|
||||
|
||||
int keySize = 1;
|
||||
KDColor lastColor = m_textColor;
|
||||
switch (*(colorStart+1))
|
||||
{
|
||||
case 'r':
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = Palette::RedLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = Palette::Red;
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
m_textColor = Palette::Magenta;
|
||||
break;
|
||||
case 't':
|
||||
m_textColor = Palette::Turquoise;
|
||||
break;
|
||||
case 'p':
|
||||
if (*(colorStart+2) == 'k') {
|
||||
m_textColor = Palette::Pink;
|
||||
keySize = 2;
|
||||
}
|
||||
else if (*(colorStart+2) == 'p') {
|
||||
m_textColor = Palette::Purple;
|
||||
keySize = 2;
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
if (*(colorStart+2) == 'r') {
|
||||
m_textColor = Palette::Brown;
|
||||
keySize = 2;
|
||||
}
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = Palette::BlueLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = Palette::Blue;
|
||||
}
|
||||
break;
|
||||
case 'o':
|
||||
m_textColor = Palette::Orange;
|
||||
break;
|
||||
case 'g':
|
||||
if (*(colorStart+2) == 'l') {
|
||||
m_textColor = Palette::GreenLight;
|
||||
keySize = 2;
|
||||
}
|
||||
else {
|
||||
m_textColor = Palette::Green;
|
||||
}
|
||||
break;
|
||||
case 'c':
|
||||
m_textColor = Palette::Cyan;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (*(colorStart + keySize + 1) != '%') {
|
||||
m_textColor = lastColor;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,20 +7,28 @@
|
||||
namespace Reader
|
||||
{
|
||||
|
||||
struct BookSave {
|
||||
int offset;
|
||||
KDColor color;
|
||||
};
|
||||
|
||||
class WordWrapTextView : public PointerTextView {
|
||||
public:
|
||||
WordWrapTextView() : PointerTextView(GlobalPreferences::sharedGlobalPreferences()->font()) {};
|
||||
WordWrapTextView();
|
||||
void drawRect(KDContext * ctx, KDRect rect) const override;
|
||||
void setText(const char*, int length);
|
||||
void nextPage();
|
||||
void previousPage();
|
||||
int getPageOffset() const;
|
||||
void setPageOffset(int o);
|
||||
protected:
|
||||
int m_pageOffset = 0;
|
||||
mutable int m_nextPageOffset = 0;
|
||||
int m_length = 0;
|
||||
BookSave getBookSave() const;
|
||||
void setBookSave(BookSave save);
|
||||
private:
|
||||
bool updateTextColorForward(const char * colorStart) const;
|
||||
bool updateTextColorBackward(const char * colorStart) const;
|
||||
static const int k_margin = 10;
|
||||
int m_pageOffset;
|
||||
mutable int m_nextPageOffset;
|
||||
int m_length;
|
||||
mutable KDColor m_textColor;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ app_settings_src = $(addprefix apps/settings/,\
|
||||
main_controller_prompt_update.cpp:+update \
|
||||
sub_menu/about_controller.cpp \
|
||||
sub_menu/accessibility_controller.cpp \
|
||||
sub_menu/code_options_controller.cpp \
|
||||
sub_menu/about_controller_official.cpp:+official \
|
||||
sub_menu/about_controller_non_official.cpp:-official \
|
||||
sub_menu/exam_mode_controller_official.cpp:+official \
|
||||
|
||||
@@ -17,9 +17,14 @@ constexpr SettingsMessageTree s_modelDateTimeChildren[3] = {SettingsMessageTree(
|
||||
constexpr SettingsMessageTree s_symbolChildren[4] = {SettingsMessageTree(I18n::Message::SymbolMultiplicationCross),SettingsMessageTree(I18n::Message::SymbolMultiplicationMiddleDot),SettingsMessageTree(I18n::Message::SymbolMultiplicationStar),SettingsMessageTree(I18n::Message::SymbolMultiplicationAutoSymbol)};
|
||||
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_modelFontChildren[2] = {SettingsMessageTree(I18n::Message::LargeFont), SettingsMessageTree(I18n::Message::SmallFont)};
|
||||
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)};
|
||||
constexpr SettingsMessageTree s_contributorsChildren[23] = {SettingsMessageTree(I18n::Message::Developers), SettingsMessageTree(I18n::Message::QuentinGuidee), SettingsMessageTree(I18n::Message::JoachimLeFournis), SettingsMessageTree(I18n::Message::MaximeFriess), SettingsMessageTree(I18n::Message::JeanBaptisteBoric), SettingsMessageTree(I18n::Message::SandraSimmons), SettingsMessageTree(I18n::Message::David), SettingsMessageTree(I18n::Message::DamienNicolet), SettingsMessageTree(I18n::Message::EvannDreumont), SettingsMessageTree(I18n::Message::SzaboLevente), SettingsMessageTree(I18n::Message::VenceslasDuet), SettingsMessageTree(I18n::Message::CharlotteThomas), SettingsMessageTree(I18n::Message::AntoninLoubiere), SettingsMessageTree(I18n::Message::CyprienMejat), SettingsMessageTree(I18n::Message::BetaTesters), SettingsMessageTree(I18n::Message::TimeoArnouts), SettingsMessageTree(I18n::Message::JulieC), SettingsMessageTree(I18n::Message::LelahelHideux), SettingsMessageTree(I18n::Message::Madil), SettingsMessageTree(I18n::Message::HilaireLeRoux), SettingsMessageTree(I18n::Message::HectorNussbaumer), SettingsMessageTree(I18n::Message::RaphaelDyda), SettingsMessageTree(I18n::Message::ThibautC)};
|
||||
|
||||
// Code Settings
|
||||
constexpr SettingsMessageTree s_codeChildren[2] = {SettingsMessageTree(I18n::Message::FontSizes, s_modelFontChildren), SettingsMessageTree(I18n::Message::Autocomplete)};
|
||||
constexpr SettingsMessageTree s_modelFontChildren[2] = {SettingsMessageTree(I18n::Message::LargeFont), SettingsMessageTree(I18n::Message::SmallFont)};
|
||||
|
||||
|
||||
constexpr SettingsMessageTree s_modelAboutChildren[9] = {SettingsMessageTree(I18n::Message::Username), SettingsMessageTree(I18n::Message::SoftwareVersion), SettingsMessageTree(I18n::Message::UpsilonVersion), SettingsMessageTree(I18n::Message::MicroPythonVersion), SettingsMessageTree(I18n::Message::Battery), SettingsMessageTree(I18n::Message::MemUse), SettingsMessageTree(I18n::Message::SerialNumber), SettingsMessageTree(I18n::Message::FccId), SettingsMessageTree(I18n::Message::Contributors, s_contributorsChildren)};
|
||||
|
||||
MainController::MainController(Responder * parentResponder, InputEventHandlerDelegate * inputEventHandlerDelegate) :
|
||||
@@ -31,6 +36,7 @@ MainController::MainController(Responder * parentResponder, InputEventHandlerDel
|
||||
m_localizationController(this, Metric::CommonTopMargin, LocalizationController::Mode::Language),
|
||||
m_accessibilityController(this),
|
||||
m_dateTimeController(this),
|
||||
m_codeOptionsController(this),
|
||||
m_examModeController(this),
|
||||
m_aboutController(this),
|
||||
m_preferencesController(this)
|
||||
@@ -62,7 +68,7 @@ bool MainController::handleEvent(Ion::Events::Event event) {
|
||||
}
|
||||
if (model()->childAtIndex(selectedRow())->numberOfChildren() == 0) {
|
||||
if (model()->childAtIndex(selectedRow())->label() == promptMessage()) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
|
||||
globalPreferences->setShowPopUp(!globalPreferences->showPopUp());
|
||||
m_selectableTableView.reloadCellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow());
|
||||
return true;
|
||||
@@ -103,6 +109,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::CodeApp) {
|
||||
subController = &m_codeOptionsController;
|
||||
} else {
|
||||
subController = &m_preferencesController;
|
||||
}
|
||||
@@ -202,9 +210,6 @@ void MainController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
MessageTableCellWithChevronAndMessage * myTextCell = (MessageTableCellWithChevronAndMessage *)cell;
|
||||
int childIndex = -1;
|
||||
switch (model()->childAtIndex(index)->label()) {
|
||||
case I18n::Message::FontSizes:
|
||||
childIndex = GlobalPreferences::sharedGlobalPreferences()->font() == KDFont::LargeFont ? 0 : 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "sub_menu/accessibility_controller.h"
|
||||
#include "sub_menu/datetime_controller.h"
|
||||
#include "sub_menu/exam_mode_controller.h"
|
||||
#include "sub_menu/code_options_controller.h"
|
||||
#include "sub_menu/localization_controller.h"
|
||||
#include "sub_menu/math_options_controller.h"
|
||||
#include "sub_menu/preferences_controller.h"
|
||||
@@ -22,6 +23,7 @@ extern const Shared::SettingsMessageTree s_symbolChildren[4];
|
||||
extern const Shared::SettingsMessageTree s_symbolFunctionChildren[3];
|
||||
extern const Shared::SettingsMessageTree s_modelMathOptionsChildren[6];
|
||||
extern const Shared::SettingsMessageTree s_modelFontChildren[2];
|
||||
extern const Shared::SettingsMessageTree s_codeChildren[2];
|
||||
extern const Shared::SettingsMessageTree s_modelDateTimeChildren[3];
|
||||
extern const Shared::SettingsMessageTree s_accessibilityChildren[6];
|
||||
extern const Shared::SettingsMessageTree s_contributorsChildren[23];
|
||||
@@ -70,6 +72,7 @@ private:
|
||||
LocalizationController m_localizationController;
|
||||
AccessibilityController m_accessibilityController;
|
||||
DateTimeController m_dateTimeController;
|
||||
CodeOptionsController m_codeOptionsController;
|
||||
ExamModeController m_examModeController;
|
||||
AboutController m_aboutController;
|
||||
PreferencesController m_preferencesController;
|
||||
|
||||
@@ -10,10 +10,10 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
{SettingsMessageTree(I18n::Message::MathOptions, s_modelMathOptionsChildren),
|
||||
SettingsMessageTree(I18n::Message::Brightness),
|
||||
SettingsMessageTree(I18n::Message::DateTime, s_modelDateTimeChildren),
|
||||
SettingsMessageTree(I18n::Message::FontSizes, s_modelFontChildren),
|
||||
SettingsMessageTree(I18n::Message::Language),
|
||||
SettingsMessageTree(I18n::Message::Country),
|
||||
SettingsMessageTree(I18n::Message::ExamMode, ExamModeConfiguration::s_modelExamChildren),
|
||||
SettingsMessageTree(I18n::Message::CodeApp, s_codeChildren),
|
||||
SettingsMessageTree(I18n::Message::BetaPopUp),
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren),
|
||||
SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren)};
|
||||
|
||||
@@ -13,7 +13,7 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
SettingsMessageTree(I18n::Message::Language),
|
||||
SettingsMessageTree(I18n::Message::Country),
|
||||
SettingsMessageTree(I18n::Message::ExamMode, ExamModeConfiguration::s_modelExamChildren),
|
||||
SettingsMessageTree(I18n::Message::FontSizes, s_modelFontChildren),
|
||||
SettingsMessageTree(I18n::Message::CodeApp, s_codeChildren),
|
||||
SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren),
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren)};
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ constexpr SettingsMessageTree s_modelMenu[] =
|
||||
{SettingsMessageTree(I18n::Message::MathOptions, s_modelMathOptionsChildren),
|
||||
SettingsMessageTree(I18n::Message::Brightness),
|
||||
SettingsMessageTree(I18n::Message::DateTime, s_modelDateTimeChildren),
|
||||
SettingsMessageTree(I18n::Message::FontSizes, s_modelFontChildren),
|
||||
SettingsMessageTree(I18n::Message::Language),
|
||||
SettingsMessageTree(I18n::Message::Country),
|
||||
SettingsMessageTree(I18n::Message::ExamMode, ExamModeConfiguration::s_modelExamChildren),
|
||||
SettingsMessageTree(I18n::Message::CodeApp, s_codeChildren),
|
||||
SettingsMessageTree(I18n::Message::UpdatePopUp),
|
||||
SettingsMessageTree(I18n::Message::Accessibility, s_accessibilityChildren),
|
||||
SettingsMessageTree(I18n::Message::About, s_modelAboutChildren)};
|
||||
|
||||
@@ -25,7 +25,7 @@ bool AccessibilityController::handleEvent(Ion::Events::Event event) {
|
||||
int redGamma, greenGamma, blueGamma;
|
||||
KDIonContext::sharedContext()->gamma.gamma(redGamma, greenGamma, blueGamma);
|
||||
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
|
||||
if (selectedRow() == 0) {
|
||||
invertEnabled = !invertEnabled;
|
||||
}
|
||||
|
||||
72
apps/settings/sub_menu/code_options_controller.cpp
Normal file
72
apps/settings/sub_menu/code_options_controller.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
#include "code_options_controller.h"
|
||||
#include <assert.h>
|
||||
#include "../../global_preferences.h"
|
||||
|
||||
using namespace Shared;
|
||||
|
||||
namespace Settings {
|
||||
|
||||
CodeOptionsController::CodeOptionsController(Responder * parentResponder) :
|
||||
GenericSubController(parentResponder),
|
||||
m_preferencesController(this)
|
||||
{
|
||||
for (int i = 0; i < k_totalNumberOfCell; i++) {
|
||||
m_cells[i].setMessageFont(KDFont::LargeFont);
|
||||
}
|
||||
for (int i = 0; i < k_totalNumberOfSwitchCells; i++) {
|
||||
m_switchCells[i].setMessageFont(KDFont::LargeFont);
|
||||
}
|
||||
}
|
||||
|
||||
bool CodeOptionsController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
|
||||
switch (selectedRow()){
|
||||
case 1:
|
||||
GlobalPreferences::sharedGlobalPreferences()->setAutocomplete(!GlobalPreferences::sharedGlobalPreferences()->autocomplete());
|
||||
m_selectableTableView.reloadCellAtLocation(m_selectableTableView.selectedColumn(), m_selectableTableView.selectedRow());
|
||||
break;
|
||||
|
||||
default:
|
||||
GenericSubController * subController = nullptr;
|
||||
subController = &m_preferencesController;
|
||||
subController->setMessageTreeModel(m_messageTreeModel->childAtIndex(selectedRow()));
|
||||
StackViewController * stack = stackController();
|
||||
m_lastSelect = selectedRow();
|
||||
stack->push(subController);
|
||||
break;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return GenericSubController::handleEvent(event);
|
||||
}
|
||||
|
||||
HighlightCell * CodeOptionsController::reusableCell(int index, int type) {
|
||||
assert(type == 0);
|
||||
assert(index >= 0 && index < k_totalNumberOfCell);
|
||||
return &m_cells[index];
|
||||
}
|
||||
|
||||
int CodeOptionsController::reusableCellCount(int type) {
|
||||
assert(type == 0);
|
||||
return k_totalNumberOfCell;
|
||||
}
|
||||
|
||||
void CodeOptionsController::willDisplayCellForIndex(HighlightCell * cell, int index) {
|
||||
GenericSubController::willDisplayCellForIndex(cell, index);
|
||||
I18n::Message thisLabel = m_messageTreeModel->childAtIndex(index)->label();
|
||||
|
||||
if (thisLabel == I18n::Message::FontSizes){
|
||||
MessageTableCellWithChevronAndMessage * myTextCell = (MessageTableCellWithChevronAndMessage *)cell;
|
||||
myTextCell->setMessage(thisLabel);
|
||||
GlobalPreferences::sharedGlobalPreferences()->font() == KDFont::LargeFont
|
||||
? myTextCell->setSubtitle(I18n::Message::LargeFont)
|
||||
: myTextCell->setSubtitle(I18n::Message::SmallFont);
|
||||
} else if (thisLabel == I18n::Message::Autocomplete) {
|
||||
MessageTableCellWithSwitch * mySwitchCell = (MessageTableCellWithSwitch *)cell;
|
||||
SwitchView * mySwitch = (SwitchView *)mySwitchCell->accessoryView();
|
||||
mySwitch->setState(GlobalPreferences::sharedGlobalPreferences()->autocomplete());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
26
apps/settings/sub_menu/code_options_controller.h
Normal file
26
apps/settings/sub_menu/code_options_controller.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef SETTINGS_CODE_OPTIONS_CONTROLLER_H
|
||||
#define SETTINGS_CODE_OPTIONS_CONTROLLER_H
|
||||
|
||||
#include "generic_sub_controller.h"
|
||||
#include "preferences_controller.h"
|
||||
|
||||
namespace Settings {
|
||||
|
||||
class CodeOptionsController : public GenericSubController {
|
||||
public:
|
||||
CodeOptionsController(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;
|
||||
private:
|
||||
constexpr static int k_totalNumberOfCell = 1;
|
||||
constexpr static int k_totalNumberOfSwitchCells = 1;
|
||||
PreferencesController m_preferencesController;
|
||||
MessageTableCellWithChevronAndMessage m_cells[k_totalNumberOfCell];
|
||||
MessageTableCellWithSwitch m_switchCells[k_totalNumberOfCell];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -26,7 +26,7 @@ DateTimeController::DateTimeController(Responder * parentResponder) :
|
||||
bool DateTimeController::handleEvent(Ion::Events::Event event) {
|
||||
bool clockEnabled = Ion::RTC::mode() != Ion::RTC::Mode::Disabled;
|
||||
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
|
||||
if (selectedRow() == 0) {
|
||||
clockEnabled = !clockEnabled;
|
||||
if (clockEnabled) {
|
||||
|
||||
@@ -27,7 +27,7 @@ void PreferencesController::didBecomeFirstResponder() {
|
||||
}
|
||||
|
||||
bool PreferencesController::handleEvent(Ion::Events::Event event) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE) {
|
||||
if (event == Ion::Events::OK || event == Ion::Events::EXE || event == Ion::Events::Right) {
|
||||
/* Generic behaviour of preference menu*/
|
||||
assert(m_messageTreeModel->label() != I18n::Message::DisplayMode || selectedRow() != numberOfRows()-1); // In that case, events OK and EXE are handled by the cell
|
||||
setPreferenceWithValueIndex(m_messageTreeModel->label(), selectedRow());
|
||||
|
||||
@@ -458,3 +458,39 @@ 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"
|
||||
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"
|
||||
Cndcvt_Aluminium = "3.77·10^7_S_m^-1"
|
||||
Cndcvt_Calcium = "2.98·10^7_S_m^-1"
|
||||
Cndcvt_Tungsten = "1.79·10^7_S_m^-1"
|
||||
Cndcvt_Zinc = "1.69·10^7_S_m^-1"
|
||||
Cndcvt_Cobalt = "1.60·10^7_S_m^-1"
|
||||
Cndcvt_Nickel = "1.43·10^7_S_m^-1"
|
||||
Cndcvt_Lithium = "1.08·10^7_S_m^-1"
|
||||
Cndcvt_Iron = "1.00·10^7_S_m^-1"
|
||||
Cndcvt_Platinum = "9.43·10^6_S_m^-1"
|
||||
Cndcvt_Tin = "9.17·10^6_S_m^-1"
|
||||
Cndcvt_Sea_water = "4.80_S_m^-1"
|
||||
Cndcvt_Water = "5.00·10^-3_S_m^-1"
|
||||
Cndcvt_Air = "1.00·10^-13_S_m^-1"
|
||||
Cndcvt_Glass = "1.00·10^-13_S_m^-1"
|
||||
Cndcvt_Wood = "1.00·10^-3_S_m^-1"
|
||||
Rstvt_Silver = "1.59·10^-8_Ω_m"
|
||||
Rstvt_Copper = "1.68·10^-8_Ω_m"
|
||||
Rstvt_Gold = "2.44·10^-8_Ω_m"
|
||||
Rstvt_Aluminium = "2.65·10^-8_Ω_m"
|
||||
Rstvt_Calcium = "3.36·10^-8_Ω_m"
|
||||
Rstvt_Tungsten = "5.60·10^-8_Ω_m"
|
||||
Rstvt_Zinc = "5.90·10^-8_Ω_m"
|
||||
Rstvt_Cobalt = "6.24·10^-8_Ω_m"
|
||||
Rstvt_Nickel = "6.99·10^-8_Ω_m"
|
||||
Rstvt_Lithium = "9.28·10^-8_Ω_m"
|
||||
Rstvt_Iron = "9.70·10^-8_Ω_m"
|
||||
Rstvt_Platinum = "1.06·10^-7_Ω_m"
|
||||
Rstvt_Tin = "1.09·10^-7_Ω_m"
|
||||
Rstvt_Sea_water = "2.1·10^-1_Ω_m"
|
||||
Rstvt_Water = "1.01·10^3_Ω_m"
|
||||
Rstvt_Air = "1.00·10^9_Ω_m"
|
||||
Rstvt_Glass = "5.00·10^14_Ω_m"
|
||||
Rstvt_Wood = "1.00·10^3_Ω_m"
|
||||
|
||||
@@ -430,6 +430,27 @@ AvogadroTag = "Avogadro-Konstante"
|
||||
GasTag = "Gaskonstante"
|
||||
Electromagnetism = "Elektromagnetismus"
|
||||
CoulombTag = "Coulomb-Konstante"
|
||||
ConductivityConstants = "Leitfähigkeitskonstanten"
|
||||
Electricity = "Elektrizität"
|
||||
ResistivityConstants = "Konstanten der Widerstandsfähigkeit"
|
||||
Silver = "Silber"
|
||||
Copper = "Kupfer"
|
||||
Gold = "Gold"
|
||||
Aluminium = "Aluminium"
|
||||
Calcium = "Kalzium"
|
||||
Tungsten = "Wolfram"
|
||||
Zinc = "Zink"
|
||||
Cobalt = "Kobalt"
|
||||
Nickel = "Nickel"
|
||||
Lithium = "Lithium"
|
||||
Iron = "eisen"
|
||||
Platinum = "Platin"
|
||||
Tin = "Zinn"
|
||||
Sea_water = "Meerwasser"
|
||||
Water = "Wasser"
|
||||
Air = "Luft"
|
||||
Glass = "Glas"
|
||||
Wood = "Holz"
|
||||
Vacuum_permittivityTag = "Vakuum-Durchlässigkeit"
|
||||
Vacuum_permeabilityTag = "Vakuumdurchlässigkeit"
|
||||
PlanckTag = "Planck - Konstante"
|
||||
|
||||
@@ -430,6 +430,27 @@ AvogadroTag = "Avogadro Constant"
|
||||
GasTag = "Gas Constant"
|
||||
Electromagnetism = "Electromagnetism"
|
||||
CoulombTag = "Coulomb Constant"
|
||||
ConductivityConstants = "Conductivity constants"
|
||||
Electricity = "Electricity"
|
||||
ResistivityConstants = "Resistivity Constants"
|
||||
Silver = "Silver"
|
||||
Copper = "Copper"
|
||||
Gold = "Gold"
|
||||
Aluminium = "Aluminium"
|
||||
Calcium = "Calcium"
|
||||
Tungsten = "Tungsten"
|
||||
Zinc = "Zinc"
|
||||
Cobalt = "Cobalt"
|
||||
Nickel = "Nickel"
|
||||
Lithium = "Lithium"
|
||||
Iron = "Iron"
|
||||
Platinum = "Platinum"
|
||||
Tin = "Tin"
|
||||
Sea_water = "Sea Water"
|
||||
Water = "Water"
|
||||
Air = "Air"
|
||||
Glass = "Glass"
|
||||
Wood = "Wood"
|
||||
Vacuum_permittivityTag = "Vacuum permittivity"
|
||||
Vacuum_permeabilityTag = "Vacuum permeability"
|
||||
PlanckTag = "Planck Constant"
|
||||
|
||||
@@ -430,6 +430,27 @@ AvogadroTag = "Constante de Avogadro"
|
||||
GasTag = "Constante de gas"
|
||||
Electromagnetism = "Electromagnetismo"
|
||||
CoulombTag = "Constante de Coulomb"
|
||||
ConductivityConstants = "Constantes de conductividad"
|
||||
Electricity = "Electricidad"
|
||||
ResistivityConstants = "Constantes de resistividad"
|
||||
Silver = "Plata"
|
||||
Copper = "cobre"
|
||||
Gold = "Oro"
|
||||
Aluminium = "Aluminio"
|
||||
Calcium = "Calcio"
|
||||
Tungsten = "Tungsteno"
|
||||
Zinc = "Zinc"
|
||||
Cobalt = "Cobalto"
|
||||
Nickel = "Níquel"
|
||||
Lithium = "Litio"
|
||||
Iron = "Hierro"
|
||||
Platinum = "Platino"
|
||||
Tin = "Tin"
|
||||
Sea_water = "Agua de mar"
|
||||
Water = "Agua"
|
||||
Air = "Aire"
|
||||
Glass = "Vidrio"
|
||||
Wood = "Madera"
|
||||
Vacuum_permittivityTag = "Permisividad de vacío"
|
||||
Vacuum_permeabilityTag = "Permeabilidad al vacío"
|
||||
PlanckTag = "Constante de Planck"
|
||||
|
||||
@@ -429,6 +429,27 @@ BoltzmannTag = "Constante de Boltzmann"
|
||||
AvogadroTag = "Constante d'Avogadro"
|
||||
GasTag = "Constante des gaz parfaits"
|
||||
Electromagnetism = "Electromagnétisme"
|
||||
ConductivityConstants = "Constantes de Conductivité"
|
||||
Electricity = "Electricité"
|
||||
ResistivityConstants = "Constantes de Resistivité"
|
||||
Silver = "Argent"
|
||||
Copper = "Cuivre"
|
||||
Gold = "Or"
|
||||
Aluminium = "Aluminium"
|
||||
Calcium = "Calcium"
|
||||
Tungsten = "Tungstène"
|
||||
Zinc = "Zinc"
|
||||
Cobalt = "Cobalt"
|
||||
Nickel = "Nickel"
|
||||
Lithium = "Lithium"
|
||||
Iron = "Fer"
|
||||
Platinum = "Platine"
|
||||
Tin = "Étain"
|
||||
Sea_water = "Eau de mer"
|
||||
Water = "Eau"
|
||||
Air = "Air"
|
||||
Glass = "Verre"
|
||||
Wood = "Bois"
|
||||
CoulombTag = "Constante de Coulomb"
|
||||
EscapeVelocity = "Vitesse de libération"
|
||||
EscapeVelocityFromEarth = "De la Terre"
|
||||
|
||||
@@ -430,6 +430,27 @@ AvogadroTag = "Avogadro Állandó"
|
||||
GasTag = "Gázállandó"
|
||||
Electromagnetism = "Elektromágnesesség"
|
||||
CoulombTag = "Coulomb állandó"
|
||||
ConductivityConstants = "Vezetőképességi konstansok"
|
||||
Electricity = "Elektromosság"
|
||||
ResistivityConstants = "Ellenállósági konstansok"
|
||||
Silver = "Ezüst"
|
||||
Copper = "Réz"
|
||||
Gold = "Arany"
|
||||
Aluminium = "Alumínium"
|
||||
Calcium = "Kalcium"
|
||||
Tungsten = "Wolfram"
|
||||
Zinc = "Cink"
|
||||
Cobalt = "Cobalt"
|
||||
Nickel = "Nickel"
|
||||
Lithium = "Lítium"
|
||||
Iron = "Vas"
|
||||
Platinum = "Platina"
|
||||
Tin = "Bádog"
|
||||
Sea_water = "Tengeri víz"
|
||||
Water = "Víz"
|
||||
Air = "Air"
|
||||
Glass = "Üveg"
|
||||
Wood = "Wood"
|
||||
Vacuum_permittivityTag = "Vákuum-engedély"
|
||||
Vacuum_permeabilityTag = "Vákuumpermeabilitás"
|
||||
PlanckTag = "Planck Állandó"
|
||||
|
||||
@@ -430,6 +430,27 @@ AvogadroTag = "Costanto di Avogadro"
|
||||
GasTag = "Costante dei gas"
|
||||
Electromagnetism = "Elettromagnetismo"
|
||||
CoulombTag = "Costante di coulomb"
|
||||
ConductivityConstants = "Costanti di conducibilità"
|
||||
Electricity = "Elettricità"
|
||||
ResistivityConstants = "Costanti di resistività"
|
||||
Silver = "Argento"
|
||||
Copper = "Rame"
|
||||
Gold = "Oro"
|
||||
Aluminium = "Aluminio"
|
||||
Calcium = "Calcio"
|
||||
Tungsten = "Tungsteno"
|
||||
Zinc = "Zinco"
|
||||
Cobalt = "Cobalto"
|
||||
Nickel = "Nichel"
|
||||
Lithium = "Litio"
|
||||
Iron = "Ferro"
|
||||
Platinum = "Platino"
|
||||
Tin = "Stagno"
|
||||
Sea_water = "Acqua di mare"
|
||||
Water = "Acqua"
|
||||
Air = "Aria"
|
||||
Glass = "Vetro"
|
||||
Wood = "Legno"
|
||||
Vacuum_permittivityTag = "Permittività del vuoto"
|
||||
Vacuum_permeabilityTag = "Permeabilità al vuoto"
|
||||
PlanckTag = "Costante di Planck"
|
||||
|
||||
@@ -430,6 +430,27 @@ AvogadroTag = "Avogadroconstante"
|
||||
GasTag = "Gasconstante"
|
||||
Electromagnetism = "Elektromagnetisme"
|
||||
CoulombTag = "Coulombconstante"
|
||||
ConductivityConstants = "Geleidingsconstanten"
|
||||
Electricity = "Elektriciteit"
|
||||
ResistivityConstants = "Weerstandsconstanten"
|
||||
Silver = "Zilver"
|
||||
Copper = "Koper"
|
||||
Gold = "Goud"
|
||||
Aluminium = "Aluminium"
|
||||
Calcium = "Calcium"
|
||||
Tungsten = "Tungsten"
|
||||
Zinc = "Zink"
|
||||
Cobalt = "Kobalt"
|
||||
Nickel = "Nikkel"
|
||||
Lithium = "Lithium"
|
||||
Iron = "IJzer"
|
||||
Platinum = "Platina"
|
||||
Tin = "Tin"
|
||||
Sea_water = "Zeewater"
|
||||
Water = "Water"
|
||||
Air = "Lucht"
|
||||
Glass = "Glas"
|
||||
Wood = "Hout"
|
||||
Vacuum_permittivityTag = "Elektrische veldconstante"
|
||||
Vacuum_permeabilityTag = "Magnetische veldconstante"
|
||||
PlanckTag = "Planckconstante"
|
||||
|
||||
@@ -430,6 +430,27 @@ AvogadroTag = "Constante Avogadro"
|
||||
GasTag = "Constante de gás"
|
||||
Electromagnetism = "Eletromagnetismo"
|
||||
CoulombTag = "Constante de Coulomb"
|
||||
ConductivityConstants = "Constantes de condutividade"
|
||||
Electricity = "Electricidade"
|
||||
ResistivityConstants = "Constantes de resistividade"
|
||||
Silver = "Prata"
|
||||
Copper = "Cobre"
|
||||
Gold = "Ouro"
|
||||
Aluminium = "Alumínio"
|
||||
Calcium = "Cálcio"
|
||||
Tungsten = "Tungsténio"
|
||||
Zinc = "Zinco"
|
||||
Cobalt = "Cobalto"
|
||||
Nickel = "Níquel"
|
||||
Lithium = "Lítio"
|
||||
Iron = "Ferro de engomar"
|
||||
Platinum = "Platina"
|
||||
Tin = "Lata"
|
||||
Sea_water = "Água do mar"
|
||||
Water = "Água"
|
||||
Air = "Ar"
|
||||
Glass = "Vidro"
|
||||
Wood = "Madeira"
|
||||
Vacuum_permittivityTag = "Permissividade a vácuo"
|
||||
Vacuum_permeabilityTag = "Permeabilidade ao vácuo"
|
||||
PlanckTag = "Constante de Planck"
|
||||
|
||||
@@ -16,3 +16,4 @@ EPSILON_GETOPT ?= 0
|
||||
ESCHER_LOG_EVENTS_BINARY ?= 0
|
||||
THEME_NAME ?= omega_light
|
||||
THEME_REPO ?= local
|
||||
INCLUDE_ULAB ?= 1
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
# You gotta PIMP MY CALC
|
||||
|
||||
ifndef NO_PIMP
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[1m ____ \n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[1m / __ \\____ ___ ___ ____ _____ _ \n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[1m / / / / __ \`__ \\/ _ \\/ __ \`/ __ \`/ \n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[1m / /_/ / / / / / / __/ /_/ / /_/ / \n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[1m \\____/_/ /_/ /_/\\___/\\__, /\\__,_/ \n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[1m /____/ \n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[33m - Omega does what Epsilon't \e[0m\n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[36m __ __ ______ ____ ____ _____\n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[36m / / / /_____/ ,____/_/ / / __ \/'_ /\n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[36m / / / / __ '/ /____/ / / / / / / / / / \n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[36m / /_/ / /_/ /___, / / /__/ /_/ / / / / \n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[36m \____/ ____/______/_/____/\____/_/ /_/ \n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[36m / / \n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[91m\e[36m /_/ \n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[0;34m - When Epsiloff and Omegout \e[0m\n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[32mBuilding O$(OMEGA_VERSION)-E$(EPSILON_VERSION)\n")
|
||||
PLS_IGNORE := $(shell >&2 printf "\e[32mBuilding U$(UPSILON_VERSION)-E$(EPSILON_VERSION)\n")
|
||||
|
||||
ifeq (${PLATFORM},device)
|
||||
DISPLAY_TARGET = Numworks $(MODEL)
|
||||
|
||||
@@ -45,6 +45,7 @@ $(BUILD_DIR)/flasher.verbose.$(EXE): $(call flavored_object_for,$(flasher_src),u
|
||||
$(BUILD_DIR)/flasher.verbose.flash.$(EXE): $(call flavored_object_for,$(flasher_src))
|
||||
$(BUILD_DIR)/flasher.%.$(EXE): LDFLAGS += -Lion/src/$(PLATFORM)/flasher
|
||||
$(BUILD_DIR)/flasher.%.$(EXE): LDSCRIPT = ion/src/$(PLATFORM)/shared/ram.ld
|
||||
$(BUILD_DIR)/flasher.%.$(EXE): RASTERIZER_CFLAGS += -DISBUILDINGFLASHER
|
||||
$(BUILD_DIR)/flasher.%.flash.$(EXE): LDSCRIPT = ion/src/$(PLATFORM)/$(MODEL)/internal_flash.ld
|
||||
|
||||
#TODO Do not build all apps... Put elsewhere?
|
||||
|
||||
@@ -17,7 +17,7 @@ class Storage {
|
||||
public:
|
||||
typedef uint16_t record_size_t;
|
||||
|
||||
constexpr static size_t k_storageSize = 32768;
|
||||
constexpr static size_t k_storageSize = 64000;
|
||||
static_assert(UINT16_MAX >= k_storageSize, "record_size_t not big enough");
|
||||
|
||||
static Storage * sharedStorage();
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
#include <ion.h>
|
||||
#include <kandinsky.h>
|
||||
|
||||
namespace Flasher {
|
||||
namespace Display {
|
||||
|
||||
void init() {
|
||||
Ion::Display::pushRectUniform(KDRect(0,0,Ion::Display::Width,Ion::Display::Height), KDColor::RGB24(0xFFFF00));
|
||||
KDRect screen = KDRect(0,0,Ion::Display::Width,Ion::Display::Height);
|
||||
Ion::Display::pushRectUniform(KDRect(0,0,Ion::Display::Width,Ion::Display::Height), KDColor::RGB24(0x5e81ac));
|
||||
KDContext * ctx = KDIonContext::sharedContext();
|
||||
ctx->setOrigin(KDPointZero);
|
||||
ctx->setClippingRect(screen);
|
||||
ctx->drawString("RECOVERY MODE", KDPoint(10, 10), KDFont::LargeFont, KDColorWhite, KDColor::RGB24(0x5e81ac));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,47 +1,55 @@
|
||||
#include <ion.h>
|
||||
#include <kandinsky.h>
|
||||
#include "image.h"
|
||||
|
||||
namespace Flasher {
|
||||
namespace Display {
|
||||
namespace Display {
|
||||
|
||||
constexpr static int sNumberOfMessages = 5;
|
||||
constexpr static int sNumberOfLanguages = 2;
|
||||
constexpr static int sNumberOfMessages = 5;
|
||||
|
||||
constexpr static const char * sMessages[sNumberOfLanguages][sNumberOfMessages] = {
|
||||
{"RECOVERY MODE",
|
||||
"Your calculator is waiting",
|
||||
"for a new software.",
|
||||
"Follow the instructions",
|
||||
"on your computer to continue."},
|
||||
{"MODE RECUPERATION",
|
||||
"Votre calculatrice attend",
|
||||
"l'installation d'un nouveau logiciel.",
|
||||
"Suivez les instructions sur",
|
||||
"votre ordinateur pour continuer."}
|
||||
};
|
||||
constexpr static const char * sMessages[sNumberOfMessages] = {
|
||||
"RECOVERY MODE",
|
||||
"Your calculator is waiting",
|
||||
"for Upsilon to be installed.",
|
||||
"Follow the instructions",
|
||||
"on your computer to continue.",
|
||||
};
|
||||
|
||||
void init() {
|
||||
KDRect screen = KDRect(0,0,Ion::Display::Width,Ion::Display::Height);
|
||||
Ion::Display::pushRectUniform(screen, KDColor::RGB24(0x2B2B2B));
|
||||
KDContext * ctx = KDIonContext::sharedContext();
|
||||
ctx->setOrigin(KDPointZero);
|
||||
ctx->setClippingRect(screen);
|
||||
KDCoordinate margin = 30;
|
||||
KDCoordinate currentHeight = margin;
|
||||
|
||||
/* Title */
|
||||
const char * title = sMessages[0];
|
||||
KDSize titleSize = KDFont::LargeFont->stringSize(title);
|
||||
ctx->drawString(title, KDPoint((Ion::Display::Width-titleSize.width())/2, currentHeight),
|
||||
KDFont::LargeFont, KDColorWhite, KDColor::RGB24(0x2B2B2B));
|
||||
currentHeight = (uint16_t)((Ion::Display::Height*2)/3);
|
||||
|
||||
/* Logo */
|
||||
for (int i = 0; i < IMAGE_WIDTH; ++i) {
|
||||
for (int j = 0; j < IMAGE_HEIGHT; ++j) {
|
||||
ctx->setPixel(KDPoint(i+(uint16_t)((Ion::Display::Width-IMAGE_WIDTH)/2),
|
||||
j+(titleSize.height()+margin+15)),
|
||||
KDColor::RGB16(image[i+(j*IMAGE_WIDTH)]));
|
||||
}
|
||||
}
|
||||
|
||||
/* Messages */
|
||||
const char * message;
|
||||
for (int i = 1; i < sNumberOfMessages; ++i) {
|
||||
message = sMessages[i];
|
||||
KDSize messageSize = KDFont::SmallFont->stringSize(message);
|
||||
ctx->drawString(message, KDPoint((Ion::Display::Width-messageSize.width())/2, currentHeight),
|
||||
KDFont::SmallFont, KDColorWhite, KDColor::RGB24(0x2B2B2B));
|
||||
currentHeight += messageSize.height();
|
||||
}
|
||||
}
|
||||
|
||||
void init() {
|
||||
KDRect screen = KDRect(0,0,Ion::Display::Width,Ion::Display::Height);
|
||||
Ion::Display::pushRectUniform(screen, KDColorWhite);
|
||||
KDContext * ctx = KDIonContext::sharedContext();
|
||||
ctx->setOrigin(KDPointZero);
|
||||
ctx->setClippingRect(screen);
|
||||
KDCoordinate margin = 20;
|
||||
KDCoordinate currentHeight = 0;
|
||||
for (int i = 0; i < sNumberOfLanguages; i++) {
|
||||
currentHeight += margin;
|
||||
const char * title = sMessages[i][0];
|
||||
KDSize titleSize = KDFont::LargeFont->stringSize(title);
|
||||
ctx->drawString(title, KDPoint((Ion::Display::Width-titleSize.width())/2, currentHeight), KDFont::LargeFont);
|
||||
currentHeight += 2*titleSize.height();
|
||||
for (int j = 1; j < sNumberOfMessages; j++) {
|
||||
const char * message = sMessages[i][j];
|
||||
KDSize messageSize = KDFont::SmallFont->stringSize(message);
|
||||
ctx->drawString(message, KDPoint((Ion::Display::Width-messageSize.width())/2, currentHeight), KDFont::SmallFont);
|
||||
currentHeight += messageSize.height();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
11
ion/src/device/flasher/image.h
Normal file
11
ion/src/device/flasher/image.h
Normal file
File diff suppressed because one or more lines are too long
@@ -22,7 +22,11 @@ MEMORY {
|
||||
* object). Using a stack too small would result in some memory being
|
||||
* overwritten (for instance, vtables that live in the .rodata section). */
|
||||
|
||||
STACK_SIZE = 32K;
|
||||
/* The image is quite large too!
|
||||
* So we put the stack to 18K so there's still space
|
||||
* for our image, if not LD will throw an error. */
|
||||
|
||||
STACK_SIZE = 18K;
|
||||
|
||||
SECTIONS {
|
||||
.isr_vector_table ORIGIN(RAM_BUFFER) : {
|
||||
|
||||
@@ -32,7 +32,15 @@ tests_src += $(addprefix kandinsky/test/,\
|
||||
rect.cpp\
|
||||
)
|
||||
|
||||
code_points = kandinsky/fonts/code_points.h
|
||||
ifdef ($(ISBUILDINGFLASHER))
|
||||
code_points = kandinsky/fonts/code_points.h
|
||||
else
|
||||
ifdef ($(HAS_READER))
|
||||
code_points = kandinsky/fonts/code_points_latex.h
|
||||
else
|
||||
code_points = kandinsky/fonts/code_points.h
|
||||
endif
|
||||
endif
|
||||
|
||||
RASTERIZER_CFLAGS := -std=c99 $(shell pkg-config freetype2 --cflags)
|
||||
RASTERIZER_LDFLAGS := $(shell pkg-config freetype2 --libs)
|
||||
|
||||
212
kandinsky/fonts/code_points_latex.h
Normal file
212
kandinsky/fonts/code_points_latex.h
Normal file
@@ -0,0 +1,212 @@
|
||||
#ifndef KANDINSKY_FONTS_CODE_POINTS_H
|
||||
#define KANDINSKY_FONTS_CODE_POINTS_H
|
||||
|
||||
// [0x30a].map{|i| "0x" + i.to_s(16) +", // " + [i].pack("U") + " // " + Unicode::Name.of([i].pack("U"))}.join("|")
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
/* This array lists the code points that are rasterized by rasterizer.c. We put
|
||||
* most characters from the LATIN charset, and some mathematical characters. */
|
||||
|
||||
uint32_t CodePoints[] = {
|
||||
0x20, // // SPACE
|
||||
0x21, // ! // EXCLAMATION MARK
|
||||
0x22, // " // QUOTATION MARK
|
||||
0x23, // # // NUMBER SIGN
|
||||
0x24, // $ // DOLLAR SIGN
|
||||
0x25, // % // PERCENT SIGN
|
||||
0x26, // & // AMPERSAND
|
||||
0x27, // ' // APOSTROPHE
|
||||
0x28, // ( // LEFT PARENTHESIS
|
||||
0x29, // ) // RIGHT PARENTHESIS
|
||||
0x2a, // * // ASTERISK
|
||||
0x2b, // + // PLUS SIGN
|
||||
0x2c, // , // COMMA
|
||||
0x2d, // - // HYPHEN-MINUS
|
||||
0x2e, // . // FULL STOP
|
||||
0x2f, // / // SOLIDUS
|
||||
0x30, // 0 // DIGIT ZERO
|
||||
0x31, // 1 // DIGIT ONE
|
||||
0x32, // 2 // DIGIT TWO
|
||||
0x33, // 3 // DIGIT THREE
|
||||
0x34, // 4 // DIGIT FOUR
|
||||
0x35, // 5 // DIGIT FIVE
|
||||
0x36, // 6 // DIGIT SIX
|
||||
0x37, // 7 // DIGIT SEVEN
|
||||
0x38, // 8 // DIGIT EIGHT
|
||||
0x39, // 9 // DIGIT NINE
|
||||
0x3a, // : // COLON
|
||||
0x3b, // ; // SEMICOLON
|
||||
0x3c, // < // LESS-THAN SIGN
|
||||
0x3d, // = // EQUALS SIGN
|
||||
0x3e, // > // GREATER-THAN SIGN
|
||||
0x3f, // ? // QUESTION MARK
|
||||
0x40, // @ // COMMERCIAL AT
|
||||
0x41, // A // LATIN CAPITAL LETTER A
|
||||
0x42, // B // LATIN CAPITAL LETTER B
|
||||
0x43, // C // LATIN CAPITAL LETTER C
|
||||
0x44, // D // LATIN CAPITAL LETTER D
|
||||
0x45, // E // LATIN CAPITAL LETTER E
|
||||
0x46, // F // LATIN CAPITAL LETTER F
|
||||
0x47, // G // LATIN CAPITAL LETTER G
|
||||
0x48, // H // LATIN CAPITAL LETTER H
|
||||
0x49, // I // LATIN CAPITAL LETTER I
|
||||
0x4a, // J // LATIN CAPITAL LETTER J
|
||||
0x4b, // K // LATIN CAPITAL LETTER K
|
||||
0x4c, // L // LATIN CAPITAL LETTER L
|
||||
0x4d, // M // LATIN CAPITAL LETTER M
|
||||
0x4e, // N // LATIN CAPITAL LETTER N
|
||||
0x4f, // O // LATIN CAPITAL LETTER O
|
||||
0x50, // P // LATIN CAPITAL LETTER P
|
||||
0x51, // Q // LATIN CAPITAL LETTER Q
|
||||
0x52, // R // LATIN CAPITAL LETTER R
|
||||
0x53, // S // LATIN CAPITAL LETTER S
|
||||
0x54, // T // LATIN CAPITAL LETTER T
|
||||
0x55, // U // LATIN CAPITAL LETTER U
|
||||
0x56, // V // LATIN CAPITAL LETTER V
|
||||
0x57, // W // LATIN CAPITAL LETTER W
|
||||
0x58, // X // LATIN CAPITAL LETTER X
|
||||
0x59, // Y // LATIN CAPITAL LETTER Y
|
||||
0x5a, // Z // LATIN CAPITAL LETTER Z
|
||||
0x5b, // [ // LEFT SQUARE BRACKET
|
||||
0x5c, // \ // REVERSE SOLIDUS
|
||||
0x5d, // ] // RIGHT SQUARE BRACKET
|
||||
0x5e, // ^ // CIRCUMFLEX ACCENT
|
||||
0x5f, // _ // LOW LINE
|
||||
0x60, // ` // GRAVE ACCENT
|
||||
0x61, // a // LATIN SMALL LETTER A
|
||||
0x62, // b // LATIN SMALL LETTER B
|
||||
0x63, // c // LATIN SMALL LETTER C
|
||||
0x64, // d // LATIN SMALL LETTER D
|
||||
0x65, // e // LATIN SMALL LETTER E
|
||||
0x66, // f // LATIN SMALL LETTER F
|
||||
0x67, // g // LATIN SMALL LETTER G
|
||||
0x68, // h // LATIN SMALL LETTER H
|
||||
0x69, // i // LATIN SMALL LETTER I
|
||||
0x6a, // j // LATIN SMALL LETTER J
|
||||
0x6b, // k // LATIN SMALL LETTER K
|
||||
0x6c, // l // LATIN SMALL LETTER L
|
||||
0x6d, // m // LATIN SMALL LETTER M
|
||||
0x6e, // n // LATIN SMALL LETTER N
|
||||
0x6f, // o // LATIN SMALL LETTER O
|
||||
0x70, // p // LATIN SMALL LETTER P
|
||||
0x71, // q // LATIN SMALL LETTER Q
|
||||
0x72, // r // LATIN SMALL LETTER R
|
||||
0x73, // s // LATIN SMALL LETTER S
|
||||
0x74, // t // LATIN SMALL LETTER T
|
||||
0x75, // u // LATIN SMALL LETTER U
|
||||
0x76, // v // LATIN SMALL LETTER V
|
||||
0x77, // w // LATIN SMALL LETTER W
|
||||
0x78, // x // LATIN SMALL LETTER X
|
||||
0x79, // y // LATIN SMALL LETTER Y
|
||||
0x7a, // z // LATIN SMALL LETTER Z
|
||||
0x7b, // { // LEFT CURLY BRACKET
|
||||
0x7c, // | // VERTICAL LINE
|
||||
0x7d, // } // RIGHT CURLY BRACKET
|
||||
0x7e, // ~ // TILDE
|
||||
|
||||
0xb0, // ° // DEGREE SIGN
|
||||
0xb1, // ± // PLUS OR MINUS
|
||||
0xb7, // · // MIDDLE DOT
|
||||
|
||||
0xc6, // Æ // LATIN CAPITAL LETTER AE
|
||||
0xd0, // Ð // LATIN CAPITAL LETTER ETH
|
||||
0xd7, // × // MULTIPLICATION SIGN
|
||||
0xd8, // Ø // LATIN CAPITAL LETTER O WITH STROKE
|
||||
0xde, // Þ // LATIN CAPITAL LETTER THORN
|
||||
0xdf, // ß // LATIN SMALL LETTER SHARP S
|
||||
0xe6, // æ // LATIN SMALL LETTER AE
|
||||
0xf0, // ð // LATIN SMALL LETTER ETH
|
||||
0xf7, // ÷ // DIVISION SIGN
|
||||
0xf8, // ø // LATIN SMALL LETTER O WITH STROKE
|
||||
0xfe, // þ // LATIN SMALL LETTER THORN
|
||||
|
||||
0x300, // ̀ // COMBINING GRAVE ACCENT
|
||||
0x301, // ́ // COMBINING ACUTE ACCENT
|
||||
0x302, // ̂ // COMBINING CIRCUMFLEX ACCENT
|
||||
0x303, // ̃ // COMBINING TILDE
|
||||
0x305, // ̅ // COMBINING OVERLINE
|
||||
0x308, // ̈ // COMBINING DIAERESIS
|
||||
0x30a, // ̊ // COMBINING RING ABOVE
|
||||
0x30b, // ˝// COMBINING DOUBLE ACUTE ACCENT
|
||||
0x327, // ̧ // COMBINING CEDILLA
|
||||
|
||||
0x391, // Α // GREEK CAPITAL LETTER ALPHA
|
||||
0x392, // Β // GREEK CAPITAL LETTER BETA
|
||||
0x393, // Γ // GREEK CAPITAL LETTER GAMMA
|
||||
0x394, // Δ // GREEK CAPITAL LETTER DELTA
|
||||
0x395, // Ε // GREEK CAPITAL LETTER EPSILON
|
||||
0x396, // Ζ // GREEK CAPITAL LETTER ZETA
|
||||
0x397, // Η // GREEK CAPITAL LETTER ETA
|
||||
0x398, // Θ // GREEK CAPITAL LETTER THETA
|
||||
0x399, // Ι // GREEK CAPITAL LETTER IOTA
|
||||
0x39a, // Κ // GREEK CAPITAL LETTER KAPPA
|
||||
0x39b, // Λ // GREEK CAPITAL LETTER LAMBDA
|
||||
0x39c, // Μ // GREEK CAPITAL LETTER MU
|
||||
0x39d, // Ν // GREEK CAPITAL LETTER NU
|
||||
0x39e, // Ξ // GREEK CAPITAL LETTER KSI
|
||||
0x39f, // Ο // GREEK CAPITAL LETTER OMICRON
|
||||
0x3a0, // Π // GREEK CAPITAL LETTER PI
|
||||
0x3a1, // Ρ // GREEK CAPITAL LETTER RHO
|
||||
0x3a3, // Σ // GREEK CAPITAL LETTER SIGMA
|
||||
0x3a4, // Τ // GREEK CAPITAL LETTER TAU
|
||||
0x3a5, // Υ // GREEK CAPITAL LETTER UPSILON
|
||||
0x3a6, // Φ // GREEK CAPITAL LETTER PHI
|
||||
0x3a7, // Χ // GREEK CAPITAL LETTER KHI
|
||||
0x3a8, // Ψ // GREEK CAPITAL LETTER PSI
|
||||
0x3a9, // Ω // GREEK CAPITAL LETTER OMEGA
|
||||
0x3b1, // α // GREEK SMALL LETTER ALPHA
|
||||
0x3b2, // β // GREEK SMALL LETTER BETA
|
||||
0x3b3, // γ // GREEK SMALL LETTER GAMMA
|
||||
0x3b4, // δ // GREEK SMALL LETTER DELTA
|
||||
0x3b5, // ε // GREEK SMALL LETTER EPSILON
|
||||
0x3b6, // ζ // GREEK SMALL LETTER ZETA
|
||||
0x3b7, // η // GREEK SMALL LETTER ETA
|
||||
0x3b8, // θ // GREEK SMALL LETTER THETA
|
||||
0x3b9, // ι // GREEK SMALL LETTER IOTA
|
||||
0x3ba, // κ // GREEK SMALL LETTER KAPPA
|
||||
0x3bb, // λ // GREEK SMALL LETTER LAMBDA
|
||||
0x3bc, // μ // GREEK SMALL LETTER MU
|
||||
0x3bd, // ν // GREEK SMALL LETTER NU
|
||||
0x3be, // ξ // GREEK SMALL LETTER KSI
|
||||
0x3bf, // ο // GREEK SMALL LETTER OMICRON
|
||||
0x3c0, // π // GREEK SMALL LETTER PI
|
||||
0x3c1, // ρ // GREEK SMALL LETTER RHO
|
||||
0x3c3, // σ // GREEK SMALL LETTER SIGMA
|
||||
0x3c4, // τ // GREEK SMALL LETTER TAU
|
||||
0x3c5, // υ // GREEK SMALL LETTER UPSILON
|
||||
0x3c6, // φ // GREEK SMALL LETTER PHI
|
||||
0x3c7, // χ // GREEK SMALL LETTER KHI
|
||||
0x3c8, // ψ // GREEK SMALL LETTER PSI
|
||||
0x3c9, // ω // GREEK SMALL LETTER OMEGA
|
||||
0x1d07, // ᴇ // LATIN LETTER SMALL CAPITAL E
|
||||
0x212f, // ℯ // SCRIPT SMALL E
|
||||
0x2190, // ← // BACKWARD ARROW (leftarrow)
|
||||
0x2191, // ↑ // TOP ARROW (uparrow)
|
||||
0x2192, // → // FORWARD ARROW (rightarrow)
|
||||
0x2193, // ↓ // BOTTOM ARROW (downarrow)
|
||||
0x2194, // ↔ // BACKWARD FORWARD ARROW (leftrightarrow)
|
||||
0x2195, // ↕ // TOP BOTTOM ARROW (updownarrow)
|
||||
0x21d0, // ⇐ // DOUBLE BACKWARD ARROW (Leftarrow)
|
||||
0x21d1, // ⇑ // DOUBLE TOP ARROW (Uparrow)
|
||||
0x21d2, // ⇒ // DOUBLE FORWARD ARROW (Rightarrow)
|
||||
0x21d3, // ⇓ // DOUBLE BOTTOM ARROW (Downarrow)
|
||||
0x2200, // ∀ // FORALL
|
||||
0x2202, // ∂ // PARTIAL
|
||||
0x2203, // ∃ // EXIST
|
||||
0x2211, // ∑ // N-ARY SUMMATION
|
||||
0x221a, // √ // SQUARE ROOT
|
||||
0x221e, // ∞ // INFINITY
|
||||
0x222b, // ∫ // INTEGRAL
|
||||
0x2248, // ≈ // ALMOST EQUAL TO
|
||||
0x2260, // ≠ // NOT EQUAL TO
|
||||
0x2261, // ≡ // IS CONGRUENT TO
|
||||
0x2264, // ≤ // LESS-THAN OR EQUAL TO
|
||||
0x2265, // ≥ // GREATER-THAN OR EQUAL TO
|
||||
0xFFFD, // <20> // REPLACEMENT CHARACTER
|
||||
0x1d422, // 𝐢 // MATHEMATICAL BOLD SMALL I"
|
||||
};
|
||||
|
||||
int NumberOfCodePoints = sizeof(CodePoints)/sizeof(CodePoints[0]);
|
||||
|
||||
#endif
|
||||
@@ -15,7 +15,11 @@
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
#ifdef ISBUILDINGFLASHER
|
||||
#include "code_points.h"
|
||||
#else
|
||||
#include "code_points_latex.h"
|
||||
#endif
|
||||
#include "../../ion/src/external/lz4/lz4hc.h"
|
||||
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ KDPoint KDContext::pushOrPullString(const char * text, KDPoint p, const KDFont *
|
||||
codePointPointer = decoder.stringPosition();
|
||||
if (codePoint == UCodePointLineFeed) {
|
||||
assert(position.y() < KDCOORDINATE_MAX - glyphSize.height());
|
||||
position = KDPoint(0, position.y() + glyphSize.height());
|
||||
position = KDPoint(p.x(), position.y() + glyphSize.height());
|
||||
codePoint = decoder.nextCodePoint();
|
||||
} else if (codePoint == UCodePointTabulation) {
|
||||
position = position.translatedBy(KDPoint(k_tabCharacterWidth * glyphSize.width(), 0));
|
||||
|
||||
@@ -26,6 +26,7 @@ poincare_src += $(addprefix poincare/src/,\
|
||||
right_square_bracket_layout.cpp \
|
||||
sequence_layout.cpp \
|
||||
sum_layout.cpp \
|
||||
vector_layout.cpp \
|
||||
vertical_offset_layout.cpp \
|
||||
)
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ class LayoutCursor final {
|
||||
friend class MatrixLayoutNode;
|
||||
friend class NthRootLayoutNode;
|
||||
friend class SequenceLayoutNode;
|
||||
friend class VectorLayoutNode;
|
||||
friend class VerticalOffsetLayoutNode;
|
||||
public:
|
||||
constexpr static KDCoordinate k_cursorWidth = 1;
|
||||
|
||||
@@ -40,6 +40,7 @@ public:
|
||||
RightParenthesisLayout,
|
||||
RightSquareBracketLayout,
|
||||
SumLayout,
|
||||
VectorLayout,
|
||||
VectorNormLayout,
|
||||
VerticalOffsetLayout
|
||||
};
|
||||
|
||||
53
poincare/include/poincare/vector_layout.h
Normal file
53
poincare/include/poincare/vector_layout.h
Normal file
@@ -0,0 +1,53 @@
|
||||
#ifndef POINCARE_VECTOR_LAYOUT_NODE_H
|
||||
#define POINCARE_VECTOR_LAYOUT_NODE_H
|
||||
|
||||
#include <poincare/layout.h>
|
||||
#include <poincare/layout_cursor.h>
|
||||
#include <poincare/serialization_helper.h>
|
||||
|
||||
namespace Poincare {
|
||||
|
||||
class VectorLayoutNode final : public LayoutNode {
|
||||
public:
|
||||
// Layout
|
||||
Type type() const override { return Type::VectorLayout; }
|
||||
|
||||
// SerializationHelperInterface
|
||||
int serialize(char * buffer, int bufferSize, Preferences::PrintFloatMode floatDisplayMode, int numberOfSignificantDigits) const override {
|
||||
return SerializationHelper::Prefix(this, buffer, bufferSize, floatDisplayMode, numberOfSignificantDigits, "vector", true, 0);
|
||||
}
|
||||
|
||||
virtual void moveCursorLeft(LayoutCursor * cursor, bool * shouldRecomputeLayout, bool forSelection = false);
|
||||
virtual void moveCursorRight(LayoutCursor * cursor, bool * shouldRecomputeLayout, bool forSelection = false);
|
||||
|
||||
// TreeNode
|
||||
size_t size() const override { return sizeof(VectorLayoutNode); }
|
||||
int numberOfChildren() const override { return 1; }
|
||||
#if POINCARE_TREE_LOG
|
||||
void logNodeName(std::ostream & stream) const override {
|
||||
stream << "VectorLayout";
|
||||
}
|
||||
#endif
|
||||
|
||||
constexpr static KDCoordinate k_arrowWidth = 5;
|
||||
constexpr static KDCoordinate k_arrowHeight = 9;
|
||||
protected:
|
||||
virtual KDSize computeSize();
|
||||
virtual KDCoordinate computeBaseline();
|
||||
virtual KDPoint positionOfChild(LayoutNode * child);
|
||||
private:
|
||||
virtual void render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart = nullptr, Layout * selectionEnd = nullptr, KDColor selectionColor = KDColorRed);
|
||||
constexpr static KDCoordinate k_sideMargin = 2;
|
||||
constexpr static KDCoordinate k_topMargin = 1;
|
||||
constexpr static KDCoordinate k_arrowLineHeight = 1; // k_arrowHeight - k_arrowLineHeight must be even
|
||||
};
|
||||
|
||||
class VectorLayout final : public Layout {
|
||||
public:
|
||||
static VectorLayout Builder(Layout child) { return TreeHandle::FixedArityBuilder<VectorLayout, VectorLayoutNode>({child}); }
|
||||
VectorLayout() = delete;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <poincare/right_square_bracket_layout.h>
|
||||
#include <poincare/square_bracket_layout.h>
|
||||
#include <poincare/sum_layout.h>
|
||||
#include <poincare/vector_layout.h>
|
||||
#include <poincare/vector_norm_layout.h>
|
||||
#include <poincare/vertical_offset_layout.h>
|
||||
|
||||
|
||||
@@ -52,11 +52,28 @@ Expression Equal::standardEquation(Context * context, Preferences::ComplexFormat
|
||||
Expression Equal::shallowReduce(ExpressionNode::ReductionContext reductionContext) {
|
||||
|
||||
Expression e = Equal::Builder(Subtraction::Builder(childAtIndex(0).clone(), childAtIndex(1).clone()).shallowReduce(reductionContext), Rational::Builder(0));
|
||||
if (e.childAtIndex(0).isIdenticalTo(e.childAtIndex(1))) {
|
||||
Expression leftSide = e.childAtIndex(0);
|
||||
if (leftSide.isIdenticalTo(e.childAtIndex(1))) {
|
||||
Expression result = Rational::Builder(1);
|
||||
replaceWithInPlace(result);
|
||||
return result;
|
||||
}
|
||||
if (leftSide.isUndefined()) {
|
||||
return leftSide;
|
||||
}
|
||||
if (leftSide.type() == ExpressionNode::Type::Multiplication) {
|
||||
Multiplication m = static_cast<Multiplication&>(leftSide);
|
||||
int i = 0;
|
||||
while (i < numberOfChildren()-1) {
|
||||
if (m.childAtIndex(i).nullStatus(reductionContext.context()) == ExpressionNode::NullStatus::NonNull) {
|
||||
m.removeChildAtIndexInPlace(i);
|
||||
}
|
||||
else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
|
||||
@@ -375,6 +375,7 @@ template VectorCross TreeHandle::FixedArityBuilder<VectorCross, VectorCrossNode>
|
||||
template VectorDot TreeHandle::FixedArityBuilder<VectorDot, VectorDotNode>(const Tuple &);
|
||||
template VectorNorm TreeHandle::FixedArityBuilder<VectorNorm, VectorNormNode>(const Tuple &);
|
||||
template VectorNormLayout TreeHandle::FixedArityBuilder<VectorNormLayout, VectorNormLayoutNode>(const Tuple &);
|
||||
template VectorLayout TreeHandle::FixedArityBuilder<VectorLayout, VectorLayoutNode>(const Tuple &);
|
||||
template MatrixLayout TreeHandle::NAryBuilder<MatrixLayout, MatrixLayoutNode>(const Tuple &);
|
||||
|
||||
}
|
||||
|
||||
78
poincare/src/vector_layout.cpp
Normal file
78
poincare/src/vector_layout.cpp
Normal file
@@ -0,0 +1,78 @@
|
||||
#include <poincare/vector_layout.h>
|
||||
|
||||
namespace Poincare
|
||||
{
|
||||
const uint8_t arrowMask[VectorLayoutNode::k_arrowHeight][VectorLayoutNode::k_arrowWidth] = {
|
||||
{0xff, 0xf7, 0xff, 0xff, 0xff},
|
||||
{0xf3, 0x2c, 0xd9, 0xff, 0xff},
|
||||
{0xff, 0x93, 0x46, 0xfb, 0xff},
|
||||
{0xff, 0xfb, 0x46, 0x93, 0xff},
|
||||
{0x13, 0x13, 0x13, 0x13, 0xf0},
|
||||
{0xff, 0xfb, 0x46, 0x93, 0xff},
|
||||
{0xff, 0x93, 0x46, 0xfb, 0xff},
|
||||
{0xf3, 0x2c, 0xd9, 0xff, 0xff},
|
||||
{0xff, 0xf7, 0xff, 0xff, 0xff}
|
||||
};
|
||||
void VectorLayoutNode::moveCursorLeft(LayoutCursor * cursor, bool * shouldRecomputeLayout, bool forSelection) {
|
||||
if (cursor->layoutNode() == childAtIndex(0)
|
||||
&& cursor->position() == LayoutCursor::Position::Left)
|
||||
{
|
||||
// Case: Left of the operand. Go Left of the brackets.
|
||||
cursor->setLayout(this);
|
||||
return;
|
||||
}
|
||||
assert(cursor->layoutNode() == this);
|
||||
if (cursor->position() == LayoutCursor::Position::Right) {
|
||||
// Case: Right of the brackets. Go Right of the operand.
|
||||
cursor->setLayout(childAtIndex(0));
|
||||
return;
|
||||
}
|
||||
assert(cursor->position() == LayoutCursor::Position::Left);
|
||||
// Case: Left of the brackets. Ask the parent.
|
||||
LayoutNode * parentNode = parent();
|
||||
if (parentNode != nullptr) {
|
||||
parentNode->moveCursorLeft(cursor, shouldRecomputeLayout);
|
||||
}
|
||||
}
|
||||
|
||||
void VectorLayoutNode::moveCursorRight(LayoutCursor * cursor, bool * shouldRecomputeLayout, bool forSelection) {
|
||||
if (cursor->layoutNode() == childAtIndex(0)
|
||||
&& cursor->position() == LayoutCursor::Position::Right)
|
||||
{
|
||||
// Case: Right of the operand. Go Right of the brackets.
|
||||
cursor->setLayout(this);
|
||||
return;
|
||||
}
|
||||
assert(cursor->layoutNode() == this);
|
||||
if (cursor->position() == LayoutCursor::Position::Left) {
|
||||
// Case: Left of the brackets. Go Left of the operand.
|
||||
cursor->setLayout(childAtIndex(0));
|
||||
return;
|
||||
}
|
||||
assert(cursor->position() == LayoutCursor::Position::Right);
|
||||
// Case: Right of the brackets. Ask the parent.
|
||||
LayoutNode * parentNode = parent();
|
||||
if (parentNode != nullptr) {
|
||||
parentNode->moveCursorRight(cursor, shouldRecomputeLayout);
|
||||
}
|
||||
}
|
||||
KDSize VectorLayoutNode::computeSize() {
|
||||
KDSize size = childAtIndex(0)->layoutSize();
|
||||
return KDSize(2 * k_sideMargin + size.width() + k_arrowWidth + k_sideMargin, k_topMargin + (k_arrowHeight+k_arrowLineHeight)/2 + size.height());
|
||||
}
|
||||
|
||||
KDCoordinate VectorLayoutNode::computeBaseline() {
|
||||
return childAtIndex(0)->baseline() + (k_arrowHeight+k_arrowLineHeight)/2 + k_arrowLineHeight + k_topMargin;
|
||||
}
|
||||
|
||||
KDPoint VectorLayoutNode::positionOfChild(LayoutNode * child) {
|
||||
assert(child == childAtIndex(0));
|
||||
return KDPoint(k_sideMargin * 2, k_topMargin + (k_arrowHeight+k_arrowLineHeight)/2 + k_arrowLineHeight);
|
||||
}
|
||||
void VectorLayoutNode::render(KDContext * ctx, KDPoint p, KDColor expressionColor, KDColor backgroundColor, Layout * selectionStart, Layout * selectionEnd, KDColor selectionColor) {
|
||||
KDColor workingBuffer[k_arrowWidth * k_arrowHeight];
|
||||
ctx->fillRect(KDRect(p.x() + k_sideMargin, p.y() + k_topMargin + (k_arrowHeight-k_arrowLineHeight)/2, 2 * k_sideMargin + childAtIndex(0)->layoutSize().width(), k_arrowLineHeight), expressionColor);
|
||||
ctx->blendRectWithMask(KDRect(p.x() + 2 * k_sideMargin + childAtIndex(0)->layoutSize().width(), p.y() + k_topMargin, k_arrowWidth, k_arrowHeight), expressionColor, (const uint8_t *)arrowMask, workingBuffer);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -154,6 +154,11 @@ port_src += $(addprefix python/port/,\
|
||||
mod/turtle/modturtle.cpp \
|
||||
mod/turtle/modturtle_table.c \
|
||||
mod/turtle/turtle.cpp \
|
||||
mphalport.c \
|
||||
)
|
||||
|
||||
ifeq ($(INCLUDE_ULAB), 1)
|
||||
port_src += $(addprefix python/port/,\
|
||||
mod/ulab/scipy/linalg/linalg.c \
|
||||
mod/ulab/scipy/optimize/optimize.c \
|
||||
mod/ulab/scipy/signal/signal.c \
|
||||
@@ -180,8 +185,8 @@ port_src += $(addprefix python/port/,\
|
||||
mod/ulab/user/user.c \
|
||||
mod/ulab/utils/utils.c \
|
||||
mod/ulab/ulab.c \
|
||||
mphalport.c \
|
||||
)
|
||||
endif
|
||||
|
||||
# Workarounds
|
||||
|
||||
|
||||
@@ -604,6 +604,7 @@ Q(username)
|
||||
Q(rename)
|
||||
Q(listdir)
|
||||
|
||||
#if defined(INCLUDE_ULAB)
|
||||
// ulab QSTRs
|
||||
Q(threshold)
|
||||
Q(edgeitems)
|
||||
@@ -721,3 +722,13 @@ Q(from_int16_buffer)
|
||||
Q(from_uint16_buffer)
|
||||
Q(from_int32_buffer)
|
||||
Q(from_uint32_buffer)
|
||||
#endif
|
||||
// sys QSTRs
|
||||
Q(sys)
|
||||
Q(info)
|
||||
Q(implementation)
|
||||
Q(byteorder)
|
||||
Q(exit)
|
||||
Q(modules)
|
||||
Q(print_exception)
|
||||
Q(version_info)
|
||||
|
||||
@@ -57,12 +57,11 @@ mp_obj_t modkandinsky_set_pixel(mp_obj_t x, mp_obj_t y, mp_obj_t input) {
|
||||
return mp_const_none;
|
||||
}
|
||||
|
||||
//TODO Use good colors
|
||||
mp_obj_t modkandinsky_draw_string(size_t n_args, const mp_obj_t * args) {
|
||||
const char * text = mp_obj_str_get_str(args[0]);
|
||||
KDPoint point(mp_obj_get_int(args[1]), mp_obj_get_int(args[2]));
|
||||
KDColor textColor = (n_args >= 4) ? MicroPython::Color::Parse(args[3]) : KDColorBlack;
|
||||
KDColor backgroundColor = (n_args >= 5) ? MicroPython::Color::Parse(args[4]) : KDColorWhite;
|
||||
KDColor textColor = (n_args >= 4) ? MicroPython::Color::Parse(args[3]) : Palette::PrimaryText;
|
||||
KDColor backgroundColor = (n_args >= 5) ? MicroPython::Color::Parse(args[4]) : Palette::HomeBackground;
|
||||
const KDFont * font = (n_args >= 6) ? ((mp_obj_is_true(args[5])) ? KDFont::SmallFont : KDFont::LargeFont) : KDFont::LargeFont;
|
||||
MicroPython::ExecutionEnvironment::currentExecutionEnvironment()->displaySandbox();
|
||||
KDIonContext::sharedContext()->drawString(text, point, font, textColor, backgroundColor);
|
||||
|
||||
@@ -34,13 +34,7 @@
|
||||
|
||||
// Determines, whether scipy is defined in ulab. The sub-modules and functions
|
||||
// of scipy have to be defined separately
|
||||
#ifndef ULAB_HAS_SCIPY
|
||||
#if defined(DEVICE_N0100)
|
||||
#define ULAB_HAS_SCIPY (0)
|
||||
#else
|
||||
#define ULAB_HAS_SCIPY (1)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// The maximum number of dimensions the firmware should be able to support
|
||||
// Possible values lie between 1, and 4, inclusive
|
||||
@@ -229,7 +223,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef NDARRAY_HAS_TOBYTES
|
||||
#define NDARRAY_HAS_TOBYTES (0)
|
||||
#define NDARRAY_HAS_TOBYTES (1)
|
||||
#endif
|
||||
|
||||
#ifndef NDARRAY_HAS_TRANSPOSE
|
||||
@@ -270,7 +264,7 @@
|
||||
|
||||
// frombuffer adds 600 bytes to the firmware
|
||||
#ifndef ULAB_NUMPY_HAS_FROMBUFFER
|
||||
#define ULAB_NUMPY_HAS_FROMBUFFER (0)
|
||||
#define ULAB_NUMPY_HAS_FROMBUFFER (1)
|
||||
#endif
|
||||
|
||||
// functions that create an array
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
#define MICROPY_PY_ASYNC_AWAIT (0)
|
||||
|
||||
// Whether to support bytearray object
|
||||
#define MICROPY_PY_BUILTINS_BYTEARRAY (0)
|
||||
#define MICROPY_PY_BUILTINS_BYTEARRAY (1)
|
||||
|
||||
// Whether to support frozenset object
|
||||
#define MICROPY_PY_BUILTINS_FROZENSET (1)
|
||||
@@ -97,7 +97,7 @@
|
||||
#define MICROPY_PY_STRUCT (0)
|
||||
|
||||
// Whether to provide "sys" module
|
||||
#define MICROPY_PY_SYS (0)
|
||||
#define MICROPY_PY_SYS (1)
|
||||
|
||||
// Whether to provide the "urandom" module
|
||||
#define MICROPY_PY_URANDOM (1)
|
||||
@@ -136,6 +136,19 @@ extern const struct _mp_obj_module_t modpyplot_module;
|
||||
extern const struct _mp_obj_module_t modtime_module;
|
||||
extern const struct _mp_obj_module_t modos_module;
|
||||
extern const struct _mp_obj_module_t modturtle_module;
|
||||
|
||||
#if !defined(INCLUDE_ULAB)
|
||||
|
||||
#define MICROPY_PORT_BUILTIN_MODULES \
|
||||
{ MP_ROM_QSTR(MP_QSTR_ion), MP_ROM_PTR(&modion_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_kandinsky), MP_ROM_PTR(&modkandinsky_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_matplotlib), MP_ROM_PTR(&modmatplotlib_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_matplotlib_dot_pyplot), MP_ROM_PTR(&modpyplot_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&modtime_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_os), MP_ROM_PTR(&modos_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_turtle), MP_ROM_PTR(&modturtle_module) }, \
|
||||
|
||||
#else
|
||||
extern const struct _mp_obj_module_t ulab_user_cmodule;
|
||||
|
||||
#define MICROPY_PORT_BUILTIN_MODULES \
|
||||
@@ -146,7 +159,10 @@ extern const struct _mp_obj_module_t ulab_user_cmodule;
|
||||
{ MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&modtime_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_os), MP_ROM_PTR(&modos_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_turtle), MP_ROM_PTR(&modturtle_module) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_ulab), MP_ROM_PTR(&ulab_user_cmodule) }, \
|
||||
{ MP_ROM_QSTR(MP_QSTR_ulab), MP_ROM_PTR(&ulab_user_cmodule) }, \
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Enable setjmp in debug mode. This is to avoid some optimizations done
|
||||
// specifically for x86_64 using inline assembly, which makes the debug binary
|
||||
|
||||
@@ -61,7 +61,9 @@ extern "C" {
|
||||
#include "mphalport.h"
|
||||
#include "mod/turtle/modturtle.h"
|
||||
#include "mod/matplotlib/pyplot/modpyplot.h"
|
||||
#if defined(INCLUDE_ULAB)
|
||||
#include "mod/ulab/ulab.h"
|
||||
#endif
|
||||
}
|
||||
|
||||
#include <escher/palette.h>
|
||||
|
||||
@@ -187,8 +187,8 @@ MP_DEFINE_CONST_FUN_OBJ_1(mp_sys_settrace_obj, mp_sys_settrace);
|
||||
STATIC const mp_rom_map_elem_t mp_module_sys_globals_table[] = {
|
||||
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_sys) },
|
||||
|
||||
{ MP_ROM_QSTR(MP_QSTR_path), MP_ROM_PTR(&MP_STATE_VM(mp_sys_path_obj)) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_argv), MP_ROM_PTR(&MP_STATE_VM(mp_sys_argv_obj)) },
|
||||
//{ MP_ROM_QSTR(MP_QSTR_path), MP_ROM_PTR(&MP_STATE_VM(mp_sys_path_obj)) },
|
||||
//{ MP_ROM_QSTR(MP_QSTR_argv), MP_ROM_PTR(&MP_STATE_VM(mp_sys_argv_obj)) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_version), MP_ROM_PTR(&version_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_version_info), MP_ROM_PTR(&mp_sys_version_info_obj) },
|
||||
{ MP_ROM_QSTR(MP_QSTR_implementation), MP_ROM_PTR(&mp_sys_implementation_obj) },
|
||||
|
||||
Reference in New Issue
Block a user