move tile symbols to document files
This commit is contained in:
parent
48450e1111
commit
4f28a77294
|
@ -1,4 +1,5 @@
|
|||
% chapitre: "Suites numériques"
|
||||
% symbole: "(u_n)"
|
||||
% bg: 0x83b9
|
||||
|
||||
% categorie: "Cours"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
% chapitre: "Nombres complexes"
|
||||
% symbole: "a+ib"
|
||||
% bg: 0x54bc
|
||||
|
||||
% page: "Hors catégorie"
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
% chapitre: "Limites"
|
||||
% symbole: "\lim_{x→+∞}"
|
||||
% bg: 0x65b9
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
% chapitre: "Dérivation"
|
||||
% symbole: "f'"
|
||||
% bg: 0x5637
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
% chapitre: "Exponentielle"
|
||||
% symbole: "e^x"
|
||||
% bg: 0x5673
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
% chapitre: "Logarithme népérien"
|
||||
% symbole: "ln(x)"
|
||||
% bg: 0x5730
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
% chapitre: "Trigonométrie"
|
||||
% symbole: "cos"
|
||||
% bg: 0xc72a
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
% chapitre: "Intégrale et primitive"
|
||||
% symbole: "\int{}dx"
|
||||
% bg: 0xf70a
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
% chapitre: "Géométrie dans l'espace"
|
||||
% symbole: "\vec{u}"
|
||||
% bg: 0xf52a
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
% chapitre: "Probabilités conditionnelles"
|
||||
% symbole: "P(A)"
|
||||
% bg: 0xf2ac
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
% chapitre: "Lois de probabilités"
|
||||
% symbole: "λ"
|
||||
% bg: 0xd2af
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
% chapitre: "Estimation"
|
||||
% symbole: "In"
|
||||
% bg: 0xe35a
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
% chapitre: "SPÉ - Arithmétique"
|
||||
% symbole: "≡[k]"
|
||||
% bg: 0xb2bf
|
||||
|
|
24
src/main.c
24
src/main.c
|
@ -1,6 +1,7 @@
|
|||
#include <gint/display.h>
|
||||
#include <gint/keyboard.h>
|
||||
#include <TeX/TeX.h>
|
||||
#include <TeX/env.h>
|
||||
#include "document.h"
|
||||
#include "reader.h"
|
||||
|
||||
|
@ -35,14 +36,8 @@ static struct source const files[] = { ENUM_FILES(INITIALIZE) };
|
|||
#define COUNT(NAME) +1
|
||||
static int file_count = 0 ENUM_FILES(COUNT);
|
||||
|
||||
// TODO: Incorporate chapter symbols into TeX files
|
||||
static char const *chapter_symbols[13] = {
|
||||
"Un", "Z", "lim", "f'", "e^x", "ln", "cos", "∫dx",
|
||||
"\\vec{u}", "P(A)", "λ", "In", "[k]",
|
||||
};
|
||||
|
||||
static void render_document_tile(struct document const *doc, int symbolid,
|
||||
int where, bool selected)
|
||||
static void render_document_tile(struct document const *doc, int where,
|
||||
bool selected)
|
||||
{
|
||||
int y = 87;
|
||||
int middle = DWIDTH / 2 + 67 * where + 6 * ((where > 0) - (where < 0));
|
||||
|
@ -53,9 +48,11 @@ static void render_document_tile(struct document const *doc, int symbolid,
|
|||
drect(middle-r, y-r, middle+r, y+r, color);
|
||||
if(selected)
|
||||
drect_border(middle-r-2, y-r-2, middle+r+2, y+r+2, C_NONE, 1, color);
|
||||
if(symbolid >= 0)
|
||||
dtext_opt(middle, y, C_WHITE, C_NONE, DTEXT_CENTER, DTEXT_MIDDLE,
|
||||
chapter_symbols[symbolid], -1);
|
||||
if(doc->symbol) {
|
||||
struct TeX_Env *env = TeX_parse(doc->symbol, false);
|
||||
TeX_draw(env, middle - env->width / 2, y - env->height / 2, C_WHITE);
|
||||
TeX_free(env);
|
||||
}
|
||||
}
|
||||
|
||||
void render_buttons(int x0, int y, int count, int selected, int color,
|
||||
|
@ -160,9 +157,8 @@ int main(void)
|
|||
for(int d = -2; d <= +2; d++) {
|
||||
if(c_document + d < 0 || c_document + d >= document_count)
|
||||
continue;
|
||||
render_document_tile(documents[c_document + d],
|
||||
(c_document + d <= 13) ? c_document + d : -1,
|
||||
d, !d && c_mode == C_DOCUMENT);
|
||||
render_document_tile(documents[c_document + d], d,
|
||||
!d && c_mode == C_DOCUMENT);
|
||||
}
|
||||
if(c_document > 2) {
|
||||
dtext_opt(20, 87, C_BLACK, C_NONE, DTEXT_CENTER, DTEXT_MIDDLE,
|
||||
|
|
Loading…
Reference in a new issue