Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b605b7a0eb | ||
|
|
583574a1c6 | ||
|
|
b0b80e3d1e | ||
|
|
e6e55fe0b9 | ||
|
|
e761b2b4d0 | ||
|
|
bd955b958d | ||
|
|
e937c7b2b0 | ||
|
|
ce50f26e68 | ||
|
|
6affdbaa31 | ||
|
|
a727bdc3a2 | ||
|
|
4b6bbcfdc5 | ||
|
|
04028becd6 | ||
|
|
a7643fc7c3 | ||
|
|
c70eac3644 | ||
|
|
6cc26b9651 | ||
|
|
fd779a3370 | ||
|
|
baa9603df2 | ||
|
|
dd92bc04a0 | ||
|
|
3528bc94ce | ||
|
|
4c069680fc | ||
|
|
733e35b808 | ||
|
|
933d29db40 | ||
|
|
3cebf33f13 | ||
|
|
6109de053d | ||
|
|
313cffba7c | ||
|
|
ef0de86e02 | ||
|
|
a73d55f4ca | ||
|
|
6b4d1d2c54 | ||
|
|
ab8dd4cce3 | ||
|
|
a0bfacaf29 | ||
|
|
43be710898 | ||
|
|
3423cba76d | ||
|
|
d3628b76f6 | ||
|
|
6062d3e497 | ||
|
|
da2df3f545 | ||
|
|
9935fdf8cc | ||
|
|
fe1dd9301f | ||
|
|
eca652de59 | ||
|
|
2b0e1eaaa7 | ||
|
|
15109142ef | ||
|
|
17a0cfd9e6 | ||
|
|
57e065fe21 | ||
|
|
5ad38eab2d | ||
|
|
3997d80e8c | ||
|
|
59e7570f1e | ||
|
|
924553d6c2 | ||
|
|
3432e0dc43 | ||
|
|
b16519392f | ||
|
|
054a29f02c | ||
|
|
6f6d19f24d | ||
|
|
8375209829 | ||
|
|
4dc8f300e7 | ||
|
|
237e86b0ae | ||
|
|
d0fd254595 | ||
|
|
cab9dc83ec | ||
|
|
fcec234417 | ||
|
|
799e104662 | ||
|
|
48373814bc | ||
|
|
685dd672e9 | ||
|
|
d116acad0f | ||
|
|
fa99f1e807 | ||
|
|
fed3ac3691 | ||
|
|
ee23f04dce | ||
|
|
09e5e7e76d | ||
|
|
458f4fb5eb | ||
|
|
26c1522717 | ||
|
|
7fbef85924 | ||
|
|
1a18c5976a | ||
|
|
137ccc885e | ||
|
|
a3a37e3883 | ||
|
|
ca99ca92ef | ||
|
|
bd6d5a2c41 | ||
|
|
307e3c05ac | ||
|
|
017d3565d3 | ||
|
|
0dc9ba9007 | ||
|
|
385449fd38 | ||
|
|
939593a1e6 | ||
|
|
ec7e8a4fdd | ||
|
|
7ccbf5cd97 | ||
|
|
456ca38212 | ||
|
|
724182c67a | ||
|
|
3b182f7ce1 | ||
|
|
a8f9bfaa7f | ||
|
|
3ee425cfe6 | ||
|
|
dc1d003cd8 | ||
|
|
7790878186 | ||
|
|
0aaed358ba | ||
|
|
f1cc5be451 | ||
|
|
541b8eb996 | ||
|
|
a609e0aa6f | ||
|
|
dad571002f | ||
|
|
635c968633 | ||
|
|
319fa9f3ae | ||
|
|
789db7cda5 | ||
|
|
d2961b8ede | ||
|
|
fe042b64f0 | ||
|
|
9ffd2fc193 | ||
|
|
762fa24b03 | ||
|
|
14ac4425c5 | ||
|
|
9e845cf24f | ||
|
|
26a0c56576 | ||
|
|
0f3d54e21c | ||
|
|
44ac49655c | ||
|
|
10de2aae33 | ||
|
|
844eba30b8 | ||
|
|
356c51e0b5 | ||
|
|
dbaea786b1 | ||
|
|
005e3f3678 | ||
|
|
4749d9ed58 | ||
|
|
36f4e141e4 | ||
|
|
7d90c2ef21 | ||
|
|
bf5b521ad8 | ||
|
|
00aa79b87f | ||
|
|
e18a03a483 | ||
|
|
d33c565cfc | ||
|
|
060f5dd2b5 | ||
|
|
14e5412141 | ||
|
|
0a83f2119e | ||
|
|
66192aa502 | ||
|
|
7ccea34efb | ||
|
|
e93fce8460 | ||
|
|
dd3568583e | ||
|
|
0e7c456744 | ||
|
|
8f6b9dbae0 | ||
|
|
d48d80d716 | ||
|
|
ca6bc03eb0 | ||
|
|
141f6c4ddb | ||
|
|
e65c28aa09 | ||
|
|
92533a51e4 | ||
|
|
a1d9b90359 | ||
|
|
03b3f11fc0 | ||
|
|
5ddfef619d | ||
|
|
a4f0f53ae8 | ||
|
|
e45d781564 | ||
|
|
2545f50ac6 | ||
|
|
3c863218e9 | ||
|
|
309fabaeb3 | ||
|
|
c7be7b47c1 | ||
|
|
37a325b87d | ||
|
|
2807d7d905 | ||
|
|
aa501b500a | ||
|
|
9fecd988b7 | ||
|
|
abc10abb20 | ||
|
|
207ece5282 | ||
|
|
f6b05f8dd2 | ||
|
|
c2d451b35b | ||
|
|
788c29ac66 | ||
|
|
cdbb586e4b | ||
|
|
50249ad05b | ||
|
|
90c1855e57 | ||
|
|
7bf40199d0 | ||
|
|
6c983c1d70 | ||
|
|
f9c12273e1 | ||
|
|
989f484068 | ||
|
|
13099703ac | ||
|
|
600c9dc177 | ||
|
|
6e5836684a | ||
|
|
0d0438f912 | ||
|
|
bac4a1d519 | ||
|
|
b8bfb7ff1c | ||
|
|
8408d63f84 | ||
|
|
29594aa1ef | ||
|
|
30e3bf7623 | ||
|
|
f3d543afe8 | ||
|
|
93d3f5b607 | ||
|
|
2bbbe943f7 | ||
|
|
566f2bee8e | ||
|
|
3bcf2c0998 | ||
|
|
42af5a6ad2 | ||
|
|
b191dbb6e2 | ||
|
|
e5c5bdd65a | ||
|
|
a21f90b858 | ||
|
|
39df1dffc8 | ||
|
|
bd610f9d93 | ||
|
|
4ea83c536a | ||
|
|
9fdbdbdd52 | ||
|
|
0c86daacf3 | ||
|
|
dd02f7fd3c | ||
|
|
6271db0d6f | ||
|
|
2d213f777d | ||
|
|
0bd92cf953 | ||
|
|
6b5ca2d431 | ||
|
|
7198ba453e | ||
|
|
cf1323ac8f | ||
|
|
e2303c3ab4 | ||
|
|
afc9674b0a | ||
|
|
3c4416ba10 | ||
|
|
7123b1b722 | ||
|
|
e52588ce9a | ||
|
|
9abbea9ab2 | ||
|
|
10c353dd17 | ||
|
|
2149352b69 | ||
|
|
ee1109eef6 | ||
|
|
9f1fe26998 | ||
|
|
306e25e79a | ||
|
|
6ae3f5853d | ||
|
|
c9a0eae23c | ||
|
|
7ec840260e | ||
|
|
0acdc75398 | ||
|
|
28788c067a | ||
|
|
82ed01d010 | ||
|
|
6cd88c56c6 | ||
|
|
bb96835b32 | ||
|
|
42b01535f1 | ||
|
|
d3430e4f6a | ||
|
|
d121f630ab | ||
|
|
615ddbe53d | ||
|
|
58914982bb | ||
|
|
868e359d25 | ||
|
|
830e990583 | ||
|
|
0afc5867d1 | ||
|
|
ac19ebafaf | ||
|
|
f7e09e709c | ||
|
|
b46306d1e3 | ||
|
|
cee04c12a4 | ||
|
|
4e2c52b4c9 | ||
|
|
cdd6c86d0c | ||
|
|
b0f844c1c7 | ||
|
|
15d89c91e1 | ||
|
|
113d8dafdc | ||
|
|
8e06d7a84c | ||
|
|
025557456c | ||
|
|
0f314013f2 | ||
|
|
458596eefc | ||
|
|
18e0db51c5 | ||
|
|
1c12568e0e | ||
|
|
6084ea547b | ||
|
|
b76c150489 | ||
|
|
75a1146475 | ||
|
|
b2ab5d05ae | ||
|
|
477339273d | ||
|
|
341b340683 | ||
|
|
3dea8b7233 | ||
|
|
df906829d9 | ||
|
|
b945252c5c | ||
|
|
7d2bd40c73 |
No files matched your search
+6
-1
@@ -1,3 +1,8 @@
|
||||
unpackaged_assets/**/*.ogg filter=lfs diff=lfs merge=lfs -text
|
||||
test-fixtures/audio/*.mp3 filter=lfs diff=lfs merge=lfs -text
|
||||
themes/catalog_*.kss whitespace=-blank-at-eof
|
||||
themes/catalog_*.css whitespace=-blank-at-eof
|
||||
design/lists-redesign/*.png filter=lfs diff=lfs merge=lfs -text
|
||||
design/sun-salutation/face-redesign/*.png filter=lfs diff=lfs merge=lfs -text
|
||||
design/sun-salutation/face-redesign/*.mp4 filter=lfs diff=lfs merge=lfs -text
|
||||
# Vendored three.js keeps its upstream formatting.
|
||||
site/static/assets/radio/three*.js -whitespace
|
||||
@@ -0,0 +1,47 @@
|
||||
name: Breeze build
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
profile:
|
||||
description: Quick compiles the Linux app. Full also runs the local tests.
|
||||
required: true
|
||||
type: choice
|
||||
options: [quick, full]
|
||||
default: quick
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
group: breeze-build-${{ gitea.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
name: Linux native
|
||||
if: gitea.ref == 'refs/heads/master'
|
||||
runs-on: build-native-breeze
|
||||
timeout-minutes: 60
|
||||
env:
|
||||
BREEZE_PROFILE: ${{ gitea.event_name == 'push' && 'quick' || inputs.profile }}
|
||||
steps:
|
||||
- name: Check out the current pushed commit from Build
|
||||
id: native
|
||||
env:
|
||||
BUILD_NATIVE_SOURCE_TOKEN: ${{ github.token }}
|
||||
run: /usr/local/libexec/gitea-native-build checkout
|
||||
- name: Fetch locked Ziran packages
|
||||
if: steps.native.outputs.current == 'true'
|
||||
run: /usr/local/libexec/gitea-native-build run sh scripts/packages.sh --locked
|
||||
- name: Build the desktop app
|
||||
if: steps.native.outputs.current == 'true'
|
||||
run: |
|
||||
/usr/local/libexec/gitea-native-build run bash -ec '
|
||||
make -j"$JOBS" PACKAGE_FLAGS=--locked native
|
||||
ccache --show-stats || true
|
||||
'
|
||||
- name: Run the retained local tests
|
||||
if: steps.native.outputs.current == 'true' && env.BREEZE_PROFILE == 'full'
|
||||
run: /usr/local/libexec/gitea-native-build run bash -ec 'make -j"$JOBS" PACKAGE_FLAGS=--locked test'
|
||||
@@ -0,0 +1,168 @@
|
||||
name: Cloudflare Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
concurrency:
|
||||
group: breeze-pages-${{ gitea.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
site:
|
||||
name: Build and verify the site
|
||||
if: gitea.event_name == 'pull_request' || gitea.ref == 'refs/heads/master'
|
||||
# Keep deployments on the same Build slot as its web artifact cache.
|
||||
runs-on: build-primary
|
||||
# A cold build bootstraps pinned Ziran and Emscripten before compiling WASM.
|
||||
timeout-minutes: 120
|
||||
env:
|
||||
SITE_ASSET_VERSION: ${{ gitea.sha }}
|
||||
steps:
|
||||
- name: Check out Breeze from Gitea
|
||||
uses: https://github.com/actions/checkout@v4
|
||||
env:
|
||||
GIT_LFS_SKIP_SMUDGE: '1'
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Fetch the website's audio from Gitea LFS
|
||||
run: sh site/fetch-meditation-audio.sh
|
||||
|
||||
- name: Check preinstalled Node.js 22
|
||||
id: node-check
|
||||
run: |
|
||||
if command -v node >/dev/null 2>&1 && node -v | grep -q '^v22\.'; then
|
||||
echo "Using preinstalled $(node -v)"
|
||||
echo "ready=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "ready=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Set up Node.js
|
||||
if: steps.node-check.outputs.ready != 'true'
|
||||
uses: https://github.com/actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Identify exact web build inputs
|
||||
id: web-inputs
|
||||
run: |
|
||||
key=$(sh site/web-build-key.sh)
|
||||
printf 'key=%s\n' "$key" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Restore the source-built web app
|
||||
id: web-restore
|
||||
uses: https://github.com/actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: build/dist/web
|
||||
key: breeze-web-${{ runner.os }}-${{ runner.arch }}-${{ steps.web-inputs.outputs.key }}
|
||||
|
||||
- name: Check the cached web build
|
||||
id: web-cache
|
||||
env:
|
||||
WEB_INPUT_KEY: ${{ steps.web-inputs.outputs.key }}
|
||||
run: |
|
||||
if sh site/web-build-receipt.sh verify build/dist/web "$WEB_INPUT_KEY" 2>/dev/null; then
|
||||
echo 'Reusing the verified web build for these inputs'
|
||||
echo 'ready=true' >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo 'Building the web app for these inputs'
|
||||
echo 'ready=false' >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Install site build dependencies
|
||||
run: USER="$(id -un)" .github/scripts/install-apt-packages.sh .github/apt/empty-packages.txt apt-utils gnupg ripgrep unzip zip zstd
|
||||
|
||||
- name: Install web build dependencies
|
||||
if: steps.web-cache.outputs.ready != 'true'
|
||||
run: USER="$(id -un)" .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt python3-pil
|
||||
|
||||
- name: Fetch locked Ziran packages
|
||||
if: steps.web-cache.outputs.ready != 'true'
|
||||
uses: ./.github/actions/ziran-packages
|
||||
|
||||
- name: Set up the pinned Emscripten SDK
|
||||
if: steps.web-cache.outputs.ready != 'true'
|
||||
uses: ./.github/actions/emscripten
|
||||
|
||||
- name: Build the web app from this revision
|
||||
if: steps.web-cache.outputs.ready != 'true'
|
||||
env:
|
||||
WEB_INPUT_KEY: ${{ steps.web-inputs.outputs.key }}
|
||||
run: |
|
||||
set -eu
|
||||
rm -f build/dist/web/index.html build/dist/web/index.js build/dist/web/index.wasm
|
||||
make -j2 PACKAGE_FLAGS=--locked WEB_CACHE_BUSTER="$WEB_INPUT_KEY" build/dist/web/index.html
|
||||
sh site/web-build-receipt.sh write build/dist/web "$WEB_INPUT_KEY"
|
||||
|
||||
- name: Verify the exact web app artifact
|
||||
env:
|
||||
WEB_INPUT_KEY: ${{ steps.web-inputs.outputs.key }}
|
||||
run: sh site/web-build-receipt.sh verify build/dist/web "$WEB_INPUT_KEY"
|
||||
|
||||
- name: Save the verified web build for the next deployment
|
||||
if: gitea.event_name != 'pull_request' && steps.web-cache.outputs.ready != 'true' && steps.web-restore.outputs.cache-hit != 'true'
|
||||
uses: https://github.com/actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830
|
||||
continue-on-error: true
|
||||
with:
|
||||
path: build/dist/web
|
||||
key: breeze-web-${{ runner.os }}-${{ runner.arch }}-${{ steps.web-inputs.outputs.key }}
|
||||
|
||||
- name: Fetch the pinned site icons from Gitea
|
||||
run: |
|
||||
set -eu
|
||||
kryon_dir="$PWD/build/site-kryon"
|
||||
sh site/fetch-kryon-icons.sh "$kryon_dir"
|
||||
printf 'KRYON_DIR=%s\n' "$kryon_dir" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Select the verified web app origin
|
||||
if: gitea.event_name != 'pull_request'
|
||||
run: |
|
||||
set -eu
|
||||
host=innerbreeze.org
|
||||
if ! sh site/check-account-origin.sh "$host"; then
|
||||
host=inbe.waozi.xyz
|
||||
sh site/check-account-origin.sh "$host"
|
||||
fi
|
||||
printf 'SITE_APP_HOST=%s\n' "$host" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Build site with the source-built web app and signed download repository
|
||||
env:
|
||||
APT_SIGNING_KEY: ${{ gitea.event_name != 'pull_request' && secrets.APT_SIGNING_KEY || '' }}
|
||||
run: SITE_WEB_DIR="$PWD/build/dist/web" sh site/build-production.sh
|
||||
|
||||
- name: Test website routes, assets and Telegram bridge
|
||||
run: |
|
||||
node tests/site_assets_test.mjs
|
||||
sh tests/site_web_build_test.sh
|
||||
# The APT fixture is designed to check package discovery without root.
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
runuser -u nobody -- sh tests/apt_repo_test.sh
|
||||
else
|
||||
sh tests/apt_repo_test.sh
|
||||
fi
|
||||
node tests/telegram_bridge_test.mjs
|
||||
|
||||
- name: Deploy current master to Cloudflare Pages
|
||||
if: gitea.event_name != 'pull_request'
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
WRANGLER_SEND_METRICS: 'false'
|
||||
REVISION: ${{ gitea.sha }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
test "$(git rev-parse HEAD)" = "$REVISION"
|
||||
test "$(git ls-remote origin refs/heads/master | cut -f1)" = "$REVISION"
|
||||
: "${CLOUDFLARE_API_TOKEN:?Missing Gitea Pages deployment token}"
|
||||
: "${CLOUDFLARE_ACCOUNT_ID:?Missing Gitea Pages account ID}"
|
||||
# Verify the public domain and the selected app origin before uploading.
|
||||
curl -fsS --max-time 25 https://innerbreeze.org/ -o /dev/null
|
||||
sh site/check-account-origin.sh "$SITE_APP_HOST"
|
||||
npm exec --yes [email protected] -- wrangler pages deploy build/site \
|
||||
--project-name=inbe --branch=master --commit-hash="$REVISION" --commit-dirty=false
|
||||
sh site/verify-deployment.sh "$REVISION"
|
||||
@@ -1 +1,7 @@
|
||||
python3-fonttools
|
||||
nasm
|
||||
# dav1d (the AVIF decoder) builds with Meson and Ninja.
|
||||
meson
|
||||
ninja-build
|
||||
# The app build decodes every guide narration clip with ffmpeg to check it.
|
||||
ffmpeg
|
||||
@@ -3,13 +3,9 @@ ca-certificates
|
||||
curl
|
||||
dpkg
|
||||
libcurl4-openssl-dev
|
||||
libdrm-dev
|
||||
libdrm2
|
||||
libegl1-mesa-dev
|
||||
libegl1
|
||||
libgbm-dev
|
||||
libgbm1
|
||||
libgles2-mesa-dev
|
||||
libgl1
|
||||
libgl1-mesa-dri
|
||||
libglvnd0
|
||||
@@ -27,3 +23,9 @@ rpm
|
||||
x11-utils
|
||||
xvfb
|
||||
zip
|
||||
nasm
|
||||
# dav1d (the AVIF decoder) builds with Meson and Ninja.
|
||||
meson
|
||||
ninja-build
|
||||
# The app build decodes every guide narration clip with ffmpeg to check it.
|
||||
ffmpeg
|
||||
@@ -1,4 +1,6 @@
|
||||
build-essential
|
||||
apt-utils
|
||||
gnupg
|
||||
ffmpeg
|
||||
ca-certificates
|
||||
desktop-file-utils
|
||||
@@ -26,3 +28,7 @@ sqlite3
|
||||
imagemagick
|
||||
|
||||
python3-cryptography
|
||||
nasm
|
||||
# dav1d (the AVIF decoder) builds with Meson and Ninja.
|
||||
meson
|
||||
ninja-build
|
||||
@@ -1,5 +1,8 @@
|
||||
build-essential
|
||||
cmake
|
||||
zlib1g-dev
|
||||
zip
|
||||
tcl
|
||||
python3-fonttools
|
||||
# The app build decodes every guide narration clip with ffmpeg to check it.
|
||||
ffmpeg
|
||||
@@ -1,7 +1,14 @@
|
||||
build-essential
|
||||
gcc-mingw-w64-x86-64-win32
|
||||
g++-mingw-w64-x86-64-win32
|
||||
zlib1g-dev
|
||||
libz-mingw-w64-dev
|
||||
zip
|
||||
nsis
|
||||
python3-fonttools
|
||||
nasm
|
||||
# dav1d (the AVIF decoder) builds with Meson and Ninja.
|
||||
meson
|
||||
ninja-build
|
||||
# The app build decodes every guide narration clip with ffmpeg to check it.
|
||||
ffmpeg
|
||||
@@ -9,3 +9,10 @@ assets/profile-pictures/flowers.png
|
||||
# Narration receipts the practice packages are built from
|
||||
design/tai-chi/narration-receipt.json
|
||||
design/tai-chi/narration-male-receipt.json
|
||||
design/astral-projection/bruce-narration-receipt.json
|
||||
# Exact digest-bound Arcade library artwork shipped for offline browsing.
|
||||
apps/bundled/arcade.games/3db3d137e3e15f7bada0cab75751f33d92005e3bc28dded7a1419b1f06e6a1e0.zx
|
||||
apps/bundled/arcade.games/83471e1e310ffbac2972bf5d85e7072da2812c6a3d7efb9d8beff7873ca973e1.zx
|
||||
apps/bundled/arcade.games/a2cdbe88ec6220d89b105e60d37b4c1e910506cfd7df5875e2e55a3021b4c366.zx
|
||||
# The Radio page's three.js runtime on the website.
|
||||
site/static/assets/radio/three.core.js
|
||||
@@ -1,47 +0,0 @@
|
||||
# The Test job's machine for `make release-ready`: the runner's Ubuntu, the
|
||||
# packages CI installs for native/browser tests, its pinned SDK, and Node 22.
|
||||
# Build context: .github (scripts/release-ready.sh builds and tags it).
|
||||
FROM docker.io/library/ubuntu:24.04
|
||||
|
||||
ARG NODE_VERSION=22.12.0
|
||||
ARG GO_VERSION=1.24.4
|
||||
|
||||
COPY apt/test-packages.txt /tmp/test-packages.txt
|
||||
COPY apt/web-packages.txt /tmp/web-packages.txt
|
||||
COPY emscripten-version /tmp/emscripten-version
|
||||
|
||||
# The hosted runner also ships git, Git LFS, curl, cmake, zip, jq, OpenSSL's
|
||||
# headers, libsodium, D-Bus, Java 21, Go and the Android SDK
|
||||
# (scripts/release-ready.sh mounts this machine's).
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
git git-lfs python3 curl xz-utils make cmake zip unzip jq file libssl-dev \
|
||||
libsodium23 dbus openjdk-21-jdk-headless \
|
||||
libgtk-3-0t64 libasound2t64 libdbus-glib-1-2 libxt6t64 libxtst6 libpci3 \
|
||||
$(grep -v '^#' /tmp/test-packages.txt /tmp/web-packages.txt | cut -d: -f2- | sort -u | tr '\n' ' ') \
|
||||
&& curl -fsSL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /tmp/chrome.deb \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends /tmp/chrome.deb \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/test-packages.txt /tmp/web-packages.txt /tmp/chrome.deb
|
||||
|
||||
RUN curl -fsSL "https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.xz" \
|
||||
| tar -xJ -C /usr/local --strip-components=1 \
|
||||
&& node --version
|
||||
|
||||
RUN mkdir -p /opt/emsdk /opt/firefox \
|
||||
&& curl -fsSL https://github.com/emscripten-core/emsdk/archive/refs/heads/main.tar.gz \
|
||||
| tar -xz -C /opt/emsdk --strip-components=1
|
||||
RUN /opt/emsdk/emsdk install "$(cat /tmp/emscripten-version)" \
|
||||
&& /opt/emsdk/emsdk activate "$(cat /tmp/emscripten-version)" \
|
||||
&& /opt/emsdk/upstream/emscripten/embuilder build zlib \
|
||||
&& chmod -R a+rwX /opt/emsdk/upstream/emscripten/cache \
|
||||
&& rm /tmp/emscripten-version
|
||||
RUN curl -fsSL 'https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US' \
|
||||
| tar -xJ -C /opt/firefox --strip-components=1 \
|
||||
&& ln -s /opt/firefox/firefox /usr/local/bin/firefox
|
||||
|
||||
ENV PATH=/opt/emsdk/upstream/emscripten:/usr/local/go/bin:/usr/local/bin:/usr/bin:/bin
|
||||
ENV EM_CONFIG=/opt/emsdk/.emscripten
|
||||
|
||||
RUN curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar -xz -C /usr/local \
|
||||
&& ln -s /usr/local/go/bin/go /usr/local/bin/go \
|
||||
&& go version
|
||||
@@ -0,0 +1 @@
|
||||
docker.io/library/ubuntu@sha256:fe81560990fae86dc4743202b2cb4d3df98d0bcf949173cecef15ce1127ef852
|
||||
@@ -12,18 +12,18 @@ python3 -c "$RELEASE_READY_SNAPSHOT" "$server" "$commit"
|
||||
expected=$(git -c safe.directory="$server" -C "$server" rev-parse HEAD:vendor/liboqs)
|
||||
actual=$(git -c safe.directory="$server/vendor/liboqs" -C "$server/vendor/liboqs" rev-parse HEAD)
|
||||
if [ "$expected" != "$actual" ]; then
|
||||
echo "release-ready: canonical Daochi's liboqs must match the CI pin" >&2
|
||||
echo "release-ready: canonical Mesh's liboqs must match the CI pin" >&2
|
||||
exit 2
|
||||
fi
|
||||
if [ -n "$(git -c safe.directory="$server/vendor/liboqs" -C "$server/vendor/liboqs" status --porcelain --untracked-files=all)" ]; then
|
||||
echo "release-ready: canonical Daochi's liboqs must be pristine" >&2
|
||||
echo "release-ready: canonical Mesh's liboqs must be pristine" >&2
|
||||
exit 2
|
||||
fi
|
||||
# Emscripten's PATH entry holds a cmake directory, which make's own command
|
||||
# lookup would try to run instead of the cmake program. The server generates
|
||||
# its Go with Ziran, Breeze's own toolchain.
|
||||
make /src/build/ziran-toolchain/bin/zi2c
|
||||
make -C "$server" BUILD_DIR=/src/build/sync-test-server CMAKE="$(command -v cmake)" \
|
||||
ZIRAN=/src/build/ziran-toolchain/bin/ziran build
|
||||
DAOCHI_BIN="$server/daochi" make sync-server-test
|
||||
make /src/build/packages/ziran/build/bin/zi2c
|
||||
make -C "$server" BUILD_DIR="$server/build" CMAKE="$(command -v cmake)" \
|
||||
ZIRAN=/src/build/packages/ziran/build/bin/ziran build
|
||||
MESH_BIN="$server/mesh" make sync-server-test
|
||||
git -c safe.directory="$server" -C "$server" diff --exit-code "$commit" -- .
|
||||
@@ -0,0 +1,64 @@
|
||||
# The Test job's machine for `make release-ready`: the runner's Ubuntu, the
|
||||
# packages CI installs for native/browser tests, its pinned SDK and Bun.
|
||||
# scripts/release-ready.sh has Harmony's container service run this recipe as
|
||||
# root on the pinned base image (.github/local-ci/base-image), with the
|
||||
# candidate's .github folder at /run/harmony-container/context.tar, and commit
|
||||
# the result with these settings:
|
||||
# EM_NODE_JS=/usr/local/bin/bun EMSDK_NODE=/usr/local/bin/bun
|
||||
# EM_CONFIG=/opt/emsdk/.emscripten
|
||||
# PATH=/opt/emsdk/upstream/emscripten:/usr/local/go/bin:/usr/local/bin:/usr/bin:/bin
|
||||
set -eu
|
||||
BUN_VERSION=1.4.2
|
||||
BUN_SHA256=36368faef7527875d5ffa52e53cd48021741f2a83eb6208a8dd64068d422a913
|
||||
GO_VERSION=1.24.4
|
||||
|
||||
context=/tmp/inbe-ci-context
|
||||
mkdir -p "$context"
|
||||
tar -xf /run/harmony-container/context.tar -C "$context"
|
||||
|
||||
# The hosted runner also ships git, Git LFS, curl, cmake, zip, jq, OpenSSL's
|
||||
# headers, libsodium, D-Bus, Java 21, Go and the Android SDK
|
||||
# (scripts/release-ready.sh mounts this machine's).
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
apt-get update
|
||||
# shellcheck disable=SC2046
|
||||
apt-get install -y --no-install-recommends \
|
||||
git git-lfs python3 curl xz-utils make cmake zip unzip jq file libssl-dev \
|
||||
libsodium23 dbus openjdk-21-jdk-headless \
|
||||
libgtk-3-0t64 libasound2t64 libdbus-glib-1-2 libxt6t64 libxtst6 libpci3 \
|
||||
$(grep -hv '^#' "$context/apt/test-packages.txt" "$context/apt/web-packages.txt" \
|
||||
"$context/apt/windows-packages.txt" | cut -d: -f2- | sort -u | tr '\n' ' ')
|
||||
if [ -x /usr/bin/x86_64-w64-mingw32-gcc-win32 ]; then
|
||||
update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-win32
|
||||
fi
|
||||
curl -fsSL https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -o /tmp/chrome.deb
|
||||
apt-get install -y --no-install-recommends /tmp/chrome.deb
|
||||
rm -rf /var/lib/apt/lists/* /tmp/chrome.deb
|
||||
|
||||
# Bun only: nothing in the image executes Node, including the SDK's cache bootstrap.
|
||||
mkdir -p /opt/js-runtime
|
||||
curl -fsSL "https://github.com/oven-sh/bun/releases/download/bun-v${BUN_VERSION}/bun-linux-x64.zip" \
|
||||
-o /opt/js-runtime/bun.zip
|
||||
printf '%s %s\n' "$BUN_SHA256" /opt/js-runtime/bun.zip | sha256sum -c -
|
||||
unzip -q /opt/js-runtime/bun.zip -d /opt/js-runtime
|
||||
mv /opt/js-runtime/bun-linux-x64/bun /usr/local/bin/bun
|
||||
rm -rf /opt/js-runtime/bun.zip /opt/js-runtime/bun-linux-x64
|
||||
bun --version
|
||||
export EM_NODE_JS=/usr/local/bin/bun EMSDK_NODE=/usr/local/bin/bun
|
||||
|
||||
mkdir -p /opt/emsdk /opt/firefox
|
||||
curl -fsSL https://github.com/emscripten-core/emsdk/archive/refs/heads/main.tar.gz \
|
||||
| tar -xz -C /opt/emsdk --strip-components=1
|
||||
emscripten=$(cat "$context/emscripten-version")
|
||||
/opt/emsdk/emsdk install "$emscripten"
|
||||
/opt/emsdk/emsdk activate "$emscripten"
|
||||
/opt/emsdk/upstream/emscripten/embuilder build zlib
|
||||
chmod -R a+rwX /opt/emsdk/upstream/emscripten/cache
|
||||
curl -fsSL 'https://download.mozilla.org/?product=firefox-latest&os=linux64&lang=en-US' \
|
||||
| tar -xJ -C /opt/firefox --strip-components=1
|
||||
ln -s /opt/firefox/firefox /usr/local/bin/firefox
|
||||
|
||||
curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz" | tar -xz -C /usr/local
|
||||
ln -s /usr/local/go/bin/go /usr/local/bin/go
|
||||
/usr/local/go/bin/go version
|
||||
rm -rf "$context"
|
||||
@@ -14,6 +14,26 @@ if [ ! -f "$package_file" ]; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
mapfile -t raw_packages < "$package_file"
|
||||
packages=()
|
||||
for package in "${raw_packages[@]}" "$@"; do
|
||||
if [ -z "$package" ] || [[ "$package" == \#* ]]; then
|
||||
continue
|
||||
fi
|
||||
packages+=("$package")
|
||||
done
|
||||
|
||||
missing=()
|
||||
for package in "${packages[@]}"; do
|
||||
if ! dpkg-query -W -f='${Status}\n' "$package" 2>/dev/null | grep -qx 'install ok installed'; then
|
||||
missing+=("$package")
|
||||
fi
|
||||
done
|
||||
if [ "${#missing[@]}" -eq 0 ]; then
|
||||
echo "All ${#packages[@]} requested apt packages are already installed; skipping apt-get."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
APT_CACHE_DIR="${APT_CACHE_DIR:-/tmp/apt-cache}"
|
||||
apt_arch="$(dpkg --print-architecture)"
|
||||
ubuntu_archive="https://archive.ubuntu.com/ubuntu"
|
||||
@@ -52,15 +72,6 @@ Components: main restricted universe multiverse
|
||||
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
|
||||
EOF
|
||||
|
||||
mapfile -t raw_packages < "$package_file"
|
||||
packages=()
|
||||
for package in "${raw_packages[@]}" "$@"; do
|
||||
if [ -z "$package" ] || [[ "$package" == \#* ]]; then
|
||||
continue
|
||||
fi
|
||||
packages+=("$package")
|
||||
done
|
||||
|
||||
mkdir -p "$APT_CACHE_DIR/partial"
|
||||
sudo rm -rf /var/lib/apt/lists/*
|
||||
sudo apt-get \
|
||||
@@ -68,12 +79,12 @@ sudo apt-get \
|
||||
-o Acquire::http::Timeout=20 \
|
||||
-o Acquire::https::Timeout=20 \
|
||||
update
|
||||
if [ "${#packages[@]}" -gt 0 ]; then
|
||||
if [ "${#missing[@]}" -gt 0 ]; then
|
||||
sudo apt-get \
|
||||
-o Acquire::Retries=3 \
|
||||
-o Acquire::http::Timeout=20 \
|
||||
-o Acquire::https::Timeout=20 \
|
||||
-o Dir::Cache::archives="$APT_CACHE_DIR" \
|
||||
install -y "${packages[@]}"
|
||||
install -y "${missing[@]}"
|
||||
fi
|
||||
sudo chown -R "$USER:$USER" "$APT_CACHE_DIR"
|
||||
@@ -1 +1 @@
|
||||
c692ab12f21e5bf1c5901363bcd9b449b55efd2f
|
||||
35159302be6f9011c3934636c6c200eec785ff5b
|
||||
@@ -93,6 +93,10 @@ jobs:
|
||||
timeout-minutes: 20
|
||||
run: python3 .github/scripts/install-android-sdk.py
|
||||
|
||||
- name: Install Android build dependencies
|
||||
timeout-minutes: 15
|
||||
run: .github/scripts/install-apt-packages.sh .github/apt/android-packages.txt
|
||||
|
||||
- name: Prepare Android signing key
|
||||
env:
|
||||
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
|
||||
@@ -102,11 +106,6 @@ jobs:
|
||||
mkdir -p ~/.android
|
||||
printf '%s' "$KEYSTORE_BASE64" | base64 -d > ~/.android/inbe-release.keystore
|
||||
|
||||
- name: Prepare Firebase config
|
||||
env:
|
||||
GOOGLE_SERVICES_JSON_BASE64: ${{ secrets.GOOGLE_SERVICES_JSON_BASE64 }}
|
||||
run: ./scripts/write-google-services-json.sh
|
||||
|
||||
- name: Copy Android assets
|
||||
run: ./scripts/copy-android-assets.sh
|
||||
|
||||
@@ -117,6 +116,18 @@ jobs:
|
||||
SOURCE_COMMIT: ${{ inputs.source_commit }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 - <<'PY'
|
||||
import importlib.util
|
||||
import os
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
spec = importlib.util.spec_from_file_location('phone_check', 'scripts/phone-check.py')
|
||||
check = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(check)
|
||||
revision = os.environ['SOURCE_COMMIT']
|
||||
assert subprocess.check_output(['git', 'rev-parse', 'HEAD'], text=True).strip() == revision
|
||||
assert check.app_tree(Path.cwd()) == check.app_tree(Path.cwd(), revision), 'App source differs from candidate'
|
||||
PY
|
||||
./droid/gradlew -p droid assembleRelease \
|
||||
-Papp.onlyAbi=armeabi-v7a \
|
||||
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
|
||||
@@ -132,6 +143,26 @@ jobs:
|
||||
cd build/release/moto
|
||||
sha256sum "inbe-$VERSION-moto.apk" > "inbe-$VERSION-moto.apk.sha256"
|
||||
)
|
||||
python3 - <<'PY'
|
||||
import hashlib
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
spec = importlib.util.spec_from_file_location('phone_check', 'scripts/phone-check.py')
|
||||
check = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(check)
|
||||
root = Path.cwd()
|
||||
revision = os.environ['SOURCE_COMMIT']
|
||||
content = check.app_tree(root, revision)
|
||||
assert check.app_tree(root) == content, 'App source changed during build'
|
||||
apk = next(Path('build/release/moto').glob('inbe-*-moto.apk'))
|
||||
receipt = dict(schema=1, status='passed', source_commit=revision, app_tree=content,
|
||||
apk=dict(sha256=hashlib.sha256(apk.read_bytes()).hexdigest(), **check.apk_identity(apk)),
|
||||
workflow_run=os.environ['GITHUB_SERVER_URL'] + '/' + os.environ['GITHUB_REPOSITORY'] +
|
||||
'/actions/runs/' + os.environ['GITHUB_RUN_ID'])
|
||||
(apk.parent / 'build-receipt.json').write_text(json.dumps(receipt, indent=2) + '\n')
|
||||
PY
|
||||
|
||||
- name: Remove signing key
|
||||
if: always()
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
name: Sign bundled Arcade content
|
||||
|
||||
# The established publisher key is currently held only by this repository's
|
||||
# GitHub secret. This manual repair signs the checked-in catalog's immutable
|
||||
# content descriptors and exports them; it never publishes an app release.
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
catalog_sha256:
|
||||
description: Exact SHA-256 of the bundled Arcade catalog being repaired
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
sign:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
|
||||
- name: Load the pinned Apps release API
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
from hashlib import sha256
|
||||
import json
|
||||
from pathlib import Path
|
||||
import urllib.request
|
||||
package = next(p for p in json.loads(Path('ziran.lock').read_text())['packages'] if p['name'].lower() == 'apps')
|
||||
if package['url'] != 'https://git.waozi.xyz/waozi/apps.git' or package['commit'] != 'c18e70b434456823a5d332255d78b48064f12de3':
|
||||
raise SystemExit('Review the changed Apps pin before signing content')
|
||||
url = 'https://git.waozi.xyz/waozi/apps/raw/commit/' + package['commit'] + '/scripts/node_release.py'
|
||||
request = urllib.request.Request(url, headers={'User-Agent': 'Breeze-content-signing/1'})
|
||||
with urllib.request.urlopen(request, timeout=30) as response:
|
||||
source = response.read(1048577)
|
||||
if sha256(source).hexdigest() != '6b02a862edcd0d1f966cf168f762a6e91dcb3eaae4bacd555c096ad25ceebffe':
|
||||
raise SystemExit('Pinned Apps release API bytes differ')
|
||||
path = Path('build/content-signing-api/node_release.py')
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_bytes(source)
|
||||
PY
|
||||
- name: Install signature library
|
||||
run: python3 -m pip install cryptography
|
||||
- name: Test content signing
|
||||
env:
|
||||
APPS_RELEASE_API: build/content-signing-api/node_release.py
|
||||
run: python3 tests/arcade_content_sign_test.py
|
||||
- name: Sign only the requested catalog's content
|
||||
env:
|
||||
INBE_PACKAGE_SIGNING_KEY: ${{ secrets.INBE_PACKAGE_SIGNING_KEY }}
|
||||
KEY_ID: ${{ vars.INBE_PACKAGE_KEY_ID }}
|
||||
CATALOG_SHA256: ${{ inputs.catalog_sha256 }}
|
||||
run: |
|
||||
python3 scripts/sign-arcade-content.py --catalog-sha256 "$CATALOG_SHA256" \
|
||||
--key-id "$KEY_ID" --release-api build/content-signing-api/node_release.py \
|
||||
--output build/arcade-content-signatures
|
||||
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: arcade-content-signatures
|
||||
path: build/arcade-content-signatures/*.zx.release-v2.json
|
||||
if-no-files-found: error
|
||||
retention-days: 30
|
||||
@@ -58,6 +58,18 @@ jobs:
|
||||
fi
|
||||
python3 scripts/check-file-size.py --since "$base"
|
||||
|
||||
google-free:
|
||||
name: Google libraries only in the gplay edition
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
# The normal and F-Droid builds read no Google library or plugin; only
|
||||
# gplay-scoped configurations and gplay files may name one.
|
||||
- name: Keep Google libraries out of the normal and F-Droid build files
|
||||
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
|
||||
|
||||
guard-package-urls:
|
||||
name: Package URLs are public HTTPS
|
||||
runs-on: ubuntu-latest
|
||||
@@ -142,7 +154,7 @@ jobs:
|
||||
if: matrix.shard == 0
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: kryonlabs/daochi
|
||||
repository: ziranlang/mesh
|
||||
# Includes signed photo copies (blobs) and the private Lumi
|
||||
# collection used for shared account activity.
|
||||
ref: ${{ steps.sync-test-server.outputs.revision }}
|
||||
@@ -160,9 +172,9 @@ jobs:
|
||||
if: matrix.shard == 0
|
||||
run: |
|
||||
# The server generates its Go with Ziran, Breeze's own toolchain.
|
||||
make "$GITHUB_WORKSPACE/build/ziran-toolchain/bin/zi2c"
|
||||
make -C .test-server build ZIRAN="$GITHUB_WORKSPACE/build/ziran-toolchain/bin/ziran"
|
||||
make sync-server-test DAOCHI_BIN="$GITHUB_WORKSPACE/.test-server/daochi"
|
||||
make "$GITHUB_WORKSPACE/build/packages/ziran/build/bin/zi2c"
|
||||
make -C .test-server build ZIRAN="$GITHUB_WORKSPACE/build/packages/ziran/build/bin/ziran"
|
||||
make sync-server-test MESH_BIN="$GITHUB_WORKSPACE/.test-server/mesh"
|
||||
|
||||
browser-addons:
|
||||
# Builds the web app once, packages it for Chrome and Firefox, and runs
|
||||
@@ -201,7 +213,7 @@ jobs:
|
||||
|
||||
- name: Install Web Dependencies
|
||||
timeout-minutes: 15
|
||||
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt
|
||||
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt python3-pil
|
||||
|
||||
- name: Set up Emscripten
|
||||
uses: ./.github/actions/emscripten
|
||||
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
- name: Install recipe dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends build-essential jimsh libssl-dev python3-fonttools openjdk-21-jdk-headless fdroidserver git-lfs
|
||||
apt-get install -y --no-install-recommends build-essential jimsh libssl-dev meson nasm ninja-build python3-fonttools ffmpeg openjdk-21-jdk-headless fdroidserver git-lfs
|
||||
update-alternatives --set java /usr/lib/jvm/java-21-openjdk-amd64/bin/java
|
||||
|
||||
- name: Checkout candidate
|
||||
@@ -65,6 +65,14 @@ jobs:
|
||||
- name: Build and scan with F-Droid without cached package sources
|
||||
run: python3 build/xyz.waozi.inbe/scripts/check-fdroid.py
|
||||
|
||||
# F-Droid's scanner checked the source; its APK must hold no Google
|
||||
# library either.
|
||||
- name: Keep Google libraries out of F-Droid's APK
|
||||
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
|
||||
with:
|
||||
packages: tmp/*.apk
|
||||
source: ''
|
||||
|
||||
- name: Preserve APK, exact metadata and scanner evidence
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import hashlib, json, os, re, subprocess, urllib.request
|
||||
import hashlib, json, os, re, subprocess, time, urllib.error, urllib.request
|
||||
def gh(*args):
|
||||
return subprocess.check_output(['gh', *args], text=True).strip()
|
||||
def number(version):
|
||||
@@ -44,11 +44,25 @@ jobs:
|
||||
tags = [item['tagName'] for item in releases if not item['isDraft'] and
|
||||
re.fullmatch(r'node-arcade-\d+\.\d+\.\d+', item['tagName'])]
|
||||
tag = max(tags, key=lambda name: number(name.removeprefix('node-arcade-')))
|
||||
request = urllib.request.Request(
|
||||
'https://api.waozi.xyz/api/v2/packages/inbe.arcade/latest?bucket=0&format=zx',
|
||||
headers={'User-Agent': 'Inbe-Publisher/1.0', 'Cache-Control': 'no-cache'})
|
||||
with urllib.request.urlopen(request, timeout=60) as response:
|
||||
live = json.load(response)['version']
|
||||
def latest():
|
||||
# Cloudflare answers 52x while it briefly cannot reach the node;
|
||||
# retry those for a few minutes before calling the node down.
|
||||
request = urllib.request.Request(
|
||||
os.environ.get('NODE_LATEST_URL', 'https://api.waozi.xyz/api/v2/packages/inbe.arcade/latest?bucket=0&format=zx'),
|
||||
headers={'User-Agent': 'Inbe-Publisher/1.0', 'Cache-Control': 'no-cache'})
|
||||
waits = [int(wait) for wait in os.environ.get('NODE_RETRY_WAITS', '15 30 60 90').split()]
|
||||
for attempt in range(len(waits) + 1):
|
||||
try:
|
||||
with urllib.request.urlopen(request, timeout=30) as response:
|
||||
return json.load(response)['version']
|
||||
except (urllib.error.URLError, TimeoutError, ConnectionError) as error:
|
||||
if isinstance(error, urllib.error.HTTPError) and error.code < 500:
|
||||
raise
|
||||
if attempt == len(waits):
|
||||
raise
|
||||
print(f'The node did not answer ({error}); retrying in {waits[attempt]}s.')
|
||||
time.sleep(waits[attempt])
|
||||
live = latest()
|
||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as output:
|
||||
if number(tag.removeprefix('node-arcade-')) <= number(live):
|
||||
print(f'The node already serves Arcade {live}; newest release is {tag}.')
|
||||
|
||||
@@ -31,6 +31,14 @@ on:
|
||||
description: SHA-256 of the checked bundle; any other bytes are refused
|
||||
required: true
|
||||
type: string
|
||||
package_path:
|
||||
description: Directory containing the app's Ziran package
|
||||
default: '.'
|
||||
type: string
|
||||
ledger_path:
|
||||
description: Release ledger relative to that package directory
|
||||
default: apps/versions.json
|
||||
type: string
|
||||
# The node app follower publishes each new release through this same job.
|
||||
workflow_call:
|
||||
inputs:
|
||||
@@ -54,6 +62,14 @@ on:
|
||||
description: SHA-256 of the checked bundle; any other bytes are refused
|
||||
required: true
|
||||
type: string
|
||||
package_path:
|
||||
description: Directory containing the app's Ziran package
|
||||
default: '.'
|
||||
type: string
|
||||
ledger_path:
|
||||
description: Release ledger relative to that package directory
|
||||
default: apps/versions.json
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
@@ -77,6 +93,8 @@ jobs:
|
||||
COMMIT: ${{ inputs.commit }}
|
||||
TAG: ${{ inputs.tag }}
|
||||
SHA256: ${{ inputs.sha256 }}
|
||||
PACKAGE_PATH: ${{ inputs.package_path }}
|
||||
LEDGER_PATH: ${{ inputs.ledger_path }}
|
||||
run: |
|
||||
python3 - <<'PY'
|
||||
import os, re
|
||||
@@ -85,6 +103,13 @@ jobs:
|
||||
for name, pattern in checks.items():
|
||||
if not re.fullmatch(pattern, os.environ[name]):
|
||||
raise SystemExit(f'{name} is not valid')
|
||||
path_pattern = r'[A-Za-z0-9_-][A-Za-z0-9._-]*(?:/[A-Za-z0-9_-][A-Za-z0-9._-]*)*'
|
||||
for name in ('PACKAGE_PATH', 'LEDGER_PATH'):
|
||||
value = os.environ[name]
|
||||
if name == 'PACKAGE_PATH' and value == '.':
|
||||
continue
|
||||
if not re.fullmatch(path_pattern, value):
|
||||
raise SystemExit(f'{name} is not a relative package path')
|
||||
PY
|
||||
- name: Fetch the release record, the publisher and the checked bundle
|
||||
env:
|
||||
@@ -94,6 +119,7 @@ jobs:
|
||||
COMMIT: ${{ inputs.commit }}
|
||||
TAG: ${{ inputs.tag }}
|
||||
SHA256: ${{ inputs.sha256 }}
|
||||
PACKAGE_PATH: ${{ inputs.package_path }}
|
||||
run: |
|
||||
set -eu
|
||||
work="$RUNNER_TEMP/node-app"
|
||||
@@ -102,7 +128,7 @@ jobs:
|
||||
git -C "$work/source" fetch -q --depth 1 "https://github.com/$REPOSITORY.git" "$COMMIT"
|
||||
git -C "$work/source" checkout -q FETCH_HEAD
|
||||
# The Apps publisher at the commit the release's own lock pins.
|
||||
apps=$(python3 -c 'import json,sys; print(next(p["commit"] for p in json.load(open(sys.argv[1]))["packages"] if p["url"].rstrip("/").removesuffix(".git").endswith("waozixyz/apps")))' "$work/source/ziran.lock")
|
||||
apps=$(python3 -c 'import json,sys; print(next(p["commit"] for p in json.load(open(sys.argv[1]))["packages"] if p["url"].rstrip("/").removesuffix(".git").endswith("waozixyz/apps")))' "$work/source/$PACKAGE_PATH/ziran.lock")
|
||||
git init -q "$work/apps"
|
||||
git -C "$work/apps" fetch -q --depth 1 https://github.com/waozixyz/apps.git "$apps"
|
||||
git -C "$work/apps" checkout -q FETCH_HEAD
|
||||
@@ -134,12 +160,14 @@ jobs:
|
||||
path.write_text(os.environ[name] + '\n')
|
||||
path.chmod(0o600)
|
||||
PY
|
||||
- name: Sign, publish to Waozi's Daochi node and verify
|
||||
- name: Sign, publish to Waozi's Mesh node and verify
|
||||
env:
|
||||
APP: ${{ inputs.app }}
|
||||
KEY_ID: ${{ vars.INBE_PACKAGE_KEY_ID }}
|
||||
TARGET: ${{ secrets.INBE_NODE_SSH_TARGET }}
|
||||
STORE: ${{ secrets.INBE_NODE_PACKAGE_STORE }}
|
||||
PACKAGE_PATH: ${{ inputs.package_path }}
|
||||
LEDGER_PATH: ${{ inputs.ledger_path }}
|
||||
run: |
|
||||
set -eu
|
||||
work="$RUNNER_TEMP/node-app"
|
||||
@@ -147,7 +175,7 @@ jobs:
|
||||
export INBE_SSH_KNOWN_HOSTS="$RUNNER_TEMP/inbe-publisher/known_hosts"
|
||||
python3 "$work/apps/scripts/node_release.py" --store "$work/releases" --node-app "$APP" \
|
||||
--key "$RUNNER_TEMP/inbe-publisher/publisher.pem" --key-id "$KEY_ID" \
|
||||
--publishers apps/publishers.json --app-ledger "$work/source/apps/versions.json" \
|
||||
--publishers apps/publishers.json --app-ledger "$work/source/$PACKAGE_PATH/$LEDGER_PATH" \
|
||||
--bundle-directory "$work/bundles" \
|
||||
--ssh-target "$TARGET" --remote-store "$STORE" --verify-origin https://api.waozi.xyz
|
||||
- name: Remove signing material
|
||||
|
||||
@@ -104,7 +104,7 @@ jobs:
|
||||
python3 scripts/check-package-publishers.py
|
||||
python3 scripts/package-release.py --store build/package-releases \
|
||||
--key "$RUNNER_TEMP/inbe-publisher/publisher.pem" --key-id "$KEY_ID"
|
||||
- name: Sign and publish to Waozi's Daochi node
|
||||
- name: Sign and publish to Waozi's Mesh node
|
||||
if: steps.publisher.outputs.configured == 'true'
|
||||
env:
|
||||
KEY_ID: ${{ vars.INBE_PACKAGE_KEY_ID }}
|
||||
|
||||
+16
-174
@@ -1,189 +1,31 @@
|
||||
name: Cloudflare Pages
|
||||
name: Refresh Gitea Pages after release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
# Refresh available downloads after a release; pushes deploy independently.
|
||||
workflow_run:
|
||||
workflows: [Release]
|
||||
types: [completed]
|
||||
branches: [master]
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
released_web:
|
||||
description: Use the published web app for a website-only update
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
concurrency:
|
||||
# A failed Release produces a skipped refresh, which must not cancel a push.
|
||||
group: pages-${{ github.ref }}-${{ github.event_name == 'workflow_run' && github.event.workflow_run.conclusion != 'success' && 'skipped' || 'deploy' }}
|
||||
# Finish the active deployment; newer pushes replace only the pending refresh.
|
||||
cancel-in-progress: false
|
||||
permissions: {}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build Site
|
||||
refresh-gitea-after-release:
|
||||
name: Refresh Gitea Pages after a successful release
|
||||
if: github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success'
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 60
|
||||
if: github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success'
|
||||
env:
|
||||
# Production follows the phone-verified release; previews test new source.
|
||||
USE_RELEASED_WEB: ${{ github.event_name != 'pull_request' || inputs.released_web }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
lfs: true
|
||||
|
||||
- name: Fetch Ziran packages
|
||||
uses: ./.github/actions/ziran-packages
|
||||
|
||||
- name: Set up Node.js for the web build
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
|
||||
- name: Resolve published downloads
|
||||
- name: Dispatch the current Gitea master workflow
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
BREEZE_PAGES_DISPATCH_TOKEN: ${{ secrets.BREEZE_PAGES_DISPATCH_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gh api repos/waozixyz/breeze/releases/latest > "$RUNNER_TEMP/inbe-published-release.json"
|
||||
python3 - "$RUNNER_TEMP/inbe-published-release.json" >> "$GITHUB_ENV" <<'PY'
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
release = json.loads(Path(sys.argv[1]).read_text())
|
||||
tag = release["tag_name"]
|
||||
version = tag.removeprefix("v")
|
||||
assert re.fullmatch(r"(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)\.(?:0|[1-9][0-9]*)", version), "Invalid published release version"
|
||||
assets = {asset["name"] for asset in release["assets"]}
|
||||
candidates = [f"inbe-{version}-arm64-v8a.apk", f"inbe-{version}.apk"]
|
||||
android = next((name for name in candidates if name in assets), None)
|
||||
assert android is not None, "Published release has no compatible Android APK"
|
||||
print(f"SITE_RELEASE_VERSION={version}")
|
||||
print(f"SITE_ANDROID_APK_ASSET={android}")
|
||||
PY
|
||||
|
||||
- name: Install Packages
|
||||
if: ${{ env.USE_RELEASED_WEB != 'true' }}
|
||||
timeout-minutes: 15
|
||||
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt
|
||||
|
||||
- name: Set Up Emscripten
|
||||
if: ${{ env.USE_RELEASED_WEB != 'true' }}
|
||||
uses: ./.github/actions/emscripten
|
||||
|
||||
- name: Download Released Web App
|
||||
if: ${{ env.USE_RELEASED_WEB == 'true' }}
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
version="$SITE_RELEASE_VERSION"
|
||||
test -n "$version"
|
||||
mkdir -p build/released-web build/dist/web
|
||||
gh release download "v$version" --pattern inbe-web.zip --dir build/released-web
|
||||
unzip -q build/released-web/inbe-web.zip -d build/dist/web
|
||||
test -s build/dist/web/index.wasm
|
||||
|
||||
- name: Web runner diagnostics
|
||||
if: ${{ env.USE_RELEASED_WEB != 'true' }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
lscpu
|
||||
free -m
|
||||
for browser in chromium chromium-browser google-chrome google-chrome-stable; do
|
||||
if command -v "$browser" >/dev/null 2>&1; then
|
||||
"$browser" --version
|
||||
fi
|
||||
done
|
||||
|
||||
- name: Build Site
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ "$USE_RELEASED_WEB" = "true" ]; then
|
||||
make package-unpackaged-assets
|
||||
sh site/build.sh
|
||||
else
|
||||
export PATH="$INBE_NODE_BIN:$PATH"
|
||||
node --version
|
||||
make build-laws
|
||||
make site
|
||||
if [ -z "$BREEZE_PAGES_DISPATCH_TOKEN" ]; then
|
||||
echo '::warning::BREEZE_PAGES_DISPATCH_TOKEN is missing'
|
||||
exit 0
|
||||
fi
|
||||
test -f build/site/index.html
|
||||
test -f build/site/build/web/index.html
|
||||
test -f build/site/build/web/index.js
|
||||
test -f build/site/build/web/index.wasm || test -f build/site/build/web/index.wasm.gz || test -f build/site/build/web/index.wasm.parts.json
|
||||
if [ "$GITHUB_EVENT_NAME" != "pull_request" ]; then
|
||||
make site-release-assets-check
|
||||
else
|
||||
echo "Skipping release asset availability check for pull request build"
|
||||
fi
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
|
||||
- name: Upload Web diagnostics after a failed build
|
||||
if: ${{ failure() && env.USE_RELEASED_WEB != 'true' }}
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: inbe-web-diagnostics
|
||||
path: build/dist/web
|
||||
if-no-files-found: warn
|
||||
retention-days: 3
|
||||
|
||||
- name: Upload Site Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: inbe-site
|
||||
path: build/site
|
||||
if-no-files-found: error
|
||||
|
||||
deploy-preview:
|
||||
name: Deploy Preview
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name == 'pull_request'
|
||||
|
||||
steps:
|
||||
- name: Download Site Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: inbe-site
|
||||
path: build/site
|
||||
|
||||
- name: Deploy Preview To Cloudflare Pages
|
||||
uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: pages deploy build/site --project-name=inbe --branch=${{ github.head_ref || github.ref_name }} --commit-hash=${{ github.sha }}
|
||||
|
||||
deploy-production:
|
||||
name: Deploy Production
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/master'
|
||||
|
||||
steps:
|
||||
- name: Download Site Artifact
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: inbe-site
|
||||
path: build/site
|
||||
|
||||
- name: Deploy Production To Cloudflare Pages
|
||||
uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
command: pages deploy build/site --project-name=inbe --branch=master --commit-hash=${{ github.sha }}
|
||||
curl --fail-with-body --silent --show-error --max-time 30 \
|
||||
--request POST \
|
||||
--header "Authorization: token $BREEZE_PAGES_DISPATCH_TOKEN" \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{"ref":"master"}' \
|
||||
'https://git.waozi.xyz/api/v1/repos/waozi/breeze/actions/workflows/pages.yml/dispatches'
|
||||
@@ -0,0 +1,60 @@
|
||||
name: Publish Amazon Appstore
|
||||
|
||||
# Retries the Amazon Appstore upload and submission for an already published
|
||||
# release. The Release workflow runs the same script for every new version.
|
||||
"on":
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: Published release version, such as 2.1.60
|
||||
required: true
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
name: Upload release APK to Amazon Appstore
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
env:
|
||||
AMAZON_CLIENT_ID: ${{ secrets.AMAZON_CLIENT_ID }}
|
||||
AMAZON_CLIENT_SECRET: ${{ secrets.AMAZON_CLIENT_SECRET }}
|
||||
AMAZON_APP_ID: ${{ secrets.AMAZON_APP_ID }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download the published release APK
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "::error::version must be numeric, such as 2.1.60"
|
||||
exit 1
|
||||
fi
|
||||
apk="inbe-$VERSION.apk"
|
||||
mkdir -p build/release/android
|
||||
gh release download "v$VERSION" --repo "$GITHUB_REPOSITORY" --pattern "$apk" --dir build/release/android
|
||||
expected=$(gh release view "v$VERSION" --repo "$GITHUB_REPOSITORY" --json assets \
|
||||
--jq ".assets[] | select(.name == \"$apk\") | .digest")
|
||||
actual="sha256:$(sha256sum "build/release/android/$apk" | cut -d' ' -f1)"
|
||||
if [ "$actual" != "$expected" ]; then
|
||||
echo "::error::$apk digest $actual does not match the release asset $expected"
|
||||
exit 1
|
||||
fi
|
||||
echo "Verified $apk $actual"
|
||||
|
||||
- name: Set up Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '24'
|
||||
|
||||
- name: Upload APK to Amazon Appstore
|
||||
env:
|
||||
AMAZON_RELEASE_FILE: build/release/android/inbe-${{ inputs.version }}.apk
|
||||
run: node scripts/upload-amazon-appstore.mjs
|
||||
@@ -128,8 +128,9 @@ jobs:
|
||||
click curl gcc-aarch64-linux-gnu git git-lfs jq make patchelf \
|
||||
perl pkg-config tcl xz-utils zlib1g-dev libbz2-1.0 libffi7 liblzma5 \
|
||||
libsqlite3-0 libssl-dev \
|
||||
libdrm-dev:arm64 libegl1-mesa-dev:arm64 libgbm-dev:arm64 \
|
||||
libgles2-mesa-dev:arm64 libsdl2-dev:arm64 libssl-dev:arm64 zlib1g-dev:arm64
|
||||
libsdl2-dev:arm64 libssl-dev:arm64 zlib1g-dev:arm64 \
|
||||
libcairo2-dev:arm64 libpango1.0-dev:arm64 libfontconfig1-dev:arm64 \
|
||||
libfreetype6-dev:arm64 libglib2.0-dev:arm64 libx11-dev:arm64
|
||||
apt-get install -y --no-install-recommends libwayland-bin \
|
||||
libwayland-dev:arm64 libxkbcommon-dev:arm64 libpulse-dev:arm64 libdbus-1-dev:arm64
|
||||
|
||||
@@ -237,14 +238,11 @@ jobs:
|
||||
unset PKG_CONFIG_PATH
|
||||
export AARCH64_PKG_CONFIG_PATH=/opt/inbe-openssl/lib/pkgconfig:/opt/inbe-sdl2/lib/pkgconfig:/usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig
|
||||
export PKG_CONFIG_LIBDIR="$AARCH64_PKG_CONFIG_PATH"
|
||||
export AARCH64_RAY_SDL_CFLAGS="$(pkg-config --cflags sdl2)"
|
||||
export AARCH64_RAY_SDL_LDLIBS="$(pkg-config --libs sdl2)"
|
||||
export AARCH64_RAY_GL_CFLAGS="$(pkg-config --cflags libdrm gbm egl glesv2)"
|
||||
export AARCH64_RAY_GL_LDLIBS="$(pkg-config --libs libdrm gbm egl glesv2)"
|
||||
export AARCH64_RAY_CFLAGS="$AARCH64_RAY_SDL_CFLAGS $AARCH64_RAY_GL_CFLAGS"
|
||||
# Kryon's desktop host: SDL2 windows drawn with Cairo and Pango.
|
||||
desktop_host_packages="sdl2 cairo freetype2 pangocairo fontconfig gio-2.0 x11"
|
||||
export AARCH64_DESKTOP_HOST_CFLAGS="$(pkg-config --cflags $desktop_host_packages)"
|
||||
# Search bundled TLS and SDL before the SDK's older system copies.
|
||||
export AARCH64_RAY_LDLIBS="-L/opt/inbe-openssl/lib $AARCH64_RAY_SDL_LDLIBS $AARCH64_RAY_GL_LDLIBS"
|
||||
export AARCH64_RAY_SDL_INCLUDE_DIR="$(pkg-config --variable=includedir sdl2)/SDL2"
|
||||
export AARCH64_DESKTOP_HOST_LDLIBS="-L/opt/inbe-openssl/lib $(pkg-config --libs $desktop_host_packages)"
|
||||
click_curl_dir="$PWD/vendor-builds/click/arm64/curl"
|
||||
export AARCH64_KRYON_CURL_CFLAGS="-DCURL_STATICLIB -I$click_curl_dir/include"
|
||||
export AARCH64_KRYON_CURL_LDLIBS="$click_curl_dir/lib/libcurl.a -L/opt/inbe-openssl/lib -lssl -lcrypto -lz -lpthread"
|
||||
|
||||
@@ -323,7 +323,7 @@ jobs:
|
||||
|
||||
- name: Install Web Dependencies
|
||||
timeout-minutes: 15
|
||||
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt
|
||||
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt python3-pil
|
||||
|
||||
- name: Set up Emscripten
|
||||
uses: ./.github/actions/emscripten
|
||||
@@ -380,7 +380,7 @@ jobs:
|
||||
|
||||
- name: Install Web Dependencies
|
||||
timeout-minutes: 15
|
||||
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt
|
||||
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt python3-pil
|
||||
|
||||
- name: Set up Emscripten
|
||||
uses: ./.github/actions/emscripten
|
||||
@@ -437,7 +437,7 @@ jobs:
|
||||
|
||||
- name: Install Web Dependencies
|
||||
timeout-minutes: 15
|
||||
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt
|
||||
run: .github/scripts/install-apt-packages.sh .github/apt/web-packages.txt python3-pil
|
||||
|
||||
- name: Set up Emscripten
|
||||
uses: ./.github/actions/emscripten
|
||||
@@ -522,14 +522,8 @@ jobs:
|
||||
- name: Build Linux AppImage
|
||||
env:
|
||||
APPIMAGE_EXTRACT_AND_RUN: "1"
|
||||
RAY_RAYLIB_CONFIG: -DSUPPORT_SCREEN_CAPTURE=0 -DSUPPORT_COMPRESSION_API=0 -DSUPPORT_AUTOMATION_EVENTS=0 -DSUPPORT_CLIPBOARD_IMAGE=0 -DSUPPORT_FILEFORMAT_BMP=0 -DSUPPORT_FILEFORMAT_GIF=0 -DSUPPORT_FILEFORMAT_QOI=0 -DSUPPORT_FILEFORMAT_DDS=0 -DSUPPORT_FILEFORMAT_TTF=1
|
||||
run: |
|
||||
set -euo pipefail
|
||||
RAY_SDL_INCLUDE_DIR="$(pkg-config --variable=includedir sdl2 | sed 's,/SDL2$,,')"
|
||||
RAY_CFLAGS="$(pkg-config --cflags sdl2 libdrm gbm egl glesv2)"
|
||||
RAY_LDLIBS="$(pkg-config --libs sdl2 libdrm gbm egl glesv2)"
|
||||
RAY_SDL_LDLIBS="$(pkg-config --libs sdl2)"
|
||||
export RAY_SDL_INCLUDE_DIR RAY_CFLAGS RAY_LDLIBS RAY_SDL_LDLIBS
|
||||
make appimage
|
||||
mkdir -p build/release/linux
|
||||
find build/dist/linux -maxdepth 1 -type f -name '*.AppImage' -exec cp {} build/release/linux/ \;
|
||||
@@ -978,15 +972,30 @@ jobs:
|
||||
env:
|
||||
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
|
||||
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
|
||||
WAOZI_DRIVE_PICKER_KEY: ${{ secrets.WAOZI_DRIVE_PICKER_KEY }}
|
||||
WAOZI_DRIVE_PROJECT_NUMBER: ${{ secrets.WAOZI_DRIVE_PROJECT_NUMBER }}
|
||||
WAOZI_DRIVE_PICKER_ORIGIN: ${{ secrets.WAOZI_DRIVE_PICKER_ORIGIN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
chmod +x droid/gradlew
|
||||
./droid/gradlew -p droid assembleRelease assembleGplay \
|
||||
./droid/gradlew -p droid assembleRelease \
|
||||
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
|
||||
-Pkeystore.alias="$KEY_ALIAS" \
|
||||
-Pkeystore.password="$KEYSTORE_PASSWORD" \
|
||||
--stacktrace
|
||||
# Only the Google Play edition's own Gradle run reads its Google plugin.
|
||||
./droid/gradlew -p droid assembleGplay \
|
||||
-Pwaozi.drivePickerKey="$WAOZI_DRIVE_PICKER_KEY" \
|
||||
-Pwaozi.driveProjectNumber="$WAOZI_DRIVE_PROJECT_NUMBER" \
|
||||
-Pwaozi.drivePickerOrigin="$WAOZI_DRIVE_PICKER_ORIGIN" \
|
||||
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
|
||||
-Pkeystore.alias="$KEY_ALIAS" \
|
||||
-Pkeystore.password="$KEYSTORE_PASSWORD" \
|
||||
--stacktrace
|
||||
./droid/gradlew -p droid bundleGplay \
|
||||
-Pwaozi.drivePickerKey="$WAOZI_DRIVE_PICKER_KEY" \
|
||||
-Pwaozi.driveProjectNumber="$WAOZI_DRIVE_PROJECT_NUMBER" \
|
||||
-Pwaozi.drivePickerOrigin="$WAOZI_DRIVE_PICKER_ORIGIN" \
|
||||
-Pkeystore.path="$HOME/.android/inbe-release.keystore" \
|
||||
-Pkeystore.alias="$KEY_ALIAS" \
|
||||
-Pkeystore.password="$KEYSTORE_PASSWORD" \
|
||||
@@ -1034,6 +1043,24 @@ jobs:
|
||||
done
|
||||
cp "build/android/inbe-$VERSION-gplay.aab" build/release/android/
|
||||
|
||||
# Only the Google Play edition may hold a Google library, in its build
|
||||
# files as in its APK. The universal and both x86 APK names end in a digit.
|
||||
- name: Keep Google libraries out of the normal and F-Droid APKs
|
||||
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
|
||||
with:
|
||||
packages: >-
|
||||
build/release/android/inbe-*[0-9].apk
|
||||
build/release/android/inbe-*-arm*.apk
|
||||
build/release/android/inbe-*-fdroid.apk
|
||||
# The Google check must still recognise Play Billing, or its passes on
|
||||
# the other editions prove nothing.
|
||||
- name: Find Play Billing in the Google Play APK
|
||||
uses: kryonlabs/kryon/.github/actions/google-free@7217475dfa7f462939e47e3f0bc918aef248b179
|
||||
with:
|
||||
packages: build/release/android/inbe-*-gplay.apk
|
||||
source: ''
|
||||
expect-google: 'true'
|
||||
|
||||
- name: Upload Android Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*.wasm
|
||||
build/
|
||||
/backup/
|
||||
/work/
|
||||
/notes/
|
||||
/output/
|
||||
tmp/
|
||||
@@ -89,3 +90,7 @@ design/sun-salutation/girl-parts/head-layers-check.png
|
||||
|
||||
# Sun Salutation motion exported for the three.js lab (render-sun-salutation-live.py --motion).
|
||||
/design/tai-chi/lab/
|
||||
|
||||
# Generated Android test classes and Gradle fixtures.
|
||||
/tests/android-diary-photo/bin/
|
||||
/tests/android-text-selection/bin/
|
||||
@@ -12,7 +12,10 @@
|
||||
- Practice media (pictures, course data, recordings) lives in the
|
||||
`practices` package (waozixyz/practices), not under
|
||||
`assets/`. Commit media there, then update the lock here.
|
||||
- Add the numeric release to `CHANGELOG.md`, then run `./update_version.sh`.
|
||||
- Bump versions only for a release actually being made. Until then, note
|
||||
every change under one `## [Unreleased]` section of `CHANGELOG.md` (and of
|
||||
`apps/<app>/CHANGELOG.md`); App packages waits for the next version. At
|
||||
release, number that section, then run `./update_version.sh`.
|
||||
The canonical macros are `APP_VERSION_STRING`, `APP_VERSION_MAJOR`,
|
||||
`APP_VERSION_MINOR`, and `APP_VERSION_PATCH`; do not create aliases.
|
||||
Only the GitHub Actions release workflow creates or pushes release tags.
|
||||
@@ -31,6 +34,10 @@
|
||||
Raise `host_api` when the host interface changes and `oldest_host_api` only
|
||||
when it can no longer run older packages. `make package-compat-test` runs
|
||||
the node's packages in this build and new packages in the last release.
|
||||
`zx_revision` there is the ZX executable revision the host runs; update
|
||||
checks send it and the node offers only packages whose `.zx` header has
|
||||
it, and the publisher refuses a payload of another revision. Change it
|
||||
with the Ziran pin, together with `oldest_host_api` and `host_api`.
|
||||
- Goal (owner, 2026-10-11): every app updates through its own package
|
||||
without a new APK. Work toward it in small steps alongside requested work;
|
||||
discuss larger moves with the owner first. Put app screens, rules and text
|
||||
@@ -42,6 +49,7 @@
|
||||
each new host call needs an APK before a package can use it. Apps share
|
||||
data only through the host interface, never another app's internals.
|
||||
- Translate changed strings in every affected locale; no English placeholders.
|
||||
- Keep Breeze/Lumi/store notes to 2–3 short core, Practices or Habits lines, without links or Android versions; game changes belong only in their package changelogs.
|
||||
- `make locale-translated-test` fails on any locale string that still equals
|
||||
its English text. Translate it; add it to `tests/locale_same_as_english.txt`
|
||||
only when it is a real brand name, loanword, or format string.
|
||||
@@ -63,11 +71,14 @@
|
||||
|
||||
## Public UI and sync boundaries
|
||||
|
||||
- Use current Kryon calls `Text(session, TextProps)`,
|
||||
`Image(session, ImageProps)`, and `Button(session, ButtonProps)` directly.
|
||||
Semantic images use the same `Image` surface. No positional Text, legacy
|
||||
drawing calls, alternate widgets, or thin local forwarding wrappers.
|
||||
Keep meaningful compositions and gestures; use standard Checkbox and Toggle.
|
||||
- Use Kryon's namespaced widgets directly, each imported by package
|
||||
(`Text :: #import "kryon/text";`): `Text.Draw(session, Text.Props)`,
|
||||
`Image.Draw(session, Image.Props)` and `Button.Draw(session, Button.Props)`.
|
||||
Semantic images use the same `Image` surface; file pictures come with
|
||||
`kryon/image` and button icons with `kryon/icon`. No positional Text,
|
||||
`Kryon`/`Widgets` facades, legacy drawing calls, alternate widgets, or thin
|
||||
local forwarding wrappers. Keep meaningful compositions and gestures; use
|
||||
standard `Checkbox.Draw` and `Toggle.Draw`.
|
||||
Run `make clean-text-api-check button-api-check` for UI changes.
|
||||
- If a required widget capability is missing, implement the reusable primitive
|
||||
upstream first. Do not work around it in Inbe or generated code.
|
||||
@@ -84,6 +95,13 @@
|
||||
direct Ziran foreign imports for native libraries; migrate owned C adapters
|
||||
as Ziran gains the required ABI support. Never keep application policy in C.
|
||||
|
||||
## Desktop testing
|
||||
|
||||
- Run manual Breeze app, runtime and UI tests on Alpha. Use private Xvfb,
|
||||
isolated home and XDG directories, and the test notification sink. Do not
|
||||
launch Breeze test instances on Omega. Builds follow normal Build routing
|
||||
unless the owner selects another machine.
|
||||
|
||||
## Product behavior and readability
|
||||
|
||||
- Desktop focus loss must not pause practices, freeze animation, suppress
|
||||
|
||||
@@ -1,5 +1,53 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Fix Backspace, edits, backup restores. Find Photos/Radio. Dew via Telegram Stars. Fast Lumi chat, unseen reply alerts.
|
||||
- Start/switch/resume. Seek Astral. 4-min and custom workouts. Live-sky banners. Download status/retry. PiP/Home fixes.
|
||||
- Reset break timers on return. Themed timers/coins. Daily coins, Diary links, one habit graph, stats and Activity icons.
|
||||
|
||||
## [2.1.63] - 2026-11-05
|
||||
|
||||
- Correct text in lists and Lumi without cursor jumps.
|
||||
- Keep Lumi chat ready while replies arrive, with Send and Cancel for developer reports.
|
||||
- See color purchase totals and reward frequency in the shop.
|
||||
|
||||
## [2.1.62] - 2026-11-03
|
||||
|
||||
- Clearer Sun Salutation guidance and steadier practice audio.
|
||||
- More reliable habit reminders and new reward pictures.
|
||||
- Safer account backups and more reliable sync.
|
||||
|
||||
## [2.1.61] - 2026-10-29
|
||||
|
||||
- Sync no longer gets stuck after something is deleted.
|
||||
- Photos in Trash stop using storage and are deleted after 30 days unless Diary shows them.
|
||||
- Cleared remote data stays 30 days; importing the same key brings it back.
|
||||
- The download is about 16 MB smaller.
|
||||
- Chinese, Japanese and Korean text displays correctly.
|
||||
- More of the app is translated, including Profile and update notes.
|
||||
|
||||
## [2.1.60] - 2026-10-29
|
||||
|
||||
- Hide apps from the library and restore them through Edit.
|
||||
- Use one simple reorder grip to the left of app icons in list and grid views.
|
||||
- Unify Profile rows and put sent friend requests beside names with a cancel action.
|
||||
|
||||
## [2.1.59] - 2026-10-28
|
||||
|
||||
- Keep habits, practices, session counts and game progress free of storage charges, even when account storage is full.
|
||||
- Count custom notes, Diary and media toward storage, and keep progress syncing past queued uploads that need more space.
|
||||
- Show full public IDs in centered, grouped fields.
|
||||
- Connect automatically to Sunup when it is installed, while keeping an explicit push-off choice off.
|
||||
- Turn habit reminders on by default for setups without a saved choice.
|
||||
|
||||
## [2.1.58] - 2026-10-28
|
||||
|
||||
- Show friend pictures and equipped Apfelwurm skins in leaderboards; hide repeated headings and single-choice selectors.
|
||||
- Keep downloaded Arcade games and saved progress across updates.
|
||||
- Show premium username prices, confirm Dew purchases and open top-up when needed. Existing usernames stay free to keep.
|
||||
- Align Profile leaderboard columns and improve Friends input, profile pictures and app rearranging.
|
||||
|
||||
## [2.1.56] - 2026-10-28
|
||||
|
||||
- Open the keyboard when editing an account alias and copy the complete public ID from Profile.
|
||||
|
||||
@@ -31,28 +31,43 @@ BUILD_DIR := build
|
||||
|
||||
# Dependencies and the Ziran toolchain are pinned in ziran.lock and linked
|
||||
# under build/packages/<name>. Make refreshes the links before reading the rest
|
||||
# of this file whenever the manifest or lock changes. PACKAGE_FLAGS=--locked
|
||||
# of this file whenever the manifest, lock or local overrides change. PACKAGE_FLAGS=--locked
|
||||
# ignores ziran.local.toml overrides for release builds.
|
||||
PACKAGE_FLAGS ?=
|
||||
export PACKAGE_FLAGS
|
||||
PACKAGES_MK := $(BUILD_DIR)/packages.mk
|
||||
$(PACKAGES_MK): ziran.toml ziran.lock scripts/packages.sh
|
||||
PACKAGE_OVERRIDES := $(wildcard ziran.local.toml)
|
||||
$(PACKAGES_MK): ziran.toml ziran.lock $(PACKAGE_OVERRIDES) scripts/packages.sh
|
||||
sh scripts/packages.sh $(PACKAGE_FLAGS)
|
||||
printf 'PACKAGES_READY := 1\n' > $@
|
||||
printf 'PACKAGES_READY := 1\nPACKAGES_RESOLUTION := %s|%s\n' '$(strip $(PACKAGE_FLAGS))' '$(PACKAGE_OVERRIDES)' > $@
|
||||
ifneq ($(filter-out clean distclean,$(or $(MAKECMDGOALS),all)),)
|
||||
include $(PACKAGES_MK)
|
||||
# The same directory holds local and locked links. Reselect when the caller
|
||||
# switches mode or removes an override file, even if the lock is unchanged.
|
||||
ifneq ($(strip $(PACKAGE_FLAGS))|$(PACKAGE_OVERRIDES),$(PACKAGES_RESOLUTION))
|
||||
.PHONY: packages-reselect
|
||||
$(PACKAGES_MK): packages-reselect
|
||||
endif
|
||||
endif
|
||||
|
||||
.PHONY: packages
|
||||
packages: $(PACKAGES_MK)
|
||||
|
||||
ZIRAN_DIR := build/packages/ziran
|
||||
ZIRAN_BUILD_DIR := $(abspath $(BUILD_DIR)/ziran-toolchain)
|
||||
# Project mode selects tools from the pinned checkout. Build that same stack
|
||||
# here so source checks and C generation cannot use different compiler builds.
|
||||
ZIRAN_BUILD_DIR := $(abspath $(ZIRAN_DIR)/build)
|
||||
KRYON_LIBRARY_BUILD_DIR := $(abspath $(BUILD_DIR)/kryon-library)
|
||||
ZI2C_BIN := $(ZIRAN_BUILD_DIR)/bin/zi2c
|
||||
ZIRAN_BIN := $(ZIRAN_BUILD_DIR)/bin/ziran
|
||||
ZI2ZIR_BIN := $(ZIRAN_BUILD_DIR)/bin/zi2zir
|
||||
ZI_CHECK_STAMP := $(BUILD_DIR)/zi-check/native.fresh
|
||||
ZIRAN_SOURCES := $(wildcard $(ZIRAN_DIR)/cmd/zir/*.[ch]) $(wildcard $(ZIRAN_DIR)/cmd/zir-c/*.[ch]) $(wildcard $(ZIRAN_DIR)/cmd/zir-ir/*.[ch]) $(ZIRAN_DIR)/Makefile
|
||||
# Package commands are Ziran sources too. Changes there must rebuild the same
|
||||
# toolchain as compiler and runtime changes, including local package overrides.
|
||||
ZIRAN_SOURCES := $(shell find $(ZIRAN_DIR)/cmd $(ZIRAN_DIR)/bootstrap \
|
||||
$(ZIRAN_DIR)/include $(ZIRAN_DIR)/std -type f \
|
||||
\( -name '*.zi' -o -name '*.c' -o -name '*.h' \) 2>/dev/null) \
|
||||
$(ZIRAN_DIR)/Makefile $(wildcard $(ZIRAN_DIR)/*.mk) $(ZIRAN_DIR)/VERSION
|
||||
BUILD_OBJ_DIR := $(BUILD_DIR)/obj
|
||||
BUILD_BIN_DIR := $(BUILD_DIR)/bin
|
||||
BUILD_DIST_DIR := $(BUILD_DIR)/dist
|
||||
@@ -80,6 +95,7 @@ APP_ID := $(ANDROID_APP_ID)
|
||||
APP_DESKTOP := $(LINUX_APPIMAGE_DESKTOP)
|
||||
APP_METAINFO := $(LINUX_APPIMAGE_APPDATA)
|
||||
APP_ICON := $(LINUX_APPIMAGE_ICON)
|
||||
APP_DESKTOP_EXEC := $(PREFIX)/bin/$(APP_EXECUTABLE)
|
||||
|
||||
DEB_BUILD_DIR := $(BUILD_OBJ_DIR)/deb
|
||||
DEB_ROOT := $(DEB_BUILD_DIR)/root
|
||||
@@ -91,7 +107,7 @@ DEB_PACKAGE_NAME ?= $(APP_NAME)
|
||||
DEB_MAINTAINER ?= $(APP_MAINTAINER)
|
||||
DEB_SECTION ?= utils
|
||||
DEB_PRIORITY ?= optional
|
||||
DEB_DEPENDS ?= libc6, libsdl2-2.0-0, libgtk-3-0, libcurl4, libdrm2, libgbm1, libegl1, libgles2, hicolor-icon-theme
|
||||
DEB_DEPENDS ?= libc6, libsdl2-2.0-0, libgtk-3-0, libcurl4, libdrm2, libgbm1, libegl1, libgles2, libglx0, hicolor-icon-theme
|
||||
DEB_TARGET = $(DEB_DIST_DIR)/$(DEB_PACKAGE_NAME)_$(APP_VERSION)_$(DEB_ARCH).deb
|
||||
DEB_TARGET_PREREQS = Makefile $(LINUX_APPIMAGE_DESKTOP) $(LINUX_APPIMAGE_ICON) $(LINUX_APPIMAGE_APPDATA) $(VERSION_FILE) $(if $(filter linux,$(NATIVE_PLATFORM)),$(TARGET),)
|
||||
RPM_BUILD_DIR := $(BUILD_OBJ_DIR)/rpm
|
||||
@@ -103,7 +119,7 @@ RPM_BIN_INPUT = $(if $(strip $(RPM_BIN_SOURCE)),$(RPM_BIN_SOURCE),$(if $(filter
|
||||
RPM_PACKAGE_NAME ?= $(APP_NAME)
|
||||
RPM_RELEASE ?= 1
|
||||
RPM_LICENSE ?= BSD-3-Clause
|
||||
RPM_REQUIRES ?= glibc, SDL2, gtk3, libcurl, libdrm, mesa-libgbm, mesa-libEGL, mesa-libGLES, hicolor-icon-theme
|
||||
RPM_REQUIRES ?= glibc, SDL2, gtk3, libcurl, libdrm, mesa-libgbm, mesa-libEGL, mesa-libGLES, libglvnd-glx, hicolor-icon-theme
|
||||
RPM_SPEC := $(RPM_BUILD_DIR)/$(RPM_PACKAGE_NAME).spec
|
||||
RPM_TARGET = $(RPM_DIST_DIR)/$(RPM_PACKAGE_NAME)-$(APP_VERSION)-$(RPM_RELEASE).$(RPM_ARCH).rpm
|
||||
RPM_TARGET_PREREQS = Makefile $(LINUX_APPIMAGE_DESKTOP) $(LINUX_APPIMAGE_ICON) $(LINUX_APPIMAGE_APPDATA) $(VERSION_FILE) $(if $(filter linux,$(NATIVE_PLATFORM)),$(TARGET),)
|
||||
@@ -160,8 +176,20 @@ CLICK_DIST_DIR := $(BUILD_DIST_DIR)/click
|
||||
CLICK_TARGET = $(CLICK_DIST_DIR)/$(CLICK_PACKAGE)_$(APP_VERSION)_$(CLICK_ARCH).click
|
||||
CLICK_BIN := $(CLICK_BIN_DIR)/$(APP_NAME)
|
||||
CLICK_BIN_INPUT := $(if $(strip $(CLICK_BIN_SOURCE)),$(CLICK_BIN_SOURCE),$(CLICK_BIN))
|
||||
CLICK_RAYLIB_BUILD_DIR := $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)/raylib
|
||||
CLICK_RAYLIB_A := $(CLICK_RAYLIB_BUILD_DIR)/libraylib.a
|
||||
# Kryon's desktop host links the same picture and audio codecs on Ubuntu
|
||||
# Touch, built for its ARM64 target.
|
||||
CLICK_VENDOR_DIR := $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)
|
||||
CLICK_WEBP_A := $(CLICK_VENDOR_DIR)/kryon-webp/libkryonwebp.a
|
||||
CLICK_AVIF_A := $(CLICK_VENDOR_DIR)/kryon-avif/avif/libavif.a
|
||||
CLICK_AOM_A := $(CLICK_VENDOR_DIR)/kryon-avif/aom/libaom.a
|
||||
CLICK_AUDIO_DIR := $(CLICK_VENDOR_DIR)/audio-codecs
|
||||
CLICK_OPUS_A := $(CLICK_AUDIO_DIR)/libopus/libopus.a
|
||||
CLICK_MP3_A := $(CLICK_AUDIO_DIR)/libziran_mp3.a
|
||||
CLICK_VORBIS_LIBS := $(CLICK_AUDIO_DIR)/libvorbisfile.a $(CLICK_AUDIO_DIR)/libvorbis.a $(CLICK_AUDIO_DIR)/libogg.a
|
||||
CLICK_CODEC_LIBS := $(CLICK_WEBP_A) $(CLICK_AVIF_A) $(CLICK_AOM_A) $(CLICK_MP3_A) $(CLICK_VORBIS_LIBS) $(CLICK_OPUS_A)
|
||||
CLICK_CMAKE_CROSS := -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 \
|
||||
-DCMAKE_C_COMPILER=$(AARCH64_CC) -DCMAKE_AR=$(AARCH64_AR) -DCMAKE_RANLIB=$(AARCH64_RANLIB) \
|
||||
-DCMAKE_BUILD_TYPE=Release
|
||||
CLICK_LIBOQS_BUILD_DIR := $(VENDOR_BUILD_DIR)/click/$(CLICK_ARCH)/liboqs
|
||||
CLICK_LIBOQS_A := $(CLICK_LIBOQS_BUILD_DIR)/lib/liboqs.a
|
||||
CLICK_LIBOQS_INCLUDE := -I$(CLICK_LIBOQS_BUILD_DIR)/include
|
||||
@@ -181,11 +209,17 @@ VERSION_FILE := src/core/version.h
|
||||
APP_VERSION := $(shell awk '/APP_VERSION_STRING/ { print $$3; exit }' $(VERSION_FILE) 2>/dev/null | tr -d '"')
|
||||
|
||||
KRYON_DIR ?= build/packages/kryon
|
||||
KSS_DIR ?= build/packages/kss
|
||||
CSS_DIR ?= build/packages/css
|
||||
OQS_DIR ?= build/packages/oqs
|
||||
RAYLIB_DIR = build/packages/raylib/src
|
||||
RAYLIB_BUILD_DIR := $(NATIVE_VENDOR_BUILD_DIR)/raylib
|
||||
RAYLIB_A := $(RAYLIB_BUILD_DIR)/libraylib.a
|
||||
WEBP_BUILD_DIR := $(NATIVE_VENDOR_BUILD_DIR)/kryon-webp
|
||||
WEBP_A := $(WEBP_BUILD_DIR)/libkryonwebp.a
|
||||
AVIF_BUILD_DIR := $(NATIVE_VENDOR_BUILD_DIR)/kryon-avif
|
||||
AVIF_A := $(AVIF_BUILD_DIR)/avif/libavif.a
|
||||
AOM_A := $(AVIF_BUILD_DIR)/aom/libaom.a
|
||||
# Kryon's codec recipes come from the codec packages in this app's lock.
|
||||
# Kryon resolves the rest (dav1d) with this build's ziran, which CI runners
|
||||
# do not have on PATH.
|
||||
IMAGE_PACKAGE_DIRS := -DKRYON_WEBP_PACKAGE_DIR="$(abspath build/packages/webp)" -DKRYON_AVIF_PACKAGE_DIR="$(abspath build/packages/avif)" -DZIRAN_BIN="$(ZIRAN_BIN)"
|
||||
WIN64_ARCH := x86_64
|
||||
WIN64_CC ?= $(or $(WIN_CC),x86_64-w64-mingw32-gcc)
|
||||
WIN64_AR ?= $(or $(WIN_AR),x86_64-w64-mingw32-ar)
|
||||
@@ -196,8 +230,6 @@ WIN64_CMAKE_SYSTEM_PROCESSOR ?= x86_64
|
||||
WIN64_CC_PATH := $(shell command -v $(WIN64_CC) 2>/dev/null || printf '%s' $(WIN64_CC))
|
||||
WIN64_AR_PATH := $(shell command -v $(WIN64_AR) 2>/dev/null || printf '%s' $(WIN64_AR))
|
||||
WIN64_RANLIB_PATH := $(shell command -v $(WIN64_RANLIB) 2>/dev/null || printf '%s' $(WIN64_RANLIB))
|
||||
WIN64_RAYLIB_BUILD_DIR := $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/raylib
|
||||
WIN64_RAYLIB_A := $(WIN64_RAYLIB_BUILD_DIR)/libraylib.a
|
||||
WIN64_CURL_BUILD_DIR := $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/curl
|
||||
WIN64_CURL_INCLUDE_DIR := $(WIN64_CURL_BUILD_DIR)/include
|
||||
WIN64_CURL_A := $(WIN64_CURL_BUILD_DIR)/lib/libcurl.a
|
||||
@@ -205,31 +237,30 @@ WIN64_LIBOQS_BUILD_DIR := $(VENDOR_BUILD_DIR)/windows/$(WIN64_ARCH)/liboqs
|
||||
WIN64_LIBOQS_A := $(WIN64_LIBOQS_BUILD_DIR)/lib/liboqs.a
|
||||
WIN64_LIBOQS_INCLUDE := -I$(WIN64_LIBOQS_BUILD_DIR)/include
|
||||
WIN64_RESOURCE := $(BUILD_OBJ_DIR)/windows/$(WIN64_ARCH)/$(APP_NAME).res
|
||||
RAYLIB_SOURCES := $(if $(wildcard $(RAYLIB_DIR)),$(shell find $(RAYLIB_DIR) -type f \( -name '*.c' -o -name '*.h' \)))
|
||||
|
||||
KRYON_ICON_DIR := icons
|
||||
KRYON_ICON_FILES := $(shell find $(KRYON_DIR)/$(KRYON_ICON_DIR) -path '*/review/*' -prune -o -type f \( -name '*.png' -o -name '*.json' \) -print 2>/dev/null | LC_ALL=C sort)
|
||||
KRYON_ICON_FILES := $(shell find $(KRYON_DIR)/$(KRYON_ICON_DIR) -path '*/review/*' -prune -o -type f \( -name '*.webp' -o -name '*.png' -o -name '*.json' \) -print 2>/dev/null | LC_ALL=C sort)
|
||||
KRYON_GENERATED_INCLUDE_DIR := $(BUILD_OBJ_DIR)/kryon/generated/include
|
||||
KRYON_GENERATED_SRC_DIR := $(BUILD_OBJ_DIR)/kryon/generated/src
|
||||
KRYON_UI_ZI := $(addprefix $(KRYON_DIR)/src/ui/,$(shell cat $(KRYON_DIR)/src/ui/modules.txt))
|
||||
KRYON_UI_C := $(patsubst $(KRYON_DIR)/src/ui/%.zi,$(KRYON_GENERATED_SRC_DIR)/ui/%.c,$(KRYON_UI_ZI))
|
||||
KRYON_UI_H := $(KRYON_UI_C:.c=.h)
|
||||
KRYON_UI_STAMP := $(KRYON_GENERATED_SRC_DIR)/ui/.fresh
|
||||
KRYON_KSS_ZI := $(wildcard $(KSS_DIR)/src/*.zi)
|
||||
KRYON_KSS_C := $(patsubst $(KSS_DIR)/src/%.zi,$(KRYON_GENERATED_SRC_DIR)/kss/%.c,$(KRYON_KSS_ZI))
|
||||
KRYON_KSS_H := $(KRYON_KSS_C:.c=.h)
|
||||
KRYON_KSS_STAMP := $(KRYON_GENERATED_SRC_DIR)/kss/.fresh
|
||||
KRYON_CSS_ZI := $(wildcard $(CSS_DIR)/src/*.zi)
|
||||
KRYON_CSS_C := $(patsubst $(CSS_DIR)/src/%.zi,$(KRYON_GENERATED_SRC_DIR)/css/%.c,$(KRYON_CSS_ZI))
|
||||
KRYON_CSS_H := $(KRYON_CSS_C:.c=.h)
|
||||
KRYON_CSS_STAMP := $(KRYON_GENERATED_SRC_DIR)/css/.fresh
|
||||
KRYON_ICON_ASSETS_C := $(KRYON_GENERATED_SRC_DIR)/ui/ui_icon_assets.c
|
||||
KRYON_ICON_NAMES_C := $(KRYON_GENERATED_SRC_DIR)/ui/ui_icon_names.c
|
||||
KRYON_ICON_TYPES_H := $(KRYON_GENERATED_INCLUDE_DIR)/ui_icon_types.h
|
||||
KRYON_SRCS := $(filter-out $(KRYON_DIR)/src/ui/ui_icon_assets.c $(KRYON_DIR)/src/ui/ui_icon_names.c,$(shell find $(KRYON_DIR)/src -type f -name '*.c' | LC_ALL=C sort)) $(KRYON_ICON_ASSETS_C) $(KRYON_ICON_NAMES_C) $(KRYON_UI_C) $(KRYON_KSS_C)
|
||||
KRYON_SRCS := $(filter-out $(KRYON_DIR)/src/ui/ui_icon_assets.c $(KRYON_DIR)/src/ui/ui_icon_names.c,$(shell find $(KRYON_DIR)/src -type f -name '*.c' | LC_ALL=C sort)) $(KRYON_ICON_ASSETS_C) $(KRYON_ICON_NAMES_C) $(KRYON_UI_C) $(KRYON_CSS_C)
|
||||
KRYON_SYNC_ICONS := $(KRYON_DIR)/scripts/sync-icons.sh
|
||||
WEB_SHARED_ICON_SHEETS := platforms language tiles
|
||||
# Inbe's desktop uses Kryon's raylib backend, not its libdraw, terminal or
|
||||
# Plan 9 hosts.
|
||||
# Inbe's desktop uses Kryon's SDL and Cairo desktop host, not its libdraw,
|
||||
# terminal or Plan 9 hosts.
|
||||
KRYON_SRCS := $(filter-out $(KRYON_DIR)/src/backend/libdraw_%.c $(KRYON_DIR)/src/backend/termi_%.c \
|
||||
$(KRYON_DIR)/src/platform/plan9/%.c,$(KRYON_SRCS))
|
||||
# The web build uses kryon's Canvas2D backend directly: no raylib, no WebGL.
|
||||
# The web build uses kryon's Canvas2D backend directly, with no WebGL.
|
||||
KRYON_WEB_SRCS := $(KRYON_SRCS)
|
||||
KRYON_WEB_SRCS := $(filter-out $(KRYON_DIR)/src/backend/dom_%.c,$(KRYON_WEB_SRCS))
|
||||
KRYON_WINDOWS_SRCS := $(filter-out $(KRYON_DIR)/src/file_dialog/file_dialog.c,$(KRYON_SRCS))
|
||||
@@ -272,6 +303,7 @@ KRYON_CURL_EXTRA_CMAKE_FLAGS := \
|
||||
# to keep the kryon physics .c files (which need box2d.h) out of every build.
|
||||
KRYON_WITH_PHYSICS := 0
|
||||
include mk/sync.mk
|
||||
include mk/audio-codecs.mk
|
||||
KRYON_INCLUDE += $(KRYON_PHYSICS_CPPFLAGS)
|
||||
KRYON_SRCS := $(filter-out $(KRYON_PHYSICS_SRCS),$(KRYON_SRCS))
|
||||
KRYON_WEB_SRCS := $(filter-out $(KRYON_PHYSICS_SRCS),$(KRYON_WEB_SRCS))
|
||||
@@ -338,7 +370,12 @@ APP_SRCS := \
|
||||
ifneq ($(filter linux freebsd,$(NATIVE_PLATFORM)),)
|
||||
DESKTOP_TRAY_DEFINE := DESKTOP_TRAY_ENABLED
|
||||
endif
|
||||
ZI_NATIVE_DEFINES := PLATFORM_DESKTOP $(DESKTOP_TRAY_DEFINE)
|
||||
# The native desktop runs on Kryon's desktop host: SDL2 windows and input,
|
||||
# Cairo and Pango raster, Kryon's audio mixer.
|
||||
# Kryon's desktop raster decodes WebP with the libwebp archive this build
|
||||
# links (KRYON_WEBP_LINKED). Its linked AVIF path imports a module the pinned
|
||||
# avif package does not export yet, so AVIF still loads libkryonavif.so.
|
||||
ZI_NATIVE_DEFINES := PLATFORM_DESKTOP DESKTOP_HOST KRYON_WEBP_LINKED $(DESKTOP_TRAY_DEFINE)
|
||||
# Ziran preprocessing must see the libc choice used by the native C compiler.
|
||||
NATIVE_GLIBC := $(shell printf '#include <stdlib.h>\n' | $(CC) -dM -E - 2>/dev/null | grep -q '^\#define __GLIBC__ ' && printf yes)
|
||||
ifeq ($(NATIVE_GLIBC),yes)
|
||||
@@ -357,18 +394,37 @@ endif
|
||||
ifeq ($(NATIVE_PLATFORM),darwin)
|
||||
ZI_NATIVE_DEFINES += __APPLE__
|
||||
endif
|
||||
# Kryon's test driver is test code, so the app is built without it. The UI
|
||||
# tests drive the app, so they need a build made with KRYON_TEST_DRIVER set,
|
||||
# for example `KRYON_TEST_DRIVER=1 make tai-chi-ui-test`; setting or clearing
|
||||
# it regenerates the app. A build without it stops with that instruction when
|
||||
# a test runs it.
|
||||
ifneq ($(KRYON_TEST_DRIVER),)
|
||||
ZI_NATIVE_DEFINES += KRYON_TEST_DRIVER
|
||||
endif
|
||||
|
||||
# No in-process GTK anywhere else either: the system theme uses kryon's
|
||||
# built-in palettes, and native file dialogs prefer xdg-desktop-portal through
|
||||
# GIO before falling back to zenity/kdialog/yad.
|
||||
# GIO before falling back to zenity/kdialog/yad. Embedded in a host such as
|
||||
# Harmony, the Linux build reads the host's theme from its X11 window.
|
||||
SYSTEM_THEME_CFLAGS :=
|
||||
SYSTEM_THEME_LDLIBS :=
|
||||
SYSTEM_THEME_LDLIBS := $(if $(filter linux,$(NATIVE_PLATFORM)),-lX11,)
|
||||
|
||||
LOCALE_FILES := $(wildcard locales/*.txt)
|
||||
# The practice media is the practices package, packaged under
|
||||
# assets/practices/ (scripts/practice_media.py).
|
||||
PRACTICE_MEDIA := build/packages/practices
|
||||
IMAGE_FILES := assets/app/icon.png assets/easteregg/art.png assets/easteregg/waozi.png $(PRACTICE_MEDIA)/whm/1.png $(PRACTICE_MEDIA)/whm/2.png $(PRACTICE_MEDIA)/meditation/1.png assets/pet/egg1.png $(wildcard $(PRACTICE_MEDIA)/*/banner*.png) $(wildcard $(PRACTICE_MEDIA)/sunsalutation/characters/*/*.png) $(wildcard $(PRACTICE_MEDIA)/taichi/*.png $(PRACTICE_MEDIA)/taichi/*/*.png) $(PRACTICE_MEDIA)/taichi/course.tch
|
||||
# Local builds can select verified Practices source and media through the
|
||||
# same directory. Locked builds always take both from the resolved package.
|
||||
PRACTICE_PACKAGE_MEDIA := build/packages/practices
|
||||
PRACTICE_MEDIA := $(PRACTICE_PACKAGE_MEDIA)
|
||||
ifneq ($(filter --locked,$(PACKAGE_FLAGS)),)
|
||||
ifneq ($(abspath $(PRACTICE_MEDIA)),$(abspath $(PRACTICE_PACKAGE_MEDIA)))
|
||||
$(error PRACTICE_MEDIA cannot override the Practices package in a locked build)
|
||||
endif
|
||||
endif
|
||||
export PRACTICE_MEDIA
|
||||
PRACTICE_MEDIA_STAMP := $(BUILD_DIR)/practice-media-source
|
||||
PRACTICE_FIGURE_DIR := $(BUILD_DIR)/practice-figure
|
||||
PRACTICE_FIGURE_MODULES := $(PRACTICE_MEDIA_STAMP) $(wildcard $(PRACTICE_MEDIA)/figure/*.zi) scripts/stage-practice-figure.py
|
||||
IMAGE_FILES := assets/app/icon.webp $(PRACTICE_MEDIA)/whm/1.webp $(PRACTICE_MEDIA)/whm/2.webp $(PRACTICE_MEDIA)/meditation/1.webp assets/pet/egg1.png $(wildcard $(PRACTICE_MEDIA)/*/banner*.webp) $(wildcard $(PRACTICE_MEDIA)/sunsalutation/characters/*/*.png) $(wildcard $(PRACTICE_MEDIA)/taichi/*.png $(PRACTICE_MEDIA)/taichi/*/*.png) $(PRACTICE_MEDIA)/taichi/course.tch
|
||||
SOUND_FILES := $(wildcard assets/sounds/*.ogg)
|
||||
FONT_SUBSET_DIR := assets/fonts/subset
|
||||
FONT_SUBSET_CORPUS := locales assets/fonts/input_common.txt assets/fonts/ui_symbols.txt $(PRACTICE_MEDIA)/astral_projection/text $(PRACTICE_MEDIA)/workout/text
|
||||
@@ -379,32 +435,32 @@ FONT_FILES := \
|
||||
$(FONT_SUBSET_DIR)/NotoSansKR-App-Regular.otf \
|
||||
$(FONT_SUBSET_DIR)/NotoSansTC-App-Regular.otf
|
||||
EMBEDDED_ASSETS_C := $(BUILD_OBJ_DIR)/$(APP_NAME)_embedded_assets.c
|
||||
STYLE_FILES := $(wildcard $(KSS_DIR)/styles/*.kss) \
|
||||
$(wildcard assets/styles/*.kss) \
|
||||
$(wildcard themes/catalog_*.kss)
|
||||
IMAGE_FILES += assets/app/icon-sky-cradle.png assets/app/icon-ink-and-air.png
|
||||
IMAGE_FILES += $(wildcard assets/social/*.png)
|
||||
IMAGE_FILES += $(wildcard assets/profile-pictures/*.png)
|
||||
IMAGE_FILES += $(KRYON_DIR)/icons/ui.png $(KRYON_DIR)/icons/pfp.png
|
||||
STYLE_FILES := $(wildcard $(CSS_DIR)/styles/*.css) \
|
||||
$(wildcard assets/styles/*.css) \
|
||||
$(wildcard themes/catalog_*.css)
|
||||
IMAGE_FILES += assets/app/icon-sky-cradle.webp assets/app/icon-ink-and-air.webp
|
||||
IMAGE_FILES += assets/social/telegram.svg $(wildcard assets/social/*.png assets/social/*.webp)
|
||||
IMAGE_FILES += $(KRYON_DIR)/icons/ui.webp $(KRYON_DIR)/icons/pfp.webp
|
||||
APP_BUNDLES := $(addprefix $(BUILD_DIR)/apps/,lists.zx habits.zx practices.zx diary.zx lumi.zx leaderboard.zx)
|
||||
INBE_BUNDLE := $(BUILD_DIR)/inbe.zx
|
||||
INBE_FULL_BUNDLE := $(BUILD_DIR)/inbe-full.zx
|
||||
APP_SOURCES := $(shell find apps src/apps -name '*.zi' | LC_ALL=C sort) src/core/types.zi src/core/breath_timing.zi $(wildcard src/practices/patterns/*rules.zi) src/practices/patterns/patterns_clock.zi src/practices/patterns/patterns_types.zi src/practices/sun_salutation/sun_salutation_rules.zi src/practices/meditation/meditation_timing.zi
|
||||
APP_RESOURCES := $(shell rg --files assets/habits assets/lists assets/diary assets/lumi assets/mcp 2>/dev/null)
|
||||
APP_RESOURCES += $(shell find -L $(PRACTICE_MEDIA) -type f -not -path '*/.git/*' 2>/dev/null) $(shell rg --files design/tai-chi/text 2>/dev/null) apps/practice/content.json design/tai-chi/narration.json design/tai-chi/narration-lines.json $(wildcard design/tai-chi/narration-receipt.json) $(wildcard design/sun-salutation/narration/*.json) $(wildcard design/sun-salutation/narration/text/*.txt) $(wildcard design/lumi-guide/*.json) scripts/practice_content.py scripts/generate-lumi-guide-narration.py
|
||||
APP_RESOURCES := $(shell rg --files assets/habits assets/lists assets/diary assets/lumi assets/mcp assets/navigation assets/apps/icons 2>/dev/null)
|
||||
APP_RESOURCES += $(shell find -L $(PRACTICE_MEDIA) -type f -not -path '*/.git/*' 2>/dev/null) $(shell rg --files design/tai-chi/text 2>/dev/null) apps/practice/content.json $(wildcard design/tai-chi/narration*.json design/workout/narration*.json design/narration/*.json) $(wildcard design/sun-salutation/narration/*.json) $(wildcard design/sun-salutation/narration/text/*.txt design/sun-salutation/narration/text-female/*.txt) $(wildcard design/lumi-guide/*.json) $(wildcard design/astral-projection/*.json) scripts/practice_content.py scripts/practice_media.py scripts/tai_chi_preview.py apps/practice/course_access.zi scripts/generate-lumi-guide-narration.py
|
||||
APP_RESOURCES += $(wildcard design/lumi-guide/text-female/*.txt)
|
||||
APP_RESOURCES += $(wildcard apps/*/achievements.json) $(wildcard apps/*/achievement-locales/*.json)
|
||||
APP_RESOURCES += $(wildcard assets/*/sidebar.shape)
|
||||
|
||||
APPS_BUNDLE ?= build/apps-ui/apps.zx
|
||||
EMBEDDED_ASSET_FILES := apps/publishers.json $(INBE_BUNDLE) $(APPS_BUNDLE) assets/app/icon.png
|
||||
EMBEDDED_ASSET_FILES := apps/publishers.json $(INBE_BUNDLE) assets/app/icon.webp
|
||||
KRY_GEN_DIR := $(BUILD_DIR)/kryon/generated
|
||||
# Dependencies are imported as PACKAGE/Module through their linked packages.
|
||||
ZI_PACKAGE_PATHS := $(shell sh scripts/package-paths.sh)
|
||||
ZI_SRCS := $(shell find src -type f -name '*.zi' 2>/dev/null | LC_ALL=C sort) apps/practice/hold_reminder.zi apps/practice/whm_controls.zi $(wildcard apps/practice/astral_projection*.zi) $(wildcard apps/practice/workout*.zi) $(wildcard apps/practice/sun_salutation*.zi)
|
||||
GAME2D_DIR := build/packages/game2d
|
||||
GAME2D_MODULES := $(wildcard $(GAME2D_DIR)/src/*/*.zi)
|
||||
DAOCHI_CLIENT_DIR ?= build/packages/daochi-client
|
||||
DAOCHI_CLIENT_MODULES := $(wildcard $(DAOCHI_CLIENT_DIR)/*.zi)
|
||||
MESH_CLIENT_DIR ?= build/packages/mesh-client
|
||||
MESH_CLIENT_MODULES := $(wildcard $(MESH_CLIENT_DIR)/*.zi)
|
||||
ZIRAN_STD_MODULES := $(wildcard $(ZIRAN_DIR)/std/*.zi)
|
||||
KRYON_ZI_MODULES := $(shell find $(KRYON_DIR)/src -type f -name '*.zi' | LC_ALL=C sort)
|
||||
KRY_GEN_SRCS := $(patsubst %.zi,$(KRY_GEN_DIR)/%.c,$(ZI_SRCS))
|
||||
@@ -413,15 +469,14 @@ KRY_GEN_SRCS += $(addprefix $(KRY_GEN_DIR)/,account.c auth.c authorization.c aut
|
||||
net_ws_curl_linux.c social.c sync.c \
|
||||
text.c text_buffer.c transaction.c update.c url.c wire.c)
|
||||
KRY_GEN_HDRS := $(patsubst %.zi,$(KRY_GEN_DIR)/%.h,$(ZI_SRCS))
|
||||
KRY_GEN_GAME_C := $(KRY_GEN_DIR)/Raylib.c
|
||||
KRY_GEN_STAMP := $(KRY_GEN_DIR)/.fresh
|
||||
# The defines the C was generated with, outside the pruned output directory.
|
||||
KRY_GEN_DEFINES := $(BUILD_DIR)/kryon/generated-defines.txt
|
||||
WEB_GEN_DIR := $(BUILD_DIR)/kryon/generated-web
|
||||
WEB_GEN_SRCS := $(patsubst $(KRY_GEN_DIR)/%,$(WEB_GEN_DIR)/%,$(KRY_GEN_SRCS))
|
||||
WEB_GEN_GAME_C := $(WEB_GEN_DIR)/Raylib.c
|
||||
WEB_GEN_STAMP := $(WEB_GEN_DIR)/.fresh
|
||||
WINDOWS_GEN_DIR := $(BUILD_DIR)/kryon/generated-windows
|
||||
WINDOWS_GEN_SRCS := $(patsubst $(KRY_GEN_DIR)/%,$(WINDOWS_GEN_DIR)/%,$(KRY_GEN_SRCS))
|
||||
WINDOWS_GEN_GAME_C := $(WINDOWS_GEN_DIR)/Raylib.c
|
||||
WINDOWS_GEN_STAMP := $(WINDOWS_GEN_DIR)/.fresh
|
||||
# The Unix clock provider is generated only for the native app. Web and
|
||||
# Windows source lists above retain their platform clock implementations.
|
||||
@@ -430,15 +485,12 @@ SRC := $(APP_SRCS) $(KRY_GEN_STAMP) $(EMBEDDED_ASSETS_C)
|
||||
GENERATED_NATIVE_C = $(shell find $(KRY_GEN_DIR) -type f -name '*.c' | LC_ALL=C sort)
|
||||
WINDOWS_SRC := $(APP_SRCS) $(EMBEDDED_ASSETS_C)
|
||||
GENERATED_WINDOWS_C = $(shell find $(WINDOWS_GEN_DIR) -type f -name '*.c' | LC_ALL=C sort)
|
||||
KRYON_HOST_APP_SRCS := $(APP_SRCS) $(KRY_GEN_SRCS) $(KRY_GEN_GAME_C)
|
||||
KRYON_HOST_SRC := $(KRYON_HOST_APP_SRCS) $(EMBEDDED_ASSETS_C)
|
||||
WEB_APP_SRCS := $(APP_SRCS)
|
||||
WEB_SRC := $(WEB_APP_SRCS) $(EMBEDDED_ASSETS_C)
|
||||
GENERATED_WEB_C = $(shell find $(WEB_GEN_DIR) -type f -name '*.c' | LC_ALL=C sort)
|
||||
|
||||
APP_INCLUDE := -Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/practices -Isrc/practices/whm -Isrc/practices/meditation -Isrc/practices/sun_salutation -Isrc/practices/tai_chi -Isrc/storage -Isrc/platform -Isrc/platform/android -Isrc/third_party
|
||||
APP_INCLUDE += -iquote$(KRY_GEN_DIR)
|
||||
APP_INCLUDE += -I$(RAYLIB_DIR)
|
||||
APP_INCLUDE += $(foreach dir,$(sort $(dir $(ZI_SRCS))),-iquote$(KRY_GEN_DIR)/$(dir))
|
||||
APP_INCLUDE += $(KRYON_INCLUDE)
|
||||
APP_INCLUDE += -I$(MONOCYPHER_DIR) -I$(MONOCYPHER_DIR)/optional
|
||||
@@ -455,40 +507,21 @@ LAW_MODULES := src/app/sync_retry_laws.zi src/app/practice_lifecycle_laws.zi \
|
||||
src/app/sync_recovery_policy_laws.zi src/storage/habit_merge_laws.zi \
|
||||
src/storage/sync_restore_laws.zi src/storage/storage_layout_laws.zi \
|
||||
src/guide_laws.zi src/apps/node_app_input_laws.zi
|
||||
RAY_PKGS ?= sdl2 libdrm gbm egl glesv2
|
||||
RAY_SDL_CFLAGS ?= $(shell pkg-config --cflags sdl2 2>/dev/null)
|
||||
RAY_SDL_LDLIBS ?= $(shell pkg-config --libs sdl2 2>/dev/null)
|
||||
ZI_NATIVE_DEFINES += $(if $(strip $(RAY_SDL_LDLIBS)),NATIVE_WINDOW_HAVE_SDL,)
|
||||
# Kryon's desktop host windows through SDL.
|
||||
ZI_NATIVE_DEFINES += NATIVE_WINDOW_HAVE_SDL
|
||||
APP_GIO_CFLAGS ?= $(shell pkg-config --cflags gio-2.0 2>/dev/null)
|
||||
APP_GIO_LDLIBS ?= $(shell pkg-config --libs gio-2.0 2>/dev/null)
|
||||
ZI_NATIVE_DEFINES += $(if $(strip $(APP_GIO_LDLIBS)),APP_HAVE_GIO,)
|
||||
RAY_GL_CFLAGS ?= $(shell pkg-config --cflags libdrm gbm egl glesv2 2>/dev/null)
|
||||
RAY_GL_LDLIBS ?= $(shell pkg-config --libs libdrm gbm egl glesv2 2>/dev/null)
|
||||
RAY_CFLAGS ?= $(strip $(RAY_SDL_CFLAGS) $(RAY_GL_CFLAGS))
|
||||
RAY_LDLIBS ?= $(strip $(RAY_SDL_LDLIBS) $(RAY_GL_LDLIBS))
|
||||
RAY_SDL_INCLUDE_DIR ?= $(shell pkg-config --variable=includedir sdl2 2>/dev/null | sed 's,/SDL2$$,,')
|
||||
RAY_RAYLIB_CONFIG ?= -DSUPPORT_SCREEN_CAPTURE=0 -DSUPPORT_COMPRESSION_API=0 -DSUPPORT_AUTOMATION_EVENTS=0 -DSUPPORT_CLIPBOARD_IMAGE=0 -DSUPPORT_FILEFORMAT_BMP=0 -DSUPPORT_FILEFORMAT_GIF=0 -DSUPPORT_FILEFORMAT_QOI=0 -DSUPPORT_FILEFORMAT_DDS=0 -DSUPPORT_FILEFORMAT_TTF=1
|
||||
ifeq ($(NATIVE_PLATFORM),freebsd)
|
||||
KRYON_RAYLIB_AUDIO_PERIOD_FRAMES ?= 128
|
||||
KRYON_RAYLIB_AUDIO_PERIODS ?= 2
|
||||
endif
|
||||
KRYON_RAYLIB_AUDIO_PERIOD_CONFIG := $(if $(strip $(KRYON_RAYLIB_AUDIO_PERIOD_FRAMES)),-DAUDIO_DEVICE_PERIOD_SIZE_IN_FRAMES=$(KRYON_RAYLIB_AUDIO_PERIOD_FRAMES),)
|
||||
KRYON_RAYLIB_AUDIO_PERIODS_CONFIG := $(if $(strip $(KRYON_RAYLIB_AUDIO_PERIODS)),-DAUDIO_DEVICE_PERIODS=$(KRYON_RAYLIB_AUDIO_PERIODS),)
|
||||
# Inbe's fonts are TrueType and OpenType files, so every host keeps TTF
|
||||
# support; without it raylib draws its fallback pixel font.
|
||||
APP_RAYLIB_CONFIG := $(filter-out -DSUPPORT_MODULE_RAUDIO=0 -DSUPPORT_FILEFORMAT_PNG=0 -DSUPPORT_FILEFORMAT_JPG=0 -DSUPPORT_FILEFORMAT_OGG=0 -DSUPPORT_FILEFORMAT_MP3=% -DSUPPORT_FILEFORMAT_TTF=%,$(RAY_RAYLIB_CONFIG)) -DSUPPORT_MODULE_RAUDIO=1 -DSUPPORT_FILEFORMAT_JPG=1 -DSUPPORT_FILEFORMAT_OGG=1 -DSUPPORT_FILEFORMAT_MP3=1 -DSUPPORT_FILEFORMAT_TTF=1 $(KRYON_RAYLIB_AUDIO_PERIOD_CONFIG) $(KRYON_RAYLIB_AUDIO_PERIODS_CONFIG)
|
||||
# Live radio uses raylib's MP3 push decoder on desktop hosts.
|
||||
$(RAYLIB_A) $(WIN64_RAYLIB_A): Makefile
|
||||
|
||||
COMMON_CFLAGS := -Wall -Wextra -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DUI_EMBEDDED_ONLY=1 -DNATIVE_WINDOW_HAVE_SDL -DKRYON_WITH_SYNC=1
|
||||
CFLAGS := $(COMMON_CFLAGS) -std=c99 $(RUNTIME_ASSET_CFLAGS) $(SYSTEM_THEME_CFLAGS) $(KRYON_NOTIFICATION_CPPFLAGS) $(KRYON_NOTIFICATION_CFLAGS)
|
||||
NATIVE_SYSTEM_LDLIBS := $(KRYON_NOTIFICATION_LDLIBS) -lz -lm -lpthread -latomic $(if $(filter linux,$(NATIVE_PLATFORM)),-ldl -lrt,) $(SYSTEM_THEME_LDLIBS)
|
||||
NATIVE_SYSTEM_LDLIBS := $(KRYON_NOTIFICATION_LDLIBS) -lz -lm -lpthread -latomic $(if $(filter linux,$(NATIVE_PLATFORM)),-ldl -lrt -lEGL -lGLESv2 -lGLX,) $(SYSTEM_THEME_LDLIBS)
|
||||
WINDOWS_CFLAGS := -Wall -Wextra -std=c99 -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DUI_EMBEDDED_ONLY=1 -DKRYON_WITH_SYNC=1
|
||||
WEB_CFLAGS := $(filter-out -Os -DNATIVE_WINDOW_HAVE_SDL,$(COMMON_CFLAGS)) -O2 -std=gnu99
|
||||
CLICK_CFLAGS := -Wall -Wextra -std=c99 -Os -D_DEFAULT_SOURCE -D_GNU_SOURCE -ffunction-sections -fdata-sections -DSUPPORT_FILEFORMAT_JPG=1 -DUI_EMBEDDED_ONLY=1 -DDISABLE_KRYON_FILE_DIALOG -DHAS_LIBCURL=1 -DKRYON_WITH_SYNC=1 $(AARCH64_KRYON_CURL_CFLAGS)
|
||||
LDFLAGS := -Wl,--gc-sections -s
|
||||
WINDOWS_LDFLAGS := -Wl,--gc-sections -static -static-libgcc -mwindows
|
||||
WINDOWS_LDLIBS := -lgdi32 -lwinmm -lopengl32 -luser32 -lshell32 -lole32 -lcomdlg32 -lcomctl32 -luuid -lwininet -lws2_32 -liphlpapi -lcrypt32 -lsecur32 -lbcrypt -ladvapi32 -lz -lm -latomic -lpthread
|
||||
WINDOWS_LDLIBS := -lgdi32 -lwinmm -luser32 -lshell32 -lole32 -lcomdlg32 -lcomctl32 -luuid -lwininet -lws2_32 -liphlpapi -lcrypt32 -lsecur32 -lbcrypt -ladvapi32 -lz -lm -latomic -lpthread
|
||||
ifneq ($(strip $(MCFGTHREADS)),)
|
||||
WIN64_THREAD_LDFLAGS := -L$(MCFGTHREADS)/lib
|
||||
else
|
||||
@@ -499,12 +532,14 @@ BINARY_NAME := $(APP_EXECUTABLE)-$(NATIVE_PLATFORM)-$(ARCH)
|
||||
TARGET := $(NATIVE_BIN_DIR)/$(BINARY_NAME)
|
||||
# Native sources compile to per-file objects through mk/native-objects.mk.
|
||||
NATIVE_OBJ_DIR := $(abspath $(BUILD_OBJ_DIR)/native)
|
||||
NATIVE_JOBS ?= $(shell nproc 2>/dev/null || echo 4)
|
||||
# Native objects build on half of the CPUs at low priority, so the desktop
|
||||
# and other work keep the machine. `NATIVE_JOBS=N` and `NATIVE_NICE=` override.
|
||||
NATIVE_JOBS ?= $(shell n=$$(nproc 2>/dev/null || echo 4); n=$$((n / 2)); \
|
||||
[ $$n -lt 1 ] && n=1; echo $$n)
|
||||
NATIVE_NICE ?= nice -n 10
|
||||
NATIVE_COMPILE_FLAGS = $(KRYON_NATIVE_CFLAGS) $(APP_INCLUDE) $(KRYON_INCLUDE) \
|
||||
-iquote$(KRYON_LIBRARY_BUILD_DIR)/c $(SQLITE_INCLUDE) $(LIBOQS_INCLUDE) \
|
||||
$(KRYON_NATIVE_BACKEND_CFLAGS) -DHAS_LIBOQS=1 -DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 -DSUPPORT_FILEFORMAT_MP3=1
|
||||
KRYON_HOST_TARGET := $(BUILD_DIR)/kryon/app_host.so
|
||||
$(KRYON_NATIVE_BACKEND_CFLAGS) -DHAS_LIBOQS=1
|
||||
WIN64_BINARY_NAME := $(APP_EXECUTABLE)-windows-$(WIN64_ARCH).exe
|
||||
WIN64_TARGET := $(WINDOWS_BIN_DIR)/$(WIN64_ARCH)/$(WIN64_BINARY_NAME)
|
||||
WINDOWS_DIST := $(WINDOWS_DIST_DIR)/$(APP_NAME)-windows.zip
|
||||
@@ -520,33 +555,20 @@ WEB_EMCMAKE ?= $(if $(wildcard $(WEB_EMSDK_BIN)/emcmake),$(WEB_EMSDK_BIN)/emcmak
|
||||
ifneq ($(wildcard $(WEB_EMSDK_BIN)/emcc),)
|
||||
export PATH := $(WEB_EMSDK_BIN):$(PATH)
|
||||
endif
|
||||
$(RAYLIB_A): $(RAYLIB_SOURCES) $(RAYLIB_DIR)/Makefile
|
||||
@test -f $(RAYLIB_DIR)/raylib.h || { echo "Initialize Kryon's raylib submodule" >&2; exit 1; }
|
||||
mkdir -p $(RAYLIB_BUILD_DIR)
|
||||
rm -rf $(RAYLIB_BUILD_DIR)/source
|
||||
mkdir -p $(RAYLIB_BUILD_DIR)/source
|
||||
cp -R $(RAYLIB_DIR)/. $(RAYLIB_BUILD_DIR)/source/
|
||||
$(MAKE) -j4 -C $(RAYLIB_BUILD_DIR)/source \
|
||||
RAYLIB_SRC_PATH=. RAYLIB_RELEASE_PATH=.. \
|
||||
PLATFORM=PLATFORM_DESKTOP_SDL GRAPHICS=GRAPHICS_API_OPENGL_ES2 \
|
||||
RAYLIB_LIBTYPE=STATIC RAYLIB_MODULE_AUDIO=TRUE \
|
||||
RAYLIB_MODULE_MODELS=TRUE \
|
||||
SDL_INCLUDE_PATH=$(shell pkg-config --variable=includedir sdl2) \
|
||||
CUSTOM_CFLAGS="-DUSING_SDL2_PROJECT $(RAY_CFLAGS) $(APP_RAYLIB_CONFIG) -O2 -ffunction-sections -fdata-sections"
|
||||
@test -f $@
|
||||
|
||||
KRYON_NATIVE_CFLAGS := $(CFLAGS)
|
||||
KRYON_SRCS += $(KRYON_RAYLIB_WRAPPERS_C)
|
||||
KRYON_NATIVE_BACKEND_DEPS := $(RAYLIB_A)
|
||||
KRYON_NATIVE_BACKEND_LIBS := $(RAYLIB_A)
|
||||
KRYON_NATIVE_BACKEND_CFLAGS := -DKRYON_BACKEND_RAYLIB=1 $(RAY_CFLAGS)
|
||||
KRYON_NATIVE_BACKEND_LDLIBS := $(RAY_LDLIBS)
|
||||
ifneq ($(strip $(APP_GIO_LDLIBS)),)
|
||||
KRYON_NATIVE_BACKEND_CFLAGS += -DAPP_HAVE_GIO $(APP_GIO_CFLAGS)
|
||||
NATIVE_SYSTEM_LDLIBS += $(APP_GIO_LDLIBS)
|
||||
endif
|
||||
KRYON_WINDOWS_SRCS += $(KRYON_RAYLIB_WRAPPERS_C)
|
||||
KRYON_CLICK_SRCS += $(KRYON_RAYLIB_WRAPPERS_C)
|
||||
$(WEBP_A): ziran.lock $(KRYON_DIR)/cmake/WebP.cmake $(KRYON_DIR)/cmake/ImagePackages.cmake $(KRYON_DIR)/cmake/webp/CMakeLists.txt $(wildcard build/packages/webp/native/*.cmake build/packages/libwebp/src/*/*.c build/packages/libwebp/src/*/*.h) | $(ZIRAN_BIN)
|
||||
$(CMAKE) -S $(KRYON_DIR)/cmake/webp -B $(WEBP_BUILD_DIR) -DWEBP_DIR="$(abspath build/packages/libwebp)" $(IMAGE_PACKAGE_DIRS) -DCMAKE_BUILD_TYPE=Release
|
||||
$(CMAKE) --build $(WEBP_BUILD_DIR) --target kryonwebp --parallel 2
|
||||
|
||||
$(AVIF_A) $(AOM_A) &: ziran.lock $(KRYON_DIR)/cmake/AVIF.cmake $(KRYON_DIR)/cmake/ImagePackages.cmake $(KRYON_DIR)/cmake/avif/CMakeLists.txt $(wildcard build/packages/avif/native/*.cmake) | $(ZIRAN_BIN)
|
||||
$(CMAKE) -S $(KRYON_DIR)/cmake/avif -B $(AVIF_BUILD_DIR) -DAVIF_DIR="$(abspath build/packages/libavif)" -DAOM_DIR="$(abspath build/packages/libaom)" $(IMAGE_PACKAGE_DIRS) -DCMAKE_BUILD_TYPE=Release
|
||||
$(CMAKE) --build $(AVIF_BUILD_DIR) --target avif_static aom --parallel 2
|
||||
@test -s "$(AVIF_A)" && test -s "$(AOM_A)"
|
||||
@touch -c "$(AVIF_A)" "$(AOM_A)"
|
||||
|
||||
include mk/native-desktop.mk
|
||||
|
||||
WEB_CACHE_BUSTER ?= $(shell if git diff --quiet --ignore-submodules HEAD -- 2>/dev/null; then git rev-parse --short HEAD 2>/dev/null; else date +%s; fi)
|
||||
WEB_CACHE_BUSTER := $(WEB_CACHE_BUSTER)
|
||||
WEB_TARGET := $(WEB_DIST_DIR)/index.html
|
||||
@@ -563,7 +585,7 @@ WEB_HOST_JS += $(WEB_CANVAS_HOST_JS)
|
||||
WEB_CANVAS_DIR := $(BUILD_DIST_DIR)/web-canvas
|
||||
WEB_CANVAS_TARGET := $(WEB_CANVAS_DIR)/index.html
|
||||
WEB_CANVAS_APP_SCRIPT := <script>window.__inbeRenderer="canvas";window.__inbeLoadApp("index.js?v=$(WEB_CACHE_BUSTER)")</script>
|
||||
KRYON_CANVAS_SRCS := $(filter-out $(KRYON_DIR)/src/backend/dom_%.c,$(filter-out $(KRYON_RAYLIB_WRAPPERS_C),$(KRYON_SRCS)))
|
||||
KRYON_CANVAS_SRCS := $(filter-out $(KRYON_DIR)/src/backend/dom_%.c,$(KRYON_SRCS))
|
||||
WEB_DIST_ZIP := $(BUILD_DIST_DIR)/$(APP_NAME)-web.zip
|
||||
WEB_SMOKE_BROWSER ?= auto
|
||||
WEB_SMOKE_TEST := scripts/web-smoke-test.mjs
|
||||
@@ -603,7 +625,7 @@ MEDITATION_AUDIO_TRACKS := \
|
||||
|
||||
include mk/package-freebsd.mk
|
||||
|
||||
.PHONY: web-canvas web-canvas-smoke-test web-compare-test web-side-by-side-test all native kryon-host install install-user uninstall stage package-freebsd deb package-deb deb-check rpm package-rpm rpm-check snap package-snap snap-cache-clean flatpak package-flatpak podman-check validate-desktop run run-fresh screenshot test ci dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows font-subsets font-bundle-check clean clean-linux clean-native clean-vendor-builds windows-setup windows-setup-check android-avd android-audio-e2e android-check-keystore android-copy-assets android-copy-debug-apks android-copy-release-apks android-copy-fdroid-apk android-copy-bundle android-smoke android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean android-rebuild validate-meditation-audio package-unpackaged-assets windows-runtime-assets-check windows windows64 web web-tools-check web-smoke-test web-smoke-test-firefox web-smoke-test-librewolf site site-release-assets-check chrome-web-store chrome-web-store-test firefox-addons firefox-addons-lint firefox-addons-source-zip verify-firefox-addons sync-web-icons
|
||||
.PHONY: web-canvas web-canvas-smoke-test web-compare-test web-side-by-side-test all native install install-user uninstall stage package-freebsd deb package-deb deb-check rpm package-rpm rpm-check snap package-snap snap-cache-clean flatpak package-flatpak podman-check validate-desktop run run-fresh screenshot test ci dist appimage click click-verify vendor-prebuilds vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows font-subsets font-bundle-check clean clean-linux clean-native clean-vendor-builds windows-setup windows-setup-check android-avd android-audio-e2e android-check-keystore android-copy-assets android-copy-debug-apks android-copy-release-apks android-copy-fdroid-apk android-copy-bundle android-smoke android-local-properties android-debug android-release android-bundle android-install android-install-release android-clean android-rebuild validate-meditation-audio package-unpackaged-assets windows-runtime-assets-check windows windows64 web web-tools-check web-smoke-test web-smoke-test-firefox web-smoke-test-librewolf site site-release-assets-check chrome-web-store chrome-web-store-test firefox-addons firefox-addons-lint firefox-addons-source-zip verify-firefox-addons sync-web-icons
|
||||
.PHONY: zi-check
|
||||
.PHONY: clean-text-api-check package-check secret-check secret-check-history hooks-install
|
||||
.NOTPARALLEL: all native test visual-test ci zi-check dist windows windows64 android-release android-bundle click deb package-deb rpm package-rpm snap package-snap flatpak package-flatpak
|
||||
@@ -621,10 +643,10 @@ $(ZIRAN_BIN): $(ZI2C_BIN)
|
||||
|
||||
zi-check: $(ZI_CHECK_STAMP) | build-laws
|
||||
|
||||
$(ZI_CHECK_STAMP): Makefile scripts/check-zi-sources.py $(ZI2C_BIN) \
|
||||
$(ZI_SRCS) $(DAOCHI_CLIENT_MODULES) $(wildcard build/packages/entity/src/*.zi) $(ZIRAN_STD_MODULES) \
|
||||
$(KRYON_UI_ZI) $(KRYON_KSS_ZI) $(GAME2D_MODULES) | build-laws
|
||||
@ZI_CHECK_DEFINES="$(ZI_NATIVE_DEFINES)" python3 scripts/check-zi-sources.py $(ZI2ZIR_BIN) $(KRYON_DIR)/src/ui $(ZIRAN_DIR)/std $(KSS_DIR)/src
|
||||
$(ZI_CHECK_STAMP): $(PACKAGES_MK) ziran.lock $(wildcard ziran.local.toml build/packages/*/ziran.toml) Makefile scripts/check-zi-sources.py scripts/package-paths.sh $(KRYON_DIR)/ziran.toml $(ZIRAN_BIN) \
|
||||
$(ZI_SRCS) $(PRACTICE_FIGURE_MODULES) $(MESH_CLIENT_MODULES) $(wildcard build/packages/entity/src/*.zi) $(ZIRAN_STD_MODULES) \
|
||||
$(KRYON_UI_ZI) $(KRYON_CSS_ZI) $(GAME2D_MODULES) | build-laws
|
||||
@ZI_CHECK_DEFINES="$(ZI_NATIVE_DEFINES)" python3 scripts/check-zi-sources.py $(ZIRAN_BIN)
|
||||
@mkdir -p $(dir $@)
|
||||
@touch $@
|
||||
|
||||
@@ -636,9 +658,15 @@ $(KRYON_LIBRARY_BUILD_DIR)/libkryon.a: $(KRYON_UI_ZI) $(KRYON_DIR)/src/ui/module
|
||||
ZIRAN_DIR=$(abspath $(ZIRAN_DIR)) ZIRAN_BUILD_DIR=$(ZIRAN_BUILD_DIR) \
|
||||
$(KRYON_LIBRARY_BUILD_DIR)/libkryon.a
|
||||
|
||||
native: $(TARGET)
|
||||
# Kryon's desktop decoder opens AVIF through libkryonavif.so beside the
|
||||
# program, from Kryon's pinned renderer-desktop artifact.
|
||||
NATIVE_AVIF_LIBRARY := $(NATIVE_BIN_DIR)/libkryonavif.so
|
||||
$(NATIVE_AVIF_LIBRARY): ziran.lock | $(ZIRAN_BIN)
|
||||
mkdir -p $(dir $@)
|
||||
@set -eu; descriptor=$$($(ZIRAN_BIN) pkg artifact kryon:renderer-desktop \
|
||||
--platform linux-$(ARCH)-gnu); cp "$$(dirname "$$descriptor")/lib/libkryonavif.so" $@
|
||||
|
||||
kryon-host: $(KRYON_HOST_TARGET)
|
||||
native: $(TARGET) $(NATIVE_AVIF_LIBRARY)
|
||||
|
||||
# Generate Kryon's checked Ziran modules into Inbe's build tree.
|
||||
$(KRYON_UI_STAMP): Makefile $(ZI2C_BIN) $(KRYON_UI_ZI) $(KRYON_DIR)/src/ui/modules.txt
|
||||
@@ -650,32 +678,41 @@ $(KRYON_UI_STAMP): Makefile $(ZI2C_BIN) $(KRYON_UI_ZI) $(KRYON_DIR)/src/ui/modul
|
||||
$(KRYON_UI_C) $(KRYON_UI_H): $(KRYON_UI_STAMP)
|
||||
@test -f $@
|
||||
|
||||
$(KRYON_KSS_STAMP): Makefile $(ZI2C_BIN) $(KRYON_KSS_ZI) $(KRYON_DIR)/src/ui/modules.txt
|
||||
$(KRYON_CSS_STAMP): Makefile $(ZI2C_BIN) $(KRYON_CSS_ZI) $(KRYON_DIR)/src/ui/modules.txt
|
||||
mkdir -p $(dir $@)
|
||||
$(ZI2C_BIN) --no-main --root $(KSS_DIR)/src \
|
||||
$(ZI2C_BIN) --no-main --root $(CSS_DIR)/src \
|
||||
--module-path $(KRYON_DIR)/src/ui --module-path kryon=$(KRYON_DIR)/src/ui --module-path kryon=$(KRYON_DIR)/src/backend \
|
||||
-o $(dir $@) $(KRYON_KSS_ZI)
|
||||
-o $(dir $@) $(KRYON_CSS_ZI)
|
||||
touch $@
|
||||
|
||||
$(KRYON_KSS_C) $(KRYON_KSS_H): $(KRYON_KSS_STAMP)
|
||||
$(KRYON_CSS_C) $(KRYON_CSS_H): $(KRYON_CSS_STAMP)
|
||||
@test -f $@
|
||||
|
||||
$(KRY_GEN_STAMP): Makefile ziran.lock $(ZI2C_BIN) $(ZI_SRCS) $(KRYON_ZI_MODULES) $(GAME2D_MODULES) $(DAOCHI_CLIENT_MODULES) $(wildcard build/packages/entity/src/*.zi) $(ZIRAN_STD_MODULES) $(SYNC_RETRY_SOURCE) | build-laws zi-check
|
||||
# Imports can change emitted paths; never retain an obsolete header/code pair.
|
||||
rm -rf $(KRY_GEN_DIR)
|
||||
# Rewritten only when the defines change, so setting or clearing one such as
|
||||
# KRYON_TEST_DRIVER regenerates the C and an unchanged build regenerates none.
|
||||
$(KRY_GEN_DEFINES): FORCE
|
||||
@mkdir -p $(dir $@)
|
||||
@printf '%s\n' '$(ZI_NATIVE_DEFINES)' > $@.new
|
||||
@if cmp -s $@.new $@; then rm -f $@.new; else mv $@.new $@; fi
|
||||
|
||||
$(PRACTICE_MEDIA_STAMP): FORCE
|
||||
@mkdir -p $(dir $@)
|
||||
@printf '%s\n' '$(abspath $(PRACTICE_MEDIA))' > $@.new
|
||||
@if cmp -s $@.new $@; then rm -f $@.new; else mv $@.new $@; fi
|
||||
|
||||
$(KRY_GEN_STAMP): $(wildcard ziran.local.toml build/packages/*/ziran.toml) Makefile ziran.lock scripts/package-paths.sh $(KRYON_DIR)/ziran.toml $(ZI2C_BIN) $(ZI_SRCS) $(PRACTICE_FIGURE_MODULES) $(KRYON_ZI_MODULES) $(GAME2D_MODULES) $(MESH_CLIENT_MODULES) $(wildcard build/packages/entity/src/*.zi) $(ZIRAN_STD_MODULES) $(SYNC_RETRY_SOURCE) $(KRY_GEN_DEFINES) | build-laws zi-check
|
||||
# --prune-stale removes generated files this run no longer writes, so an
|
||||
# obsolete header/code pair never survives. Unchanged files keep their
|
||||
# timestamps, so only C that actually changed recompiles.
|
||||
mkdir -p $(KRY_GEN_DIR)
|
||||
sh scripts/run-ziran.sh $(ZI2C_BIN) --no-main --prune-stale --root . \
|
||||
python3 scripts/stage-practice-figure.py
|
||||
sh scripts/run-ziran.sh $(ZIRAN_BIN) build --target=c --project --offline $(PACKAGE_FLAGS) \
|
||||
--module-path $(PRACTICE_FIGURE_DIR) --no-main --prune-stale --root . \
|
||||
$(foreach define,$(ZI_NATIVE_DEFINES),--define $(define)) \
|
||||
--module-path src --module-path $(KRYON_DIR)/src/ui \
|
||||
--module-path $(KSS_DIR)/src \
|
||||
--module-path $(KRYON_DIR)/src/backend \
|
||||
--module-path $(GAME2D_DIR)/src \
|
||||
--module-path $(ZIRAN_DIR)/std \
|
||||
--module-path $(DAOCHI_CLIENT_DIR) $(ZI_PACKAGE_PATHS) \
|
||||
-o $(KRY_GEN_DIR) $(ZI_SRCS)
|
||||
touch $@
|
||||
|
||||
$(KRY_GEN_SRCS) $(KRY_GEN_HDRS) $(KRY_GEN_GAME_C): $(KRY_GEN_STAMP)
|
||||
$(KRY_GEN_SRCS) $(KRY_GEN_HDRS): $(KRY_GEN_STAMP)
|
||||
|
||||
vendor-prebuilds: vendor-prebuilds-native vendor-prebuilds-web vendor-prebuilds-windows
|
||||
|
||||
@@ -683,7 +720,7 @@ vendor-prebuilds-native: $(KRYON_NATIVE_BACKEND_DEPS) $(SQLITE_AMALGAMATION_C) $
|
||||
|
||||
vendor-prebuilds-web: web-tools-check $(SQLITE_AMALGAMATION_C) $(SQLITE_AMALGAMATION_H) $(WEB_LIBOQS_A)
|
||||
|
||||
vendor-prebuilds-windows: $(WIN64_RAYLIB_A) $(WIN64_CURL_A) $(WIN64_LIBOQS_A) $(SQLITE_AMALGAMATION_C) $(SQLITE_AMALGAMATION_H)
|
||||
vendor-prebuilds-windows: $(WIN64_CURL_A) $(WIN64_LIBOQS_A) $(SQLITE_AMALGAMATION_C) $(SQLITE_AMALGAMATION_H)
|
||||
|
||||
run: $(TARGET)
|
||||
@root="$${XDG_DATA_HOME:-$$HOME/.local/share}/inbe-debug"; \
|
||||
@@ -701,11 +738,11 @@ FORCE:
|
||||
|
||||
.PHONY: theme-catalog-bundle-check
|
||||
theme-catalog-bundle-check:
|
||||
@cmp themes/catalog_light.kss $(KRYON_DIR)/themes/catalog_light.kss
|
||||
@cmp themes/catalog_dark.kss $(KRYON_DIR)/themes/catalog_dark.kss
|
||||
@cmp themes/catalog_light.css $(KRYON_DIR)/themes/catalog_light.css
|
||||
@cmp themes/catalog_dark.css $(KRYON_DIR)/themes/catalog_dark.css
|
||||
|
||||
$(EMBEDDED_ASSETS_C): Makefile $(EMBEDDED_ASSET_FILES) scripts/embed-app-assets.py src/app/assets_host.h | $(BUILD_OBJ_DIR) theme-catalog-bundle-check
|
||||
python3 scripts/embed-app-assets.py $@ $(EMBEDDED_ASSET_FILES)
|
||||
$(EMBEDDED_ASSETS_C): Makefile $(EMBEDDED_ASSET_FILES) $(APPS_BUNDLE) scripts/embed-app-assets.py src/app/assets_host.h | $(BUILD_OBJ_DIR) theme-catalog-bundle-check
|
||||
python3 scripts/embed-app-assets.py $@ $(EMBEDDED_ASSET_FILES) --apps-controller "$(APPS_BUNDLE)"
|
||||
|
||||
$(KRYON_ICON_ASSETS_C) $(KRYON_ICON_NAMES_C) $(KRYON_ICON_TYPES_H): $(KRYON_ICON_FILES) $(KRYON_DIR)/scripts/embed-icon-sheets.py | $(BUILD_OBJ_DIR)
|
||||
cd $(KRYON_DIR) && python3 scripts/embed-icon-sheets.py "$(KRYON_ICON_DIR)" \
|
||||
@@ -718,46 +755,27 @@ $(SQLITE_AMALGAMATION_C) $(SQLITE_AMALGAMATION_H): $(SQLITE_DIR)/configure $(SQL
|
||||
cd $(SQLITE_BUILD_DIR) && $(abspath $(SQLITE_DIR))/configure
|
||||
$(MAKE) -C $(SQLITE_BUILD_DIR) sqlite3.c sqlite3.h
|
||||
|
||||
$(TARGET): $(ZIRAN_BUILD_DIR)/libziran.a Makefile $(SRC) $(KRYON_LIBRARY_BUILD_DIR)/libkryon.a $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_FILES) $(EMBEDDED_ASSETS_C) $(KRYON_NATIVE_BACKEND_DEPS) $(LIBOQS_A) $(CURL_PROTOCOL_CHECK) | $(NATIVE_BIN_DIR)
|
||||
$(TARGET): $(ZIRAN_BUILD_DIR)/libziran.a Makefile $(SRC) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_FILES) $(EMBEDDED_ASSETS_C) $(KRYON_NATIVE_BACKEND_DEPS) $(LIBOQS_A) $(CURL_PROTOCOL_CHECK) | $(NATIVE_BIN_DIR)
|
||||
$(TARGET): | zi-check
|
||||
$(shell mkdir -p $(NATIVE_OBJ_DIR))
|
||||
$(file >$(NATIVE_OBJ_DIR)/inputs.mk,NATIVE_SOURCES := $(APP_SRCS) $(GENERATED_NATIVE_C) $(EMBEDDED_ASSETS_C) $(SQLITE_SRC))
|
||||
$(file >>$(NATIVE_OBJ_DIR)/inputs.mk,NATIVE_CFLAGS := $(NATIVE_COMPILE_FLAGS))
|
||||
+@$(MAKE) --no-print-directory -f mk/native-objects.mk \
|
||||
+@$(NATIVE_NICE) $(MAKE) --no-print-directory -f mk/native-objects.mk \
|
||||
$(if $(filter -j%,$(MAKEFLAGS)),,-j$(NATIVE_JOBS)) \
|
||||
CC='$(CC)' OBJ_DIR=$(NATIVE_OBJ_DIR)
|
||||
$(CC) $(KRYON_NATIVE_CFLAGS) \
|
||||
-o $@ \
|
||||
-o $@.next \
|
||||
@$(NATIVE_OBJ_DIR)/objects.rsp \
|
||||
$(KRYON_LIBRARY_BUILD_DIR)/libkryon.a $(ZIRAN_BUILD_DIR)/libziran.a \
|
||||
$(ZIRAN_BUILD_DIR)/libziran.a \
|
||||
$(KRYON_NATIVE_BACKEND_LIBS) \
|
||||
$(LIBOQS_A) \
|
||||
$(KRYON_NATIVE_BACKEND_LDLIBS) \
|
||||
$(RUNTIME_ASSET_LDLIBS) \
|
||||
$(NATIVE_SYSTEM_LDLIBS) \
|
||||
$(LDFLAGS)
|
||||
mv -f $@.next $@
|
||||
$(if $(filter linux,$(NATIVE_PLATFORM)),python3 scripts/check-package-size.py $@,)
|
||||
|
||||
$(KRYON_HOST_TARGET): $(ZIRAN_BUILD_DIR)/libziran.a Makefile $(KRYON_HOST_SRC) $(SQLITE_SRC) $(SQLITE_AMALGAMATION_H) $(FONT_FILES) $(EMBEDDED_ASSETS_C) | $(BUILD_DIR)
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(CFLAGS) -fPIC -shared \
|
||||
$(APP_INCLUDE) \
|
||||
$(KRYON_INCLUDE) \
|
||||
$(SQLITE_INCLUDE) \
|
||||
$(LIBOQS_INCLUDE) \
|
||||
$(RAY_CFLAGS) \
|
||||
-DHAS_LIBOQS=1 \
|
||||
-DSUPPORT_MODULE_RAUDIO=1 \
|
||||
-DSUPPORT_FILEFORMAT_OGG=1 \
|
||||
-DSUPPORT_FILEFORMAT_MP3=1 \
|
||||
-o $@ \
|
||||
$(KRYON_HOST_SRC) $(ZIRAN_BUILD_DIR)/libziran.a \
|
||||
$(SQLITE_SRC) \
|
||||
$(NATIVE_SYSTEM_LDLIBS) \
|
||||
-Wl,-Bsymbolic \
|
||||
-Wl,--allow-shlib-undefined \
|
||||
$(LDFLAGS)
|
||||
|
||||
clean:
|
||||
rm -rf build
|
||||
|
||||
@@ -778,20 +796,8 @@ NEEDS_NATIVE_ENV := $(if $(MAKECMDGOALS),$(filter all native install install-use
|
||||
# Check the build environment on that second read, against real sources.
|
||||
ifeq ($(PACKAGES_READY),1)
|
||||
ifneq ($(strip $(NEEDS_NATIVE_ENV)),)
|
||||
ifeq ($(strip $(RAY_CFLAGS)),)
|
||||
$(error RAY_CFLAGS is not set. Install pkg-config metadata for $(RAY_PKGS), or set RAY_CFLAGS explicitly)
|
||||
endif
|
||||
ifeq ($(strip $(RAY_LDLIBS)),)
|
||||
$(error RAY_LDLIBS is not set. Install pkg-config metadata for $(RAY_PKGS), or set RAY_LDLIBS explicitly)
|
||||
endif
|
||||
ifeq ($(strip $(RAY_SDL_LDLIBS)),)
|
||||
$(error RAY_SDL_LDLIBS is not set. Install SDL2 development files or set RAY_SDL_LDLIBS explicitly)
|
||||
endif
|
||||
ifeq ($(strip $(RAY_SDL_INCLUDE_DIR)),)
|
||||
$(error RAY_SDL_INCLUDE_DIR is not set. Install SDL2 development files or set RAY_SDL_INCLUDE_DIR explicitly)
|
||||
endif
|
||||
ifeq ($(strip $(RAY_RAYLIB_CONFIG)),)
|
||||
$(error RAY_RAYLIB_CONFIG is not set. Set RAY_RAYLIB_CONFIG explicitly)
|
||||
ifeq ($(strip $(DESKTOP_HOST_LDLIBS)),)
|
||||
$(error DESKTOP_HOST_LDLIBS is not set. Install pkg-config metadata for $(DESKTOP_HOST_PKGS), or set DESKTOP_HOST_CFLAGS and DESKTOP_HOST_LDLIBS explicitly)
|
||||
endif
|
||||
ifeq ($(strip $(KRYON_CURL_LDLIBS)),)
|
||||
$(error libcurl metadata is missing. Install libcurl pkg-config metadata or set KRYON_CURL_CFLAGS/KRYON_CURL_LDLIBS explicitly)
|
||||
@@ -817,7 +823,7 @@ $(APPIMAGE_TARGET) $(DEB_TARGET) $(RPM_TARGET) $(SNAP_TARGET) $(FLATPAK_TARGET)
|
||||
android-release android-bundle android-copy-release-apks android-copy-fdroid-apk android-copy-bundle windows-setup site: version-check
|
||||
|
||||
# Actual artifacts are gated too, including direct and incremental builds.
|
||||
$(TARGET) $(KRYON_HOST_TARGET) $(WIN64_TARGET) $(WEB_JS_TARGET) $(WEB_CANVAS_TARGET): $(SYNC_RETRY_SOURCE) | build-laws
|
||||
$(TARGET) $(WIN64_TARGET) $(WEB_JS_TARGET) $(WEB_CANVAS_TARGET): $(SYNC_RETRY_SOURCE) | build-laws
|
||||
|
||||
BUNDLE_RUNTIME_INPUTS := $(wildcard $(ZIRAN_DIR)/cmd/zir/*.[ch]) $(ZIRAN_DIR)/Makefile scripts/build-bundle-runtime.py
|
||||
WEB_BUNDLE_RUNTIME := $(abspath $(BUILD_DIR)/bundle-runtime/web/libziran.a)
|
||||
@@ -835,7 +841,7 @@ $(CLICK_BIN): $(CLICK_BUNDLE_RUNTIME)
|
||||
|
||||
# Build fragments affect the artifacts even when Makefile itself is unchanged.
|
||||
BUILD_MAKEFILES := $(filter-out mk/tests-%.mk,$(MAKEFILE_LIST)) mk/native-objects.mk
|
||||
$(TARGET) $(KRYON_HOST_TARGET) $(KRY_GEN_STAMP) $(WINDOWS_GEN_STAMP) $(WEB_GEN_STAMP) $(WIN64_TARGET) $(WEB_JS_TARGET) $(WEB_TARGET) $(WEB_CANVAS_TARGET) $(INBE_BUNDLE) $(INBE_FULL_BUNDLE) $(APP_BUNDLES): $(BUILD_MAKEFILES)
|
||||
$(TARGET) $(KRY_GEN_STAMP) $(WINDOWS_GEN_STAMP) $(WEB_GEN_STAMP) $(WIN64_TARGET) $(WEB_JS_TARGET) $(WEB_TARGET) $(WEB_CANVAS_TARGET) $(INBE_BUNDLE) $(INBE_FULL_BUNDLE) $(APP_BUNDLES): $(BUILD_MAKEFILES)
|
||||
|
||||
# UI prerequisites are expanded only after all artifact paths are defined.
|
||||
include mk/tests-lumi.mk
|
||||
@@ -848,4 +854,5 @@ include mk/tests-android.mk
|
||||
include mk/tests-web.mk
|
||||
include mk/tests-apps.mk
|
||||
include mk/tests-ui.mk
|
||||
include mk/tests-benchmark.mk
|
||||
include mk/tests-suite.mk
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"arcade": {
|
||||
"id": "inbe.arcade",
|
||||
"version": "0.7.126",
|
||||
"host_api": 43,
|
||||
"key_id": "inbe-2026-10",
|
||||
"bundled": true,
|
||||
"path": "apps/bundled/arcade.zx",
|
||||
"bytes": 10156,
|
||||
"sha256": "8879f61329c401b72fa843f7b92d520c65214598738f6cdafa73471454947f76",
|
||||
"source": "https://git.waozi.xyz/waozi/arcade",
|
||||
"source_commit": "fc3eb2b65f5ea84e30de86b2a1c6c3dc7c643c07",
|
||||
"sequence": 205
|
||||
}
|
||||
}
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,37 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Show synced edits for the open day as they arrive and preserve text still being edited.
|
||||
|
||||
- Read and edit formatted Diary entries with inline photos.
|
||||
|
||||
- Compare full-size AVIF copies with adjustable quality and storage totals; reopen image storage from the wrench in Diary or Photos.
|
||||
|
||||
## [1.3.27] - 2026-11-05
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.63.
|
||||
|
||||
## [1.3.26] - 2026-11-02
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.62.
|
||||
|
||||
## [1.3.25] - 2026-10-29
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.61.
|
||||
|
||||
## [1.3.24] - 2026-10-29
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.60.
|
||||
|
||||
## [1.3.23] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.59.
|
||||
|
||||
## [1.3.22] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.58.
|
||||
|
||||
## [1.3.21] - 2026-10-28
|
||||
|
||||
- Open each day’s photos from a gallery icon, attach photos with the paperclip, and keep the entry’s layout steady while browsing its gallery.
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"achievement_diary_days_1_title": "Catatan harian · 1 hari",
|
||||
"achievement_diary_days_1_description": "Lakukan ini pada 1 tanggal berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_days_3_title": "Catatan harian · 3 hari",
|
||||
"achievement_diary_days_3_description": "Lakukan ini pada 3 tanggal berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_days_7_title": "Catatan harian · 7 hari",
|
||||
"achievement_diary_days_7_description": "Lakukan ini pada 7 tanggal berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_days_14_title": "Catatan harian · 14 hari",
|
||||
"achievement_diary_days_14_description": "Lakukan ini pada 14 tanggal berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_days_30_title": "Catatan harian · 30 hari",
|
||||
"achievement_diary_days_30_description": "Lakukan ini pada 30 tanggal berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_days_60_title": "Catatan harian · 60 hari",
|
||||
"achievement_diary_days_60_description": "Lakukan ini pada 60 tanggal berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_days_100_title": "Catatan harian · 100 hari",
|
||||
"achievement_diary_days_100_description": "Lakukan ini pada 100 tanggal berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_days_180_title": "Catatan harian · 180 hari",
|
||||
"achievement_diary_days_180_description": "Lakukan ini pada 180 tanggal berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_days_365_title": "Catatan harian · 365 hari",
|
||||
"achievement_diary_days_365_description": "Lakukan ini pada 365 tanggal berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_weeks_2_title": "Catatan harian · 2 pekan",
|
||||
"achievement_diary_weeks_2_description": "Lakukan ini dalam 2 pekan kalender berbeda dari Senin hingga Minggu: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_weeks_4_title": "Catatan harian · 4 pekan",
|
||||
"achievement_diary_weeks_4_description": "Lakukan ini dalam 4 pekan kalender berbeda dari Senin hingga Minggu: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_weeks_12_title": "Catatan harian · 12 pekan",
|
||||
"achievement_diary_weeks_12_description": "Lakukan ini dalam 12 pekan kalender berbeda dari Senin hingga Minggu: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_weeks_26_title": "Catatan harian · 26 pekan",
|
||||
"achievement_diary_weeks_26_description": "Lakukan ini dalam 26 pekan kalender berbeda dari Senin hingga Minggu: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_months_3_title": "Catatan harian · 3 bulan",
|
||||
"achievement_diary_months_3_description": "Lakukan ini dalam 3 bulan kalender berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_months_6_title": "Catatan harian · 6 bulan",
|
||||
"achievement_diary_months_6_description": "Lakukan ini dalam 6 bulan kalender berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_months_12_title": "Catatan harian · 12 bulan",
|
||||
"achievement_diary_months_12_description": "Lakukan ini dalam 12 bulan kalender berbeda: entri catatan harian tersimpan yang berisi konten.",
|
||||
"achievement_diary_photo_days_1_title": "Catatan harian · 1 hari",
|
||||
"achievement_diary_photo_days_1_description": "Lakukan ini pada 1 tanggal berbeda: entri catatan harian tersimpan dengan foto sah.",
|
||||
"achievement_diary_photo_days_5_title": "Catatan harian · 5 hari",
|
||||
"achievement_diary_photo_days_5_description": "Lakukan ini pada 5 tanggal berbeda: entri catatan harian tersimpan dengan foto sah.",
|
||||
"achievement_diary_photo_days_20_title": "Catatan harian · 20 hari",
|
||||
"achievement_diary_photo_days_20_description": "Lakukan ini pada 20 tanggal berbeda: entri catatan harian tersimpan dengan foto sah.",
|
||||
"achievement_diary_return_14_title": "Catatan harian · 14 hari jeda",
|
||||
"achievement_diary_return_14_description": "Kembali setelah setidaknya 14 hari penuh tanpa aktivitas ini: entri catatan harian tersimpan yang berisi konten."
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"achievement_diary_days_1_title": "Diario · 1 giorni",
|
||||
"achievement_diary_days_1_description": "Fallo in 1 date distinte: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_days_3_title": "Diario · 3 giorni",
|
||||
"achievement_diary_days_3_description": "Fallo in 3 date distinte: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_days_7_title": "Diario · 7 giorni",
|
||||
"achievement_diary_days_7_description": "Fallo in 7 date distinte: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_days_14_title": "Diario · 14 giorni",
|
||||
"achievement_diary_days_14_description": "Fallo in 14 date distinte: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_days_30_title": "Diario · 30 giorni",
|
||||
"achievement_diary_days_30_description": "Fallo in 30 date distinte: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_days_60_title": "Diario · 60 giorni",
|
||||
"achievement_diary_days_60_description": "Fallo in 60 date distinte: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_days_100_title": "Diario · 100 giorni",
|
||||
"achievement_diary_days_100_description": "Fallo in 100 date distinte: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_days_180_title": "Diario · 180 giorni",
|
||||
"achievement_diary_days_180_description": "Fallo in 180 date distinte: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_days_365_title": "Diario · 365 giorni",
|
||||
"achievement_diary_days_365_description": "Fallo in 365 date distinte: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_weeks_2_title": "Diario · 2 settimane",
|
||||
"achievement_diary_weeks_2_description": "Fallo in 2 settimane di calendario distinte, da lunedì a domenica: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_weeks_4_title": "Diario · 4 settimane",
|
||||
"achievement_diary_weeks_4_description": "Fallo in 4 settimane di calendario distinte, da lunedì a domenica: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_weeks_12_title": "Diario · 12 settimane",
|
||||
"achievement_diary_weeks_12_description": "Fallo in 12 settimane di calendario distinte, da lunedì a domenica: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_weeks_26_title": "Diario · 26 settimane",
|
||||
"achievement_diary_weeks_26_description": "Fallo in 26 settimane di calendario distinte, da lunedì a domenica: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_months_3_title": "Diario · 3 mesi",
|
||||
"achievement_diary_months_3_description": "Fallo in 3 mesi di calendario distinti: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_months_6_title": "Diario · 6 mesi",
|
||||
"achievement_diary_months_6_description": "Fallo in 6 mesi di calendario distinti: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_months_12_title": "Diario · 12 mesi",
|
||||
"achievement_diary_months_12_description": "Fallo in 12 mesi di calendario distinti: una voce del diario salvata con contenuto.",
|
||||
"achievement_diary_photo_days_1_title": "Diario · 1 giorni",
|
||||
"achievement_diary_photo_days_1_description": "Fallo in 1 date distinte: una voce salvata del diario contenente una foto valida.",
|
||||
"achievement_diary_photo_days_5_title": "Diario · 5 giorni",
|
||||
"achievement_diary_photo_days_5_description": "Fallo in 5 date distinte: una voce salvata del diario contenente una foto valida.",
|
||||
"achievement_diary_photo_days_20_title": "Diario · 20 giorni",
|
||||
"achievement_diary_photo_days_20_description": "Fallo in 20 date distinte: una voce salvata del diario contenente una foto valida.",
|
||||
"achievement_diary_return_14_title": "Diario · 14 giorni di pausa",
|
||||
"achievement_diary_return_14_description": "Ritorna dopo almeno 14 giorni interi senza questa attività: una voce del diario salvata con contenuto."
|
||||
}
|
||||
+68
-1
@@ -10,7 +10,7 @@
|
||||
#import, file "diary_view.zi";
|
||||
#import, file "diary_date.zi";
|
||||
#import, file "diary_markdown.zi";
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "vec"
|
||||
#import "byte_text_linux"
|
||||
#import, file "diary_types.zi";
|
||||
@@ -388,6 +388,8 @@ Apply :: (message: DiaryMessage) -> DiaryMessage {
|
||||
entry: DiaryMessage;
|
||||
editor: DiaryUiFrame;
|
||||
loaded: bool;
|
||||
document_scope: string;
|
||||
document_revision: string;
|
||||
history: DiaryHistory;
|
||||
photo_waiting: bool;
|
||||
photo_day: Date;
|
||||
@@ -460,6 +462,68 @@ DiaryEnsureLoaded :: () {
|
||||
}
|
||||
}
|
||||
|
||||
DiaryRefreshPosition :: (position: s32, text: string) -> s32 {
|
||||
at := ifx position > text.count then cast(s32)text.count else position
|
||||
while at > 0 && at < text.count && DiaryContinuationByte(text[at]) {
|
||||
at -= 1
|
||||
}
|
||||
return at
|
||||
}
|
||||
|
||||
DiaryObserveDocuments :: (refresh: bool) {
|
||||
if !AppSupports("document.revision") {
|
||||
return
|
||||
}
|
||||
revision := AppService("document.revision", "")
|
||||
if revision == "" || revision == document_revision {
|
||||
return
|
||||
}
|
||||
separator := revision.count - 1
|
||||
while separator >= 0 && revision[separator] != cast(u8)58 {
|
||||
separator -= 1
|
||||
}
|
||||
if separator <= 0 {
|
||||
return
|
||||
}
|
||||
scope := revision[:separator]
|
||||
if document_scope != "" && scope != document_scope {
|
||||
// Keep the selected date, but never save or carry editor state from
|
||||
// another account into it.
|
||||
date := Date.{entry.year, entry.month, entry.day}
|
||||
entry = Apply(DiaryMessage.{.action = DIARY_LOAD, .year = date.year,
|
||||
.month = date.month, .day = date.day})
|
||||
loaded = entry.succeeded
|
||||
editor = DiaryUiFrame.{}
|
||||
DiaryHistoryClear(*history)
|
||||
photo_waiting = false
|
||||
spelling_sent = ""
|
||||
document_scope = scope
|
||||
document_revision = revision
|
||||
return
|
||||
}
|
||||
document_scope = scope
|
||||
if !refresh || (loaded && !entry.saved) {
|
||||
// Leave the revision pending while typing or retrying a failed save.
|
||||
return
|
||||
}
|
||||
document_revision = revision
|
||||
if !loaded {
|
||||
return
|
||||
}
|
||||
fresh := Load(entry, Date.{entry.year, entry.month, entry.day})
|
||||
// A manifest and its chunks may arrive on different sync pages. Keep
|
||||
// the current text until a later committed revision makes it readable.
|
||||
if fresh.load_error || (fresh.document == entry.document && !entry.load_error) {
|
||||
return
|
||||
}
|
||||
fresh.cursor = DiaryRefreshPosition(entry.cursor, fresh.text)
|
||||
fresh.anchor = DiaryRefreshPosition(entry.anchor, fresh.text)
|
||||
if fresh.text != entry.text {
|
||||
DiaryHistoryClear(*history)
|
||||
}
|
||||
entry = fresh
|
||||
}
|
||||
|
||||
DiaryHistoryApply :: (redo: bool) {
|
||||
changed := ifx redo then DiaryHistoryRedo(*history) else DiaryHistoryUndo(*history)
|
||||
if !changed { return }
|
||||
@@ -499,17 +563,20 @@ Main :: () -> s32 {
|
||||
return APP_PROTOCOL
|
||||
}
|
||||
if mode == APP_COMMAND {
|
||||
DiaryObserveDocuments(false)
|
||||
entry = Apply(DiaryMessageDecode(AppCommand()))
|
||||
loaded = entry.year > 0
|
||||
AppReply(DiaryMessageEncode(entry))
|
||||
return 0
|
||||
}
|
||||
if mode == APP_SAVE {
|
||||
DiaryObserveDocuments(false)
|
||||
if loaded { entry = Save(entry) }
|
||||
AppReply(DiaryMessageEncode(entry))
|
||||
return ifx !loaded || entry.saved || entry.load_error then 0 else 1
|
||||
}
|
||||
if mode != APP_FRAME { return 0 }
|
||||
DiaryObserveDocuments(true)
|
||||
DiaryEnsureLoaded()
|
||||
bounds := AppBounds()
|
||||
editor.session = AppSession()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "vec"
|
||||
#import "byte_text_linux"
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// within a moment is one step; a spelling correction, an undo and a redo are
|
||||
// steps of their own.
|
||||
#import "vec"
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "byte_text_linux"
|
||||
|
||||
DIARY_HISTORY_DEPTH :: 64
|
||||
|
||||
+19
-639
@@ -9,27 +9,31 @@
|
||||
// its type), or `` for a photo an older version attached
|
||||
// to the entry as a Diary file. Other images and text stay ordinary text.
|
||||
// An inserted photo gets a line of its own.
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "vec"
|
||||
#import "byte_text_linux"
|
||||
#import "text_props"
|
||||
Markdown :: #import "kryon/markdown_preview";
|
||||
|
||||
// Resolve Diary's media syntax for Kryon's shared Markdown editor. Keeping
|
||||
// one extra span lets the preview report its own image-capacity truncation.
|
||||
diary_images: [Markdown.PREVIEW_IMAGES + 1]Markdown.ImageSpan;
|
||||
|
||||
DiaryResolvedImages :: (text: string) -> []Markdown.ImageSpan {
|
||||
count: s32 = 0
|
||||
embed := DiaryEmbedNext(text, 0)
|
||||
while embed.valid && count < Markdown.PREVIEW_IMAGES + 1 {
|
||||
diary_images[count] = Markdown.ImageSpan.{.valid = true,
|
||||
.start = embed.start, .end = embed.end, .line_start = embed.line_start,
|
||||
.line_end = embed.line_end, .alt_end = embed.alt_end}
|
||||
count += 1
|
||||
embed = DiaryEmbedNext(text, embed.end)
|
||||
}
|
||||
return diary_images[:count]
|
||||
}
|
||||
|
||||
DIARY_EMBED_ALT_MAX :: 200
|
||||
DIARY_EMBED_NAME_MAX :: 200
|
||||
|
||||
DIARY_TONE_MUTED :: 1
|
||||
DIARY_TONE_LINK :: 2
|
||||
|
||||
// What the editor shows for one entry, rebuilt every frame.
|
||||
DIARY_PREVIEW_RANGES :: 512
|
||||
DIARY_PREVIEW_TONES :: 256
|
||||
DIARY_PREVIEW_HEADINGS :: 128
|
||||
DIARY_PREVIEW_PHOTOS :: 64
|
||||
// What one line may add; a line that would not fit ends the preview there.
|
||||
DIARY_LINE_MARKS :: 64
|
||||
DIARY_LINE_LINKS :: 16
|
||||
DIARY_LINE_RUNS :: 64
|
||||
|
||||
DiaryEmbed :: struct {
|
||||
valid: bool
|
||||
// The image's bytes, from its `!` to its closing parenthesis.
|
||||
@@ -58,47 +62,6 @@ DiaryEmbedEdit :: struct {
|
||||
cursor: s32
|
||||
}
|
||||
|
||||
// A color role for bytes of the entry.
|
||||
DiaryTone :: struct {
|
||||
start: s32
|
||||
end: s32
|
||||
tone: s32
|
||||
}
|
||||
|
||||
// A heading's line and level (1 to 6).
|
||||
DiaryHeading :: struct {
|
||||
start: s32
|
||||
level: s32
|
||||
}
|
||||
|
||||
// A photo drawn for an embed under its line, after the line's earlier
|
||||
// photos. On a line of photos alone, away from the caret, the first one
|
||||
// takes the hidden line's place (cover).
|
||||
DiaryPhotoBlock :: struct {
|
||||
embed: DiaryEmbed
|
||||
cover: bool
|
||||
}
|
||||
|
||||
// Every list is sorted by start and disjoint, as Kryon's TextArea requires.
|
||||
DiaryPreview :: struct {
|
||||
hidden: [DIARY_PREVIEW_RANGES]TextRange
|
||||
hidden_count: s32
|
||||
strong: [DIARY_PREVIEW_RANGES]TextRange
|
||||
strong_count: s32
|
||||
italic: [DIARY_PREVIEW_RANGES]TextRange
|
||||
italic_count: s32
|
||||
tones: [DIARY_PREVIEW_TONES]DiaryTone
|
||||
tone_count: s32
|
||||
headings: [DIARY_PREVIEW_HEADINGS]DiaryHeading
|
||||
heading_count: s32
|
||||
photos: [DIARY_PREVIEW_PHOTOS]DiaryPhotoBlock
|
||||
photo_count: s32
|
||||
// Lines after the last one that fit are shown as plain text.
|
||||
truncated: bool
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- lines
|
||||
|
||||
DiaryLineEnd :: (text: string, start: s32) -> s32 {
|
||||
end := start
|
||||
while end < cast(s32)text.count && text[end] != cast(u8)10 {
|
||||
@@ -507,171 +470,6 @@ DiaryEmbedInsertion :: (text: string, at: s32, line: string) -> DiaryEmbedEdit {
|
||||
return edit
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- preview
|
||||
|
||||
// One line's marks before they are sorted into the preview.
|
||||
DiaryLineMarks :: struct {
|
||||
hidden: [DIARY_LINE_MARKS]TextRange
|
||||
hidden_count: s32
|
||||
strong: [DIARY_LINE_MARKS]TextRange
|
||||
strong_count: s32
|
||||
italic: [DIARY_LINE_MARKS]TextRange
|
||||
italic_count: s32
|
||||
tones: [DIARY_LINE_MARKS]DiaryTone
|
||||
tone_count: s32
|
||||
// A mark did not fit; the line is shown as plain text.
|
||||
overflow: bool
|
||||
}
|
||||
|
||||
// A link or inline image on a line: `[` at open, text up to text_end, then
|
||||
// `](destination)` up to end.
|
||||
DiaryLink :: struct {
|
||||
open: s32
|
||||
text_end: s32
|
||||
end: s32
|
||||
image: bool
|
||||
// An image whose destination is a photo: an embed.
|
||||
photo: bool
|
||||
}
|
||||
|
||||
// A run of `*` or `_` delimiters for emphasis.
|
||||
DiaryRun :: struct {
|
||||
start: s32
|
||||
length: s32
|
||||
marker: u8
|
||||
can_open: bool
|
||||
can_close: bool
|
||||
// Delimiters still unmatched, taken from its right as an opener and
|
||||
// from its left as a closer.
|
||||
left: s32
|
||||
taken: s32
|
||||
dead: bool
|
||||
}
|
||||
|
||||
diary_line: DiaryLineMarks;
|
||||
diary_links: [DIARY_LINE_LINKS]DiaryLink;
|
||||
diary_link_count: s32;
|
||||
diary_runs: [DIARY_LINE_RUNS]DiaryRun;
|
||||
|
||||
DiaryMarkHidden :: (marks: *DiaryLineMarks, start: s32, end: s32) {
|
||||
if end <= start {
|
||||
return
|
||||
}
|
||||
if marks.hidden_count >= DIARY_LINE_MARKS {
|
||||
marks.overflow = true
|
||||
return
|
||||
}
|
||||
marks.hidden[marks.hidden_count] = TextRange.{.start = start, .end = end}
|
||||
marks.hidden_count += 1
|
||||
}
|
||||
|
||||
DiaryMarkStrong :: (marks: *DiaryLineMarks, start: s32, end: s32) {
|
||||
if end <= start {
|
||||
return
|
||||
}
|
||||
if marks.strong_count >= DIARY_LINE_MARKS {
|
||||
marks.overflow = true
|
||||
return
|
||||
}
|
||||
marks.strong[marks.strong_count] = TextRange.{.start = start, .end = end}
|
||||
marks.strong_count += 1
|
||||
}
|
||||
|
||||
DiaryMarkItalic :: (marks: *DiaryLineMarks, start: s32, end: s32) {
|
||||
if end <= start {
|
||||
return
|
||||
}
|
||||
if marks.italic_count >= DIARY_LINE_MARKS {
|
||||
marks.overflow = true
|
||||
return
|
||||
}
|
||||
marks.italic[marks.italic_count] = TextRange.{.start = start, .end = end}
|
||||
marks.italic_count += 1
|
||||
}
|
||||
|
||||
DiaryMarkTone :: (marks: *DiaryLineMarks, start: s32, end: s32, tone: s32) {
|
||||
if end <= start {
|
||||
return
|
||||
}
|
||||
if marks.tone_count >= DIARY_LINE_MARKS {
|
||||
marks.overflow = true
|
||||
return
|
||||
}
|
||||
marks.tones[marks.tone_count] = DiaryTone.{.start = start, .end = end, .tone = tone}
|
||||
marks.tone_count += 1
|
||||
}
|
||||
|
||||
// Sorts ranges by start and joins those that overlap or touch, so nested
|
||||
// emphasis of one kind reads as one range.
|
||||
DiaryJoinRanges :: (ranges: []TextRange, count: s32) -> s32 {
|
||||
for index: cast(s32)1..count - 1 {
|
||||
value := ranges[index]
|
||||
at := index
|
||||
while at > 0 && ranges[at - 1].start > value.start {
|
||||
ranges[at] = ranges[at - 1]
|
||||
at -= 1
|
||||
}
|
||||
ranges[at] = value
|
||||
}
|
||||
joined: s32 = 0
|
||||
for index: cast(s32)0..count - 1 {
|
||||
if joined > 0 && ranges[index].start <= ranges[joined - 1].end {
|
||||
if ranges[index].end > ranges[joined - 1].end {
|
||||
ranges[joined - 1].end = ranges[index].end
|
||||
}
|
||||
continue
|
||||
}
|
||||
ranges[joined] = ranges[index]
|
||||
joined += 1
|
||||
}
|
||||
return joined
|
||||
}
|
||||
|
||||
// Sorts hidden markers by start. Markers never overlap; one that would is
|
||||
// shown instead.
|
||||
DiarySortHidden :: (ranges: []TextRange, count: s32) -> s32 {
|
||||
for index: cast(s32)1..count - 1 {
|
||||
value := ranges[index]
|
||||
at := index
|
||||
while at > 0 && ranges[at - 1].start > value.start {
|
||||
ranges[at] = ranges[at - 1]
|
||||
at -= 1
|
||||
}
|
||||
ranges[at] = value
|
||||
}
|
||||
kept: s32 = 0
|
||||
for index: cast(s32)0..count - 1 {
|
||||
if kept > 0 && ranges[index].start < ranges[kept - 1].end {
|
||||
continue
|
||||
}
|
||||
ranges[kept] = ranges[index]
|
||||
kept += 1
|
||||
}
|
||||
return kept
|
||||
}
|
||||
|
||||
DiarySortTones :: (tones: []DiaryTone, count: s32) -> s32 {
|
||||
for index: cast(s32)1..count - 1 {
|
||||
value := tones[index]
|
||||
at := index
|
||||
while at > 0 && tones[at - 1].start > value.start {
|
||||
tones[at] = tones[at - 1]
|
||||
at -= 1
|
||||
}
|
||||
tones[at] = value
|
||||
}
|
||||
kept: s32 = 0
|
||||
for index: cast(s32)0..count - 1 {
|
||||
if kept > 0 && tones[index].start < tones[kept - 1].end {
|
||||
continue
|
||||
}
|
||||
tones[kept] = tones[index]
|
||||
kept += 1
|
||||
}
|
||||
return kept
|
||||
}
|
||||
|
||||
// A byte escaped by an odd number of backslashes before it.
|
||||
DiaryEscaped :: (text: string, at: s32, from: s32) -> bool {
|
||||
slashes: s32 = 0
|
||||
cursor := at - 1
|
||||
@@ -681,421 +479,3 @@ DiaryEscaped :: (text: string, at: s32, from: s32) -> bool {
|
||||
}
|
||||
return slashes % 2 == 1
|
||||
}
|
||||
|
||||
DiaryPunctuation :: (byte: u8) -> bool {
|
||||
return (byte >= cast(u8)33 && byte <= cast(u8)47) || (byte >= cast(u8)58 && byte <= cast(u8)64) ||
|
||||
(byte >= cast(u8)91 && byte <= cast(u8)96) || (byte >= cast(u8)123 && byte <= cast(u8)126)
|
||||
}
|
||||
|
||||
// Photos, links and other inline images on text[from:to]. A photo is read
|
||||
// as an embed; other destinations hold no spaces, as CommonMark's plain
|
||||
// destinations, and their titles and angle brackets stay text.
|
||||
DiaryFindLinks :: (text: string, from: s32, to: s32) {
|
||||
diary_link_count = 0
|
||||
at := from
|
||||
while at < to && diary_link_count < DIARY_LINE_LINKS {
|
||||
if text[at] == #char "!" {
|
||||
embed := DiaryEmbedAt(text, at)
|
||||
if embed.valid && embed.end <= to {
|
||||
diary_links[diary_link_count] = DiaryLink.{.open = at + 1, .text_end = embed.alt_end,
|
||||
.end = embed.end, .image = true, .photo = true}
|
||||
diary_link_count += 1
|
||||
at = embed.end
|
||||
continue
|
||||
}
|
||||
}
|
||||
if text[at] != #char "[" || DiaryEscaped(text, at, from) {
|
||||
at += 1
|
||||
continue
|
||||
}
|
||||
image := at > from && text[at - 1] == #char "!" && !DiaryEscaped(text, at - 1, from)
|
||||
close := at + 1
|
||||
while close < to && text[close] != #char "]" && text[close] != #char "[" {
|
||||
close += 1
|
||||
}
|
||||
if close >= to || text[close] != #char "]" || close + 1 >= to || text[close + 1] != #char "(" {
|
||||
at += 1
|
||||
continue
|
||||
}
|
||||
end := close + 2
|
||||
while end < to && text[end] != #char ")" && !DiaryBlank(text[end]) {
|
||||
end += 1
|
||||
}
|
||||
if end >= to || text[end] != #char ")" || end == close + 2 {
|
||||
at += 1
|
||||
continue
|
||||
}
|
||||
diary_links[diary_link_count] = DiaryLink.{.open = at, .text_end = close, .end = end + 1, .image = image}
|
||||
diary_link_count += 1
|
||||
at = end + 1
|
||||
}
|
||||
}
|
||||
|
||||
// Whether at lies inside a link or inline image found on the line. Emphasis
|
||||
// around a link treats it as one piece; its text pairs on its own.
|
||||
DiaryLinkSyntax :: (at: s32) -> bool {
|
||||
for index: cast(s32)0..diary_link_count - 1 {
|
||||
link := diary_links[index]
|
||||
start := link.open
|
||||
if link.image {
|
||||
start -= 1
|
||||
}
|
||||
if at >= start && at < link.end {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Emphasis on text[from:to] with CommonMark's flanking rules and its rule of
|
||||
// three, within one line. Matched markers hide away from the caret's line.
|
||||
DiaryEmphasis :: (marks: *DiaryLineMarks, text: string, from: s32, to: s32, active: bool) {
|
||||
count: s32 = 0
|
||||
at := from
|
||||
while at < to {
|
||||
byte := text[at]
|
||||
if (byte != #char "*" && byte != #char "_") || DiaryEscaped(text, at, from) || DiaryLinkSyntax(at) {
|
||||
at += 1
|
||||
continue
|
||||
}
|
||||
end := at
|
||||
while end < to && text[end] == byte && !DiaryLinkSyntax(end) {
|
||||
end += 1
|
||||
}
|
||||
if count >= DIARY_LINE_RUNS {
|
||||
marks.overflow = true
|
||||
return
|
||||
}
|
||||
before: u8 = 32
|
||||
if at > from {
|
||||
before = text[at - 1]
|
||||
}
|
||||
after: u8 = 32
|
||||
if end < to {
|
||||
after = text[end]
|
||||
}
|
||||
before_space := DiaryBlank(before)
|
||||
after_space := DiaryBlank(after)
|
||||
left_flanking := !after_space &&
|
||||
(!DiaryPunctuation(after) || before_space || DiaryPunctuation(before))
|
||||
right_flanking := !before_space &&
|
||||
(!DiaryPunctuation(before) || after_space || DiaryPunctuation(after))
|
||||
run: DiaryRun
|
||||
run.start = at
|
||||
run.length = end - at
|
||||
run.left = run.length
|
||||
run.marker = byte
|
||||
if byte == #char "*" {
|
||||
run.can_open = left_flanking
|
||||
run.can_close = right_flanking
|
||||
} else {
|
||||
run.can_open = left_flanking && (!right_flanking || DiaryPunctuation(before))
|
||||
run.can_close = right_flanking && (!left_flanking || DiaryPunctuation(after))
|
||||
}
|
||||
diary_runs[count] = run
|
||||
count += 1
|
||||
at = end
|
||||
}
|
||||
for closer: cast(s32)0..count - 1 {
|
||||
if !diary_runs[closer].can_close {
|
||||
continue
|
||||
}
|
||||
while diary_runs[closer].left > 0 {
|
||||
opener: s32 = -1
|
||||
candidate := closer - 1
|
||||
while candidate >= 0 {
|
||||
run := diary_runs[candidate]
|
||||
if !run.dead && run.can_open && run.left > 0 && run.marker == diary_runs[closer].marker {
|
||||
both := run.can_close || diary_runs[closer].can_open
|
||||
sum := run.length + diary_runs[closer].length
|
||||
three := both && sum % 3 == 0 &&
|
||||
!(run.length % 3 == 0 && diary_runs[closer].length % 3 == 0)
|
||||
if !three {
|
||||
opener = candidate
|
||||
break
|
||||
}
|
||||
}
|
||||
candidate -= 1
|
||||
}
|
||||
if opener < 0 {
|
||||
break
|
||||
}
|
||||
// Openers between the pair can no longer match.
|
||||
for between: opener + 1..closer - 1 {
|
||||
diary_runs[between].dead = true
|
||||
}
|
||||
use: s32 = 1
|
||||
if diary_runs[opener].left >= 2 && diary_runs[closer].left >= 2 {
|
||||
use = 2
|
||||
}
|
||||
content_start := diary_runs[opener].start + diary_runs[opener].left
|
||||
content_end := diary_runs[closer].start + diary_runs[closer].taken
|
||||
if !active {
|
||||
DiaryMarkHidden(marks, content_start - use, content_start)
|
||||
DiaryMarkHidden(marks, content_end, content_end + use)
|
||||
}
|
||||
if use == 2 {
|
||||
DiaryMarkStrong(marks, content_start, content_end)
|
||||
} else {
|
||||
DiaryMarkItalic(marks, content_start, content_end)
|
||||
}
|
||||
diary_runs[opener].left -= use
|
||||
diary_runs[closer].left -= use
|
||||
diary_runs[closer].taken += use
|
||||
}
|
||||
if diary_runs[closer].left > 0 && !diary_runs[closer].can_open {
|
||||
diary_runs[closer].dead = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Links, then emphasis around and inside them, on text[from:to].
|
||||
DiaryInline :: (marks: *DiaryLineMarks, text: string, from: s32, to: s32, active: bool, quoted: bool) {
|
||||
DiaryFindLinks(text, from, to)
|
||||
links: [DIARY_LINE_LINKS]DiaryLink
|
||||
link_count := diary_link_count
|
||||
for index: cast(s32)0..link_count - 1 {
|
||||
links[index] = diary_links[index]
|
||||
}
|
||||
DiaryEmphasis(marks, text, from, to, active)
|
||||
for index: cast(s32)0..link_count - 1 {
|
||||
link := links[index]
|
||||
// A photo is drawn under its line; its Markdown hides like a link's.
|
||||
if link.photo && !active {
|
||||
DiaryMarkHidden(marks, link.open - 1, link.end)
|
||||
}
|
||||
if link.image {
|
||||
continue
|
||||
}
|
||||
if !active {
|
||||
DiaryMarkHidden(marks, link.open, link.open + 1)
|
||||
DiaryMarkHidden(marks, link.text_end, link.end)
|
||||
}
|
||||
if !quoted {
|
||||
DiaryMarkTone(marks, link.open + 1, link.text_end, DIARY_TONE_LINK)
|
||||
}
|
||||
// Emphasis inside a link's text pairs only there.
|
||||
diary_link_count = 0
|
||||
DiaryEmphasis(marks, text, link.open + 1, link.text_end, active)
|
||||
}
|
||||
}
|
||||
|
||||
// A heading's level and where its text starts, or level 0.
|
||||
DiaryHeadingAt :: (text: string, start: s32, end: s32) -> DiaryHeading {
|
||||
heading: DiaryHeading
|
||||
at := start
|
||||
while at < end && at - start < 3 && text[at] == cast(u8)32 {
|
||||
at += 1
|
||||
}
|
||||
level: s32 = 0
|
||||
while at < end && text[at] == #char "#" && level < 7 {
|
||||
level += 1
|
||||
at += 1
|
||||
}
|
||||
if level < 1 || level > 6 || (at < end && !DiaryBlank(text[at])) {
|
||||
return heading
|
||||
}
|
||||
heading.level = level
|
||||
heading.start = at
|
||||
return heading
|
||||
}
|
||||
|
||||
// Where a list item's marker ends (before its spaces), or -1.
|
||||
DiaryListMarkerEnd :: (text: string, start: s32, end: s32) -> s32 {
|
||||
at := start
|
||||
while at < end && DiaryBlank(text[at]) {
|
||||
at += 1
|
||||
}
|
||||
if at >= end {
|
||||
return -1
|
||||
}
|
||||
marker := text[at]
|
||||
if marker == #char "-" || marker == #char "*" || marker == #char "+" {
|
||||
at += 1
|
||||
} else {
|
||||
digits: s32 = 0
|
||||
while at < end && text[at] >= cast(u8)48 && text[at] <= cast(u8)57 && digits < 10 {
|
||||
at += 1
|
||||
digits += 1
|
||||
}
|
||||
if digits < 1 || digits > 9 || at >= end || (text[at] != #char "." && text[at] != #char ")") {
|
||||
return -1
|
||||
}
|
||||
at += 1
|
||||
}
|
||||
if at < end && !DiaryBlank(text[at]) {
|
||||
return -1
|
||||
}
|
||||
return at
|
||||
}
|
||||
|
||||
// Where a quote's text starts after `>` and one space, or -1.
|
||||
DiaryQuoteStart :: (text: string, start: s32, end: s32) -> s32 {
|
||||
at := start
|
||||
while at < end && at - start < 3 && text[at] == cast(u8)32 {
|
||||
at += 1
|
||||
}
|
||||
if at >= end || text[at] != #char ">" {
|
||||
return -1
|
||||
}
|
||||
at += 1
|
||||
if at < end && DiaryBlank(text[at]) {
|
||||
at += 1
|
||||
}
|
||||
return at
|
||||
}
|
||||
|
||||
// A heading's closing `#` run with the spaces before it, hidden like its
|
||||
// opening marker: the start of that tail, or end when there is none.
|
||||
DiaryHeadingTail :: (text: string, from: s32, end: s32) -> s32 {
|
||||
last := end
|
||||
while last > from && DiaryBlank(text[last - 1]) {
|
||||
last -= 1
|
||||
}
|
||||
hashes := last
|
||||
while hashes > from && text[hashes - 1] == #char "#" {
|
||||
hashes -= 1
|
||||
}
|
||||
if hashes == last {
|
||||
return end
|
||||
}
|
||||
if hashes == from {
|
||||
return from
|
||||
}
|
||||
if !DiaryBlank(text[hashes - 1]) {
|
||||
return end
|
||||
}
|
||||
tail := hashes
|
||||
while tail > from && DiaryBlank(text[tail - 1]) {
|
||||
tail -= 1
|
||||
}
|
||||
return tail
|
||||
}
|
||||
|
||||
DiaryPreviewAdd :: (preview: *DiaryPreview, marks: *DiaryLineMarks) -> bool {
|
||||
marks.hidden_count = DiarySortHidden(marks.hidden[:], marks.hidden_count)
|
||||
marks.strong_count = DiaryJoinRanges(marks.strong[:], marks.strong_count)
|
||||
marks.italic_count = DiaryJoinRanges(marks.italic[:], marks.italic_count)
|
||||
marks.tone_count = DiarySortTones(marks.tones[:], marks.tone_count)
|
||||
if preview.hidden_count + marks.hidden_count > DIARY_PREVIEW_RANGES ||
|
||||
preview.strong_count + marks.strong_count > DIARY_PREVIEW_RANGES ||
|
||||
preview.italic_count + marks.italic_count > DIARY_PREVIEW_RANGES ||
|
||||
preview.tone_count + marks.tone_count > DIARY_PREVIEW_TONES {
|
||||
return false
|
||||
}
|
||||
for index: cast(s32)0..marks.hidden_count - 1 {
|
||||
preview.hidden[preview.hidden_count] = marks.hidden[index]
|
||||
preview.hidden_count += 1
|
||||
}
|
||||
for index: cast(s32)0..marks.strong_count - 1 {
|
||||
preview.strong[preview.strong_count] = marks.strong[index]
|
||||
preview.strong_count += 1
|
||||
}
|
||||
for index: cast(s32)0..marks.italic_count - 1 {
|
||||
preview.italic[preview.italic_count] = marks.italic[index]
|
||||
preview.italic_count += 1
|
||||
}
|
||||
for index: cast(s32)0..marks.tone_count - 1 {
|
||||
preview.tones[preview.tone_count] = marks.tones[index]
|
||||
preview.tone_count += 1
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// Builds the preview of text for the caret and selection between cursor and
|
||||
// anchor. While editing, the lines they touch show their Markdown as typed.
|
||||
DiaryPreviewScan :: (preview: *DiaryPreview, text: string, cursor: s32, anchor: s32, editing: bool) {
|
||||
preview.hidden_count = 0
|
||||
preview.strong_count = 0
|
||||
preview.italic_count = 0
|
||||
preview.tone_count = 0
|
||||
preview.heading_count = 0
|
||||
preview.photo_count = 0
|
||||
preview.truncated = false
|
||||
first := ifx cursor < anchor then cursor else anchor
|
||||
last := ifx cursor < anchor then anchor else cursor
|
||||
line: s32 = 0
|
||||
count := cast(s32)text.count
|
||||
while line <= count {
|
||||
end := DiaryLineEnd(text, line)
|
||||
active := editing && last >= line && first <= end
|
||||
// The line's photos are drawn under it, in order.
|
||||
line_photos := preview.photo_count
|
||||
embed := DiaryEmbedIn(text, line, end)
|
||||
while embed.valid {
|
||||
if preview.photo_count >= DIARY_PREVIEW_PHOTOS {
|
||||
preview.truncated = true
|
||||
return
|
||||
}
|
||||
preview.photos[preview.photo_count] = DiaryPhotoBlock.{.embed = embed}
|
||||
preview.photo_count += 1
|
||||
embed = DiaryEmbedIn(text, embed.end, end)
|
||||
}
|
||||
// A line of photos alone shows its first photo in its place.
|
||||
if preview.photo_count > line_photos && DiaryImageLine(text, line) {
|
||||
if !active {
|
||||
if preview.hidden_count >= DIARY_PREVIEW_RANGES {
|
||||
preview.truncated = true
|
||||
return
|
||||
}
|
||||
preview.photos[line_photos].cover = true
|
||||
preview.hidden[preview.hidden_count] = TextRange.{.start = line, .end = end}
|
||||
preview.hidden_count += 1
|
||||
}
|
||||
line = end + 1
|
||||
continue
|
||||
}
|
||||
diary_line = DiaryLineMarks.{}
|
||||
content := line
|
||||
quoted := false
|
||||
heading := DiaryHeadingAt(text, line, end)
|
||||
if heading.level > 0 {
|
||||
if preview.heading_count >= DIARY_PREVIEW_HEADINGS {
|
||||
preview.truncated = true
|
||||
return
|
||||
}
|
||||
preview.headings[preview.heading_count] = DiaryHeading.{.start = line, .level = heading.level}
|
||||
text_start := heading.start
|
||||
while text_start < end && DiaryBlank(text[text_start]) {
|
||||
text_start += 1
|
||||
}
|
||||
tail := DiaryHeadingTail(text, text_start, end)
|
||||
if !active {
|
||||
DiaryMarkHidden(*diary_line, line, text_start)
|
||||
DiaryMarkHidden(*diary_line, tail, end)
|
||||
}
|
||||
DiaryMarkStrong(*diary_line, text_start, tail)
|
||||
DiaryInline(*diary_line, text, text_start, tail, active, false)
|
||||
} else {
|
||||
quote := DiaryQuoteStart(text, line, end)
|
||||
if quote >= 0 {
|
||||
quoted = true
|
||||
DiaryMarkTone(*diary_line, line, end, DIARY_TONE_MUTED)
|
||||
content = quote
|
||||
} else {
|
||||
marker := DiaryListMarkerEnd(text, line, end)
|
||||
if marker >= 0 {
|
||||
marker_start := line
|
||||
while DiaryBlank(text[marker_start]) {
|
||||
marker_start += 1
|
||||
}
|
||||
DiaryMarkTone(*diary_line, marker_start, marker, DIARY_TONE_MUTED)
|
||||
content = marker
|
||||
}
|
||||
}
|
||||
DiaryInline(*diary_line, text, content, end, active, quoted)
|
||||
}
|
||||
if diary_line.overflow {
|
||||
// The whole line shows as typed rather than half styled.
|
||||
diary_line = DiaryLineMarks.{}
|
||||
}
|
||||
if !DiaryPreviewAdd(preview, *diary_line) {
|
||||
preview.truncated = true
|
||||
return
|
||||
}
|
||||
if heading.level > 0 {
|
||||
preview.heading_count += 1
|
||||
}
|
||||
line = end + 1
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,7 @@
|
||||
// gets each image back at its mark, in order. A correction that lost or
|
||||
// added a mark cannot be matched to the images, so it is refused.
|
||||
#import "vec"
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "byte_text_linux"
|
||||
|
||||
DIARY_SPELLING_MARK :: "\xEF\xBF\xBC"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#import "session"
|
||||
#import "text_input_props"
|
||||
TextArea :: #import "kryon/text_area";
|
||||
|
||||
// Device observations and retained editor values, never native pointers.
|
||||
DiaryUiFrame :: struct {
|
||||
@@ -12,7 +12,7 @@ DiaryUiFrame :: struct {
|
||||
scale: float32
|
||||
font: s32
|
||||
now: float64
|
||||
input: TextAreaInput
|
||||
input: TextArea.Input
|
||||
focused: bool
|
||||
selecting: bool
|
||||
scroll: s32
|
||||
|
||||
+63
-80
@@ -1,38 +1,34 @@
|
||||
#import "geometry"
|
||||
#import, file "diary_date.zi";
|
||||
#import "image_props"
|
||||
#import "image_widget"
|
||||
#import "layout"
|
||||
#import "text_props"
|
||||
#import "text_widget"
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Image :: #import "kryon/image";
|
||||
Layout :: #import "kryon/layout";
|
||||
Press :: #import "kryon/press";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
Text :: #import "kryon/text";
|
||||
TextArea :: #import "kryon/text_area";
|
||||
MarkdownEditor :: #import "kryon/markdown_editor";
|
||||
Markdown :: #import "kryon/markdown_preview";
|
||||
#import "text_measure"
|
||||
#import "text_input_props"
|
||||
#import "text_area_widget"
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "drawing_props"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "text_align"
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "vec"
|
||||
#import "byte_text_linux"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "press_props"
|
||||
#import "press_widget"
|
||||
#import "tree"
|
||||
#import "kryon/tree"
|
||||
#import, file "diary_markdown.zi";
|
||||
#import, file "diary_types.zi";
|
||||
#import, file "diary_ui_types.zi";
|
||||
#import "kryon/app_context"
|
||||
#import "json_scan"
|
||||
#import, file "diary_wire.zi";
|
||||
CompressionIcon :: #import "mingcute/mingcute_regular_tool";
|
||||
|
||||
using ImageFit;
|
||||
using Image.ImageFit;
|
||||
using TextAlign;
|
||||
using TextWrap;
|
||||
using Text.Wrap;
|
||||
using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
using IconPlacement;
|
||||
@@ -85,11 +81,7 @@ DiaryObservedFrame :: () -> DiaryUiFrame {
|
||||
// slanted, headings are larger, links and list and quote marks take their
|
||||
// colors, and a photo's embed line shows the photo in its place. On the
|
||||
// caret's line the Markdown shows as typed, with the photo under it.
|
||||
DIARY_HEADING_SCALES: [6]float32 = .[1.6, 1.4, 1.25, 1.1, 1.0, 1.0];
|
||||
editor_preview: DiaryPreview;
|
||||
editor_blocks: [DIARY_PREVIEW_PHOTOS]TextAreaBlock;
|
||||
editor_lines: [DIARY_PREVIEW_HEADINGS]TextAreaLine;
|
||||
editor_colors: [DIARY_PREVIEW_TONES]TextAreaColorSpan;
|
||||
editor_blocks: [Markdown.PREVIEW_IMAGES + 1]TextArea.Block;
|
||||
|
||||
// A copy the view owns of text a host call answered. The host answers in its
|
||||
// own buffers, which its next call may overwrite.
|
||||
@@ -112,43 +104,19 @@ DiaryPhotoHeight :: (width: float32) -> s32 {
|
||||
return height
|
||||
}
|
||||
|
||||
DiaryEditorStyle :: (area: *TextAreaProps, text: string, editing: bool) {
|
||||
DiaryPreviewScan(*editor_preview, text, area.cursor, area.anchor, editing)
|
||||
area.hidden = editor_preview.hidden[:editor_preview.hidden_count]
|
||||
area.strong = editor_preview.strong[:editor_preview.strong_count]
|
||||
area.italic = editor_preview.italic[:editor_preview.italic_count]
|
||||
colors: s32 = 0
|
||||
for index: cast(s32)0..editor_preview.tone_count - 1 {
|
||||
tone := editor_preview.tones[index]
|
||||
color := ifx tone.tone == DIARY_TONE_LINK then frame.link_color else frame.muted_color
|
||||
if color == cast(u32)0 {
|
||||
continue
|
||||
}
|
||||
editor_colors[colors] = TextAreaColorSpan.{.start = tone.start, .end = tone.end, .color = color}
|
||||
colors += 1
|
||||
}
|
||||
area.colors = editor_colors[:colors]
|
||||
lines: s32 = 0
|
||||
for index: cast(s32)0..editor_preview.heading_count - 1 {
|
||||
heading := editor_preview.headings[index]
|
||||
scale := DIARY_HEADING_SCALES[heading.level - 1]
|
||||
if scale <= 1.0 {
|
||||
continue
|
||||
}
|
||||
editor_lines[lines] = TextAreaLine.{.start = heading.start, .scale = scale}
|
||||
lines += 1
|
||||
}
|
||||
area.lines = editor_lines[:lines]
|
||||
DiaryEditorProps :: (area: TextArea.Props) -> MarkdownEditor.Props {
|
||||
props: MarkdownEditor.Props = .{.area = area, .muted_color = frame.muted_color,
|
||||
.link_color = frame.link_color, .images = DiaryResolvedImages(area.value)}
|
||||
height := DiaryPhotoHeight(area.bounds.width)
|
||||
unavailable := AppLocale("diary_photo_unavailable")
|
||||
for index: cast(s32)0..editor_preview.photo_count - 1 {
|
||||
block := editor_preview.photos[index]
|
||||
embed := block.embed
|
||||
editor_blocks[index] = TextAreaBlock.{.start = embed.line_start, .height = height,
|
||||
.cover = block.cover, .image = DiaryKept(DiaryPhoto(DiaryEmbedDestination(text, embed))),
|
||||
for index: cast(s32)0..cast(s32)props.images.count - 1 {
|
||||
embed := DiaryEmbedAt(area.value, props.images[index].start)
|
||||
editor_blocks[index] = TextArea.Block.{.start = embed.line_start, .height = height,
|
||||
.image = DiaryKept(DiaryPhoto(DiaryEmbedDestination(area.value, embed))),
|
||||
.label = unavailable}
|
||||
}
|
||||
area.blocks = editor_blocks[:editor_preview.photo_count]
|
||||
props.area.blocks = editor_blocks[:props.images.count]
|
||||
return props
|
||||
}
|
||||
|
||||
// The day's gallery is a separate view, opened by its toolbar icon. It
|
||||
@@ -244,7 +212,7 @@ DiaryDayGallery :: (left: float32, top: float32, width: float32, height: float32
|
||||
}
|
||||
tile := (inner - cast(float32)(columns - 1) * gap) / cast(float32)columns
|
||||
rows := (day_photo_count + columns - 1) / columns
|
||||
strip := Scroll(frame.session, ScrollProps.{.key = cast(u64)290302,
|
||||
strip := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)290302,
|
||||
.bounds = Rectangle.{left, top, width, height}, .scale = frame.scale,
|
||||
.content_height = cast(s32)(cast(float32)rows * (tile + gap)),
|
||||
.scroll_offset = frame.photos_scroll})
|
||||
@@ -256,14 +224,14 @@ DiaryDayGallery :: (left: float32, top: float32, width: float32, height: float32
|
||||
photo := day_photos[index]
|
||||
bounds := Rectangle.{strip.content.x + cast(float32)(index % columns) * (tile + gap),
|
||||
strip.content.y + cast(float32)(index / columns) * (tile + gap), tile, tile}
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)(292000 + index), .bounds = bounds,
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)(292000 + index), .bounds = bounds,
|
||||
.fill = Color.{156, 156, 156, 36}, .radius = cast(float32)Scale(6)})
|
||||
if photo.asset.count > 0 {
|
||||
Image(frame.session, ImageProps.{.key = cast(u64)(292100 + index),
|
||||
Image.Draw(frame.session, Image.Props.{.key = cast(u64)(292100 + index),
|
||||
.asset_path = photo.asset, .alt_text = photo.name, .bounds = bounds,
|
||||
.fit = cast(ImageFit)ImageFitCover, .smooth = true})
|
||||
.fit = cast(Image.ImageFit)ImageFitCover, .smooth = true})
|
||||
}
|
||||
press := Press(frame.session, PressProps.{.key = cast(u64)(292200 + index),
|
||||
press := Press.Draw(frame.session, Press.Props.{.key = cast(u64)(292200 + index),
|
||||
.id = 292200 + index, .bounds = bounds, .label = photo.name, .now = frame.now,
|
||||
.disabled = !editable})
|
||||
if press.clicked && !pending {
|
||||
@@ -322,7 +290,7 @@ FinishView :: () -> DiaryMessage {
|
||||
// accessibility.
|
||||
DiaryAction :: ( id: s32, label: string, bounds: Rectangle, enabled: bool = true,
|
||||
icon: string = "", selected: bool = false, loading: bool = false) {
|
||||
if Button(frame.session, ButtonProps.{.id = id, .bounds = bounds,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = id, .bounds = bounds,
|
||||
.label = label, .disabled = !enabled, .selected = selected, .loading = loading,
|
||||
.icon_shape = icon, .icon_only = icon != "", .fit_content = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
@@ -363,7 +331,7 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
state = message
|
||||
frame = observed
|
||||
pending = false
|
||||
column := CenteredColumnFor(frame.width, Scale(640), Scale(16))
|
||||
column := Layout.CenteredColumnFor(frame.width, Scale(640), Scale(16))
|
||||
left := cast(float32)(column.x + frame.origin_x)
|
||||
width := cast(float32)column.width
|
||||
part := (width - cast(float32)Scale(12)) / 3.0
|
||||
@@ -376,22 +344,38 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
// beside it, centered together.
|
||||
title := DateTitle(state.year, state.month, state.day)
|
||||
title_font := frame.font + Scale(4)
|
||||
title_width := cast(float32)TextWidth(frame.session, TextProps.{.text = title, .font = title_font})
|
||||
title_width := cast(float32)TextWidth(frame.session, Text.Props.{.text = title, .size = title_font})
|
||||
if title_width > width - 2.0 * (control + gap) {
|
||||
title_width = width - 2.0 * (control + gap)
|
||||
}
|
||||
title_left := left + (width - title_width) / 2.0
|
||||
compression := AppSupports("media.compression.open")
|
||||
if compression {
|
||||
title_width = title_width - control - gap
|
||||
if title_width < control {
|
||||
title_width = control
|
||||
}
|
||||
title_left = left + (width - control - gap - title_width) / 2.0
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 29018,
|
||||
.bounds = Rectangle.{left + width - control, top, control, control},
|
||||
.label = AppLocale("media_compression_title"), .icon_only = true,
|
||||
.icon_shape = CompressionIcon.Shape,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
unused AppService("media.compression.open", "")
|
||||
}
|
||||
}
|
||||
DiaryAction(29001, "‹", Rectangle.{title_left - gap - control, top, control, control},
|
||||
true, DIARY_PREVIOUS_ICON)
|
||||
DiaryAction(29002, "›", Rectangle.{title_left + title_width + gap, top, control, control},
|
||||
OnOrBefore(Next(Date.{state.year, state.month, state.day}, 1), today) &&
|
||||
!OnOrBefore(today, Date.{state.year, state.month, state.day}),
|
||||
DIARY_NEXT_ICON)
|
||||
title_strong: [1]TextRange = .[TextRange.{.start = 0, .end = cast(s32)title.count}]
|
||||
Text(frame.session, TextProps.{.bounds = Rectangle.{title_left, top, title_width, control},
|
||||
.text = title, .font = title_font, .strong = title_strong[:],
|
||||
title_strong: [1]Text.Range = .[Text.Range.{.start = 0, .end = cast(s32)title.count}]
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Rectangle.{title_left, top, title_width, control},
|
||||
.text = title, .size = title_font, .strong = title_strong[:],
|
||||
.align = cast(TextAlign)TextAlignCenter, .vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
|
||||
// On phones the editing tools get their own row, keeping every target
|
||||
// at 44 units instead of squeezing the icons beside Today.
|
||||
@@ -444,7 +428,7 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
}
|
||||
|
||||
if state.calendar {
|
||||
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)290300,
|
||||
scroll := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)290300,
|
||||
.bounds = Rectangle.{left, content, width, content_height},
|
||||
.content_height = Scale(344), .scroll_offset = frame.calendar_scroll})
|
||||
frame.calendar_scroll = scroll.scroll_offset
|
||||
@@ -457,15 +441,15 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
origin, part, cast(float32)Scale(44)},
|
||||
state.month_year < today.year ||
|
||||
(state.month_year == today.year && state.month_number < today.month))
|
||||
Text(frame.session, TextProps.{.bounds = Rectangle.{left + part,
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Rectangle.{left + part,
|
||||
origin + cast(float32)Scale(8), part, cast(float32)Scale(32)},
|
||||
.text = DateTitle(state.month_year, state.month_number, 0), .font = frame.font})
|
||||
.text = DateTitle(state.month_year, state.month_number, 0), .size = frame.font})
|
||||
weekdays: [7]string = .["habit_day_mon", "habit_day_tue", "habit_day_wed", "habit_day_thu",
|
||||
"habit_day_fri", "habit_day_sat", "habit_day_sun"]
|
||||
for day: cast(s32)0..cast(s32)6 {
|
||||
Text(frame.session, TextProps.{.bounds = Rectangle.{left + cast(float32)day * width / 7.0,
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Rectangle.{left + cast(float32)day * width / 7.0,
|
||||
origin + cast(float32)Scale(52), width / 7.0, cast(float32)Scale(24)},
|
||||
.text = AppLocale(weekdays[day]), .font = frame.font})
|
||||
.text = AppLocale(weekdays[day]), .size = frame.font})
|
||||
}
|
||||
for day: cast(s32)1..state.month_days {
|
||||
position := state.month_weekday + day - 1
|
||||
@@ -490,7 +474,7 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
if editor_height < Scale(120) {
|
||||
editor_height = Scale(120)
|
||||
}
|
||||
page := Scroll(frame.session, ScrollProps.{.key = cast(u64)290301,
|
||||
page := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)290301,
|
||||
.bounds = Rectangle.{left, content, width, content_height},
|
||||
.content_height = editor_height + notice_room,
|
||||
.scroll_offset = frame.page_scroll, .scale = frame.scale})
|
||||
@@ -498,7 +482,7 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
if !page.opened {
|
||||
return FinishView()
|
||||
}
|
||||
area: TextAreaProps
|
||||
area: TextArea.Props
|
||||
area.key = cast(u64)290200
|
||||
area.focus_id = 29020
|
||||
area.bounds = Rectangle.{left, page.content.y, width, cast(float32)editor_height}
|
||||
@@ -517,8 +501,7 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
area.max_bytes = 2147483646
|
||||
area.max_codepoints = 2147483646
|
||||
area.input = frame.input
|
||||
DiaryEditorStyle(*area, state.text, frame.focused && !area.read_only)
|
||||
edited := TextArea(frame.session, area)
|
||||
edited := MarkdownEditor.Draw(frame.session, DiaryEditorProps(area))
|
||||
state.cursor = edited.cursor
|
||||
state.anchor = edited.anchor
|
||||
frame.scroll = edited.scroll_y
|
||||
@@ -545,9 +528,9 @@ DiaryView :: (message: DiaryMessage, observed: DiaryUiFrame, today: Date) -> Dia
|
||||
if frame.photo_error {
|
||||
status = "diary_photo_error"
|
||||
}
|
||||
Text(frame.session, TextProps.{.bounds = Rectangle.{left,
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Rectangle.{left,
|
||||
area.bounds.y + area.bounds.height + cast(float32)Scale(12), width, cast(float32)Scale(40)},
|
||||
.text = AppLocale(status), .font = frame.font})
|
||||
.text = AppLocale(status), .size = frame.font})
|
||||
}
|
||||
End(frame.session)
|
||||
return FinishView()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// App-owned commands shared with callers. Documents retain their existing schema.
|
||||
#import "json_scan"
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "vec"
|
||||
#import "byte_text_linux"
|
||||
#import, file "diary_types.zi";
|
||||
|
||||
@@ -1,5 +1,41 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Compare daily completions on one shared graph. Each line uses its habit’s color, and selecting a habit in the legend brings its line forward.
|
||||
|
||||
- Diary links are exclusive. Activity shows completed habit icons, and Habits has daily line graphs and an overview beside Shop.
|
||||
|
||||
- Tap a diary-linked habit's day to open that date in Diary and keep its completion.
|
||||
- Coins follow the selected theme color.
|
||||
- Statistics and Shop have matching icons and separate tap targets.
|
||||
- Claim the daily reward beside the coin balance: one coin a day, three on the seventh day in a row.
|
||||
- Choose soda, coffee, bubble tea, chocolate and candle pictures for custom rewards.
|
||||
|
||||
## [1.3.17] - 2026-11-05
|
||||
|
||||
- Show color purchase totals, recent purchase frequency and the last purchase date for rewards.
|
||||
|
||||
## [1.3.16] - 2026-11-02
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.62.
|
||||
|
||||
## [1.3.15] - 2026-10-29
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.61.
|
||||
|
||||
## [1.3.14] - 2026-10-29
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.60.
|
||||
|
||||
## [1.3.13] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.59.
|
||||
|
||||
## [1.3.12] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.58.
|
||||
|
||||
## [1.3.11] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.56.
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"achievement_habits_created_1_title": "Kebiasaan · 1 hasil",
|
||||
"achievement_habits_created_1_description": "Catat 1 hasil berbeda: kebiasaan sah yang disimpan.",
|
||||
"achievement_habits_days_1_title": "Kebiasaan · 1 hari",
|
||||
"achievement_habits_days_1_description": "Lakukan ini pada 1 tanggal berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_days_3_title": "Kebiasaan · 3 hari",
|
||||
"achievement_habits_days_3_description": "Lakukan ini pada 3 tanggal berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_days_7_title": "Kebiasaan · 7 hari",
|
||||
"achievement_habits_days_7_description": "Lakukan ini pada 7 tanggal berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_days_14_title": "Kebiasaan · 14 hari",
|
||||
"achievement_habits_days_14_description": "Lakukan ini pada 14 tanggal berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_days_30_title": "Kebiasaan · 30 hari",
|
||||
"achievement_habits_days_30_description": "Lakukan ini pada 30 tanggal berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_days_60_title": "Kebiasaan · 60 hari",
|
||||
"achievement_habits_days_60_description": "Lakukan ini pada 60 tanggal berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_days_100_title": "Kebiasaan · 100 hari",
|
||||
"achievement_habits_days_100_description": "Lakukan ini pada 100 tanggal berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_days_180_title": "Kebiasaan · 180 hari",
|
||||
"achievement_habits_days_180_description": "Lakukan ini pada 180 tanggal berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_days_365_title": "Kebiasaan · 365 hari",
|
||||
"achievement_habits_days_365_description": "Lakukan ini pada 365 tanggal berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_completions_10_title": "Kebiasaan · 10 hasil",
|
||||
"achievement_habits_completions_10_description": "Catat 10 hasil berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_completions_50_title": "Kebiasaan · 50 hasil",
|
||||
"achievement_habits_completions_50_description": "Catat 50 hasil berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_completions_100_title": "Kebiasaan · 100 hasil",
|
||||
"achievement_habits_completions_100_description": "Catat 100 hasil berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_completions_500_title": "Kebiasaan · 500 hasil",
|
||||
"achievement_habits_completions_500_description": "Catat 500 hasil berbeda: hari kebiasaan yang diselesaikan.",
|
||||
"achievement_habits_single_scheduled_days_7_title": "Kebiasaan · 7 tanggal terjadwal",
|
||||
"achievement_habits_single_scheduled_days_7_description": "Untuk satu kebiasaan, selesaikan 7 tanggal terjadwal: hari kebiasaan terjadwal yang diselesaikan.",
|
||||
"achievement_habits_single_scheduled_days_30_title": "Kebiasaan · 30 tanggal terjadwal",
|
||||
"achievement_habits_single_scheduled_days_30_description": "Untuk satu kebiasaan, selesaikan 30 tanggal terjadwal: hari kebiasaan terjadwal yang diselesaikan.",
|
||||
"achievement_habits_single_scheduled_days_100_title": "Kebiasaan · 100 tanggal terjadwal",
|
||||
"achievement_habits_single_scheduled_days_100_description": "Untuk satu kebiasaan, selesaikan 100 tanggal terjadwal: hari kebiasaan terjadwal yang diselesaikan.",
|
||||
"achievement_habits_counter_target_1_title": "Kebiasaan · 1 hasil",
|
||||
"achievement_habits_counter_target_1_description": "Catat 1 hasil berbeda: target kebiasaan hitungan yang tercapai.",
|
||||
"achievement_habits_question_answer_1_title": "Kebiasaan · 1 hasil",
|
||||
"achievement_habits_question_answer_1_description": "Catat 1 hasil berbeda: jawaban nyata untuk pertanyaan kebiasaan yang disimpan.",
|
||||
"achievement_habits_ended_span_1_title": "Kebiasaan · 1 hasil",
|
||||
"achievement_habits_ended_span_1_description": "Catat 1 hasil berbeda: rentang waktu kebiasaan tersimpan dengan awal dan akhir yang sah."
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"achievement_habits_created_1_title": "Abitudini · 1 risultati",
|
||||
"achievement_habits_created_1_description": "Registra 1 risultati distinti: un’abitudine valida salvata.",
|
||||
"achievement_habits_days_1_title": "Abitudini · 1 giorni",
|
||||
"achievement_habits_days_1_description": "Fallo in 1 date distinte: un giorno di abitudine completato.",
|
||||
"achievement_habits_days_3_title": "Abitudini · 3 giorni",
|
||||
"achievement_habits_days_3_description": "Fallo in 3 date distinte: un giorno di abitudine completato.",
|
||||
"achievement_habits_days_7_title": "Abitudini · 7 giorni",
|
||||
"achievement_habits_days_7_description": "Fallo in 7 date distinte: un giorno di abitudine completato.",
|
||||
"achievement_habits_days_14_title": "Abitudini · 14 giorni",
|
||||
"achievement_habits_days_14_description": "Fallo in 14 date distinte: un giorno di abitudine completato.",
|
||||
"achievement_habits_days_30_title": "Abitudini · 30 giorni",
|
||||
"achievement_habits_days_30_description": "Fallo in 30 date distinte: un giorno di abitudine completato.",
|
||||
"achievement_habits_days_60_title": "Abitudini · 60 giorni",
|
||||
"achievement_habits_days_60_description": "Fallo in 60 date distinte: un giorno di abitudine completato.",
|
||||
"achievement_habits_days_100_title": "Abitudini · 100 giorni",
|
||||
"achievement_habits_days_100_description": "Fallo in 100 date distinte: un giorno di abitudine completato.",
|
||||
"achievement_habits_days_180_title": "Abitudini · 180 giorni",
|
||||
"achievement_habits_days_180_description": "Fallo in 180 date distinte: un giorno di abitudine completato.",
|
||||
"achievement_habits_days_365_title": "Abitudini · 365 giorni",
|
||||
"achievement_habits_days_365_description": "Fallo in 365 date distinte: un giorno di abitudine completato.",
|
||||
"achievement_habits_completions_10_title": "Abitudini · 10 risultati",
|
||||
"achievement_habits_completions_10_description": "Registra 10 risultati distinti: un giorno di abitudine completato.",
|
||||
"achievement_habits_completions_50_title": "Abitudini · 50 risultati",
|
||||
"achievement_habits_completions_50_description": "Registra 50 risultati distinti: un giorno di abitudine completato.",
|
||||
"achievement_habits_completions_100_title": "Abitudini · 100 risultati",
|
||||
"achievement_habits_completions_100_description": "Registra 100 risultati distinti: un giorno di abitudine completato.",
|
||||
"achievement_habits_completions_500_title": "Abitudini · 500 risultati",
|
||||
"achievement_habits_completions_500_description": "Registra 500 risultati distinti: un giorno di abitudine completato.",
|
||||
"achievement_habits_single_scheduled_days_7_title": "Abitudini · 7 date programmate",
|
||||
"achievement_habits_single_scheduled_days_7_description": "Per una stessa abitudine, completa 7 date programmate: un giorno programmato di abitudine completato.",
|
||||
"achievement_habits_single_scheduled_days_30_title": "Abitudini · 30 date programmate",
|
||||
"achievement_habits_single_scheduled_days_30_description": "Per una stessa abitudine, completa 30 date programmate: un giorno programmato di abitudine completato.",
|
||||
"achievement_habits_single_scheduled_days_100_title": "Abitudini · 100 date programmate",
|
||||
"achievement_habits_single_scheduled_days_100_description": "Per una stessa abitudine, completa 100 date programmate: un giorno programmato di abitudine completato.",
|
||||
"achievement_habits_counter_target_1_title": "Abitudini · 1 risultati",
|
||||
"achievement_habits_counter_target_1_description": "Registra 1 risultati distinti: l’obiettivo raggiunto di un’abitudine a conteggio.",
|
||||
"achievement_habits_question_answer_1_title": "Abitudini · 1 risultati",
|
||||
"achievement_habits_question_answer_1_description": "Registra 1 risultati distinti: una risposta autentica salvata a una domanda dell’abitudine.",
|
||||
"achievement_habits_ended_span_1_title": "Abitudini · 1 risultati",
|
||||
"achievement_habits_ended_span_1_description": "Registra 1 risultati distinti: un intervallo di abitudine salvato con inizio e fine validi."
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
#import "drawing_props"
|
||||
|
||||
// Coins mark the important numbers, such as the balance, prices and
|
||||
// rewards, in the theme's highlight. A host older than the highlight sends
|
||||
// none, and the coin then takes the theme's text color.
|
||||
HabitsCoinColor :: (highlight: Color, text: Color) -> Color {
|
||||
if highlight.a == cast(u8)0 {
|
||||
return text
|
||||
}
|
||||
return highlight
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
// Habit's editor confirmations belong to its package. The native host uses
|
||||
// the same composition for older installed packages that lack these views.
|
||||
#import "session"
|
||||
#import "modal_props"
|
||||
#import "modal_widget"
|
||||
Modal :: #import "kryon/modal";
|
||||
#import "control_props"
|
||||
|
||||
using ButtonTone;
|
||||
@@ -20,28 +19,28 @@ HabitEditorDialogProps :: struct {
|
||||
delete_label: string
|
||||
}
|
||||
|
||||
HabitEditorDialog :: (props: HabitEditorDialogProps) -> ActionModalResult {
|
||||
HabitEditorDialog :: (props: HabitEditorDialogProps) -> Modal.ActionModalResult {
|
||||
if props.deleting {
|
||||
actions: [2]ActionModalAction = .[
|
||||
ActionModalAction.{.label = props.cancel,
|
||||
actions: [2]Modal.ActionModalAction = .[
|
||||
Modal.ActionModalAction.{.label = props.cancel,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft},
|
||||
ActionModalAction.{.label = props.delete_label,
|
||||
Modal.ActionModalAction.{.label = props.delete_label,
|
||||
.tone = cast(ButtonTone)ButtonToneDanger,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}]
|
||||
return ActionModal(props.session, ActionModalProps.{
|
||||
return Modal.ActionModal(props.session, Modal.ActionModalProps.{
|
||||
.title = props.title, .message = props.message}, actions[:])
|
||||
}
|
||||
actions: [3]ActionModalAction = .[
|
||||
ActionModalAction.{.label = props.keep_editing,
|
||||
actions: [3]Modal.ActionModalAction = .[
|
||||
Modal.ActionModalAction.{.label = props.keep_editing,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft},
|
||||
ActionModalAction.{.label = props.save,
|
||||
Modal.ActionModalAction.{.label = props.save,
|
||||
.tone = cast(ButtonTone)ButtonToneAccent,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled},
|
||||
ActionModalAction.{.label = props.discard,
|
||||
Modal.ActionModalAction.{.label = props.discard,
|
||||
.tone = cast(ButtonTone)ButtonToneDanger,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}]
|
||||
return ActionModal(props.session, ActionModalProps.{
|
||||
return Modal.ActionModal(props.session, Modal.ActionModalProps.{
|
||||
.title = props.title, .message = props.message}, actions[:])
|
||||
}
|
||||
+103
-110
@@ -7,35 +7,28 @@
|
||||
// for an entry's time, or a span's start and end, and its questions. The
|
||||
// host keeps the habits, their entries and sessions and does what the page
|
||||
// asks once it is drawn.
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Dropdown :: #import "kryon/dropdown";
|
||||
Image :: #import "kryon/image";
|
||||
Layout :: #import "kryon/layout";
|
||||
Modal :: #import "kryon/modal";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
Text :: #import "kryon/text";
|
||||
TextField :: #import "kryon/text_field";
|
||||
TimePicker :: #import "kryon/time_picker";
|
||||
TitleBar :: #import "kryon/title_bar";
|
||||
#import "kryon/system_clipboard"
|
||||
#import "session"
|
||||
#import "geometry"
|
||||
#import "vec"
|
||||
#import "dpi"
|
||||
#import "layout"
|
||||
#import "drawing_props"
|
||||
#import "text_props"
|
||||
#import "text_align"
|
||||
#import "text_widget"
|
||||
#import "text_measure"
|
||||
#import "text_input_props"
|
||||
#import "text_field_widget"
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "image_props"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "modal_props"
|
||||
#import "modal_frame_widget"
|
||||
#import "time_picker_props"
|
||||
#import "time_picker_widget"
|
||||
#import "title_bar_props"
|
||||
#import "title_bar_widget"
|
||||
#import "dropdown_props"
|
||||
#import "semantic"
|
||||
#import "tree"
|
||||
#import "kryon/tree"
|
||||
#import, file "../../src/apps/habits_ui_types.zi";
|
||||
#import, file "../../src/apps/habits_types.zi";
|
||||
#import, file "../../src/habits/habit_types.zi";
|
||||
@@ -44,7 +37,7 @@ using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
using SemanticKind;
|
||||
using TextAlign;
|
||||
using TextWrap;
|
||||
using Text.Wrap;
|
||||
host_api :: #system_library "host_api";
|
||||
ReadHabitsDayHost :: () -> HabitsDayFrame #foreign host_api;
|
||||
WriteHabitsDayHost :: (frame: HabitsDayFrame) #foreign host_api;
|
||||
@@ -90,13 +83,13 @@ Locale :: (key: string) -> string {
|
||||
}
|
||||
|
||||
Width :: (text: string, font: s32) -> s32 {
|
||||
return TextWidth(look_session, TextProps.{.text = text, .font = font})
|
||||
return TextWidth(look_session, Text.Props.{.text = text, .size = font})
|
||||
}
|
||||
|
||||
// The height Text takes for a paragraph wrapped in width.
|
||||
ParagraphHeight :: (text: string, width: s32, font: s32) -> s32 {
|
||||
return TextHeight(look_session, TextProps.{.text = text, .font = font,
|
||||
.bounds = Bounds(0, 0, width, 0), .wrap = cast(TextWrap)TextWrapAuto})
|
||||
return TextHeight(look_session, Text.Props.{.text = text, .size = font,
|
||||
.bounds = Bounds(0, 0, width, 0), .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
}
|
||||
|
||||
Number :: (value: s64) -> string {
|
||||
@@ -139,23 +132,23 @@ Replaced :: (value: string, start: s32, end: s32, replacement: string,
|
||||
return BuilderFinish(out)
|
||||
}
|
||||
|
||||
Strong :: (text: string) -> [1]TextRange {
|
||||
ranges: [1]TextRange
|
||||
ranges[0] = TextRange.{.start = 0, .end = cast(s32)text.count}
|
||||
Strong :: (text: string) -> [1]Text.Range {
|
||||
ranges: [1]Text.Range
|
||||
ranges[0] = Text.Range.{.start = 0, .end = cast(s32)text.count}
|
||||
return ranges
|
||||
}
|
||||
|
||||
// The title as large as it fits.
|
||||
TitleFont :: (title: string, max_width: s32) -> s32 {
|
||||
large := Scale(Text24)
|
||||
large := Scale(Text.Text24)
|
||||
if max_width <= 0 || Width(title, large) <= max_width {
|
||||
return large
|
||||
}
|
||||
medium := Scale(Text16)
|
||||
medium := Scale(Text.Text16)
|
||||
if Width(title, medium) <= max_width {
|
||||
return medium
|
||||
}
|
||||
return Scale(Text14)
|
||||
return Scale(Text.Text14)
|
||||
}
|
||||
|
||||
Alpha :: (color: Color, opacity: float32) -> Color {
|
||||
@@ -163,21 +156,21 @@ Alpha :: (color: Color, opacity: float32) -> Color {
|
||||
return color
|
||||
}
|
||||
|
||||
UiImage :: (label: string, x: float32, y: float32) -> ImageProps {
|
||||
return ImageProps.{.asset_path = "icons/ui.png", .alt_text = label,
|
||||
UiImage :: (label: string, x: float32, y: float32) -> Image.Props {
|
||||
return Image.Props.{.asset_path = "icons/ui.webp", .alt_text = label,
|
||||
.source = Rectangle.{x, y, 64.0, 64.0}}
|
||||
}
|
||||
|
||||
EditImage :: () -> ImageProps {
|
||||
EditImage :: () -> Image.Props {
|
||||
return UiImage(Locale("habit_edit_title"), 384.0, 0.0)
|
||||
}
|
||||
|
||||
DeleteImage :: () -> ImageProps {
|
||||
DeleteImage :: () -> Image.Props {
|
||||
return UiImage(Locale("delete_button"), 0.0, 384.0)
|
||||
}
|
||||
|
||||
IconButton :: (key: u64, id: s32, bounds: Rectangle, image: ImageProps, disabled: bool) -> bool {
|
||||
return Button(look_session, ButtonProps.{.key = key, .id = id, .bounds = bounds,
|
||||
IconButton :: (key: u64, id: s32, bounds: Rectangle, image: Image.Props, disabled: bool) -> bool {
|
||||
return Button.Draw(look_session, Button.Props.{.key = key, .id = id, .bounds = bounds,
|
||||
.label = image.alt_text, .image = image, .icon_only = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft, .disabled = disabled}) != 0
|
||||
@@ -195,7 +188,7 @@ DayAsk :: (action: s32, index: s32, round: s32) {
|
||||
}
|
||||
|
||||
Card :: (bounds: Rectangle) {
|
||||
unused Box(look_session, BoxProps.{.bounds = bounds, .fill = day.card_fill,
|
||||
unused Box.Draw(look_session, Box.Props.{.bounds = bounds, .fill = day.card_fill,
|
||||
.border = day.card_border, .radius = cast(float32)Scale(DAY_CARD_RADIUS)})
|
||||
}
|
||||
|
||||
@@ -216,14 +209,14 @@ EntryAnswers :: (summary: string, x: s32, y: s32, width: s32, draw: bool) -> s32
|
||||
text_height := ParagraphHeight(text, width, font)
|
||||
if draw {
|
||||
strong := Strong(text)
|
||||
props := TextProps.{.bounds = Bounds(x, y + height, width, text_height),
|
||||
.text = text, .font = font, .wrap = cast(TextWrap)TextWrapAuto}
|
||||
props := Text.Props.{.bounds = Bounds(x, y + height, width, text_height),
|
||||
.text = text, .size = font, .wrap = cast(Text.Wrap)TextWrapAuto}
|
||||
if value {
|
||||
props.strong = strong[:]
|
||||
} else {
|
||||
props.class_name = look_muted
|
||||
}
|
||||
Text(look_session, props)
|
||||
Text.Draw(look_session, props)
|
||||
}
|
||||
height += text_height
|
||||
height += ifx value then Scale(10) else Scale(2)
|
||||
@@ -269,10 +262,10 @@ DayEntries :: (x: s32, width: s32, y: s32, draw: bool) -> s32 {
|
||||
if draw {
|
||||
heading := Locale("habit_day_entries")
|
||||
strong := Strong(heading)
|
||||
Text(look_session, TextProps.{.bounds = Bounds(x, y, width, heading_height),
|
||||
.text = heading, .font = TitleFont(heading, width), .strong = strong[:],
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(x, y, width, heading_height),
|
||||
.text = heading, .size = TitleFont(heading, width), .strong = strong[:],
|
||||
.semantic_kind = cast(SemanticKind)SemanticHeading, .heading_level = 2,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
y += heading_height + Scale(8)
|
||||
for index: cast(s32)0..day.entry_count - 1 {
|
||||
@@ -285,18 +278,18 @@ DayEntries :: (x: s32, width: s32, y: s32, draw: bool) -> s32 {
|
||||
buttons_width := icon_width * 2 + Scale(10)
|
||||
if day.span || item.summary.count == 0 {
|
||||
strong := Strong(item.when)
|
||||
when := TextProps.{.bounds = Bounds(inner_x, y + pad,
|
||||
when := Text.Props.{.bounds = Bounds(inner_x, y + pad,
|
||||
inner_width - buttons_width - Scale(8), icon_width),
|
||||
.text = item.when, .font = look_font,
|
||||
.text = item.when, .size = look_font,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis}
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis}
|
||||
if day.span {
|
||||
when.font = look_font + Scale(4)
|
||||
when.size = look_font + Scale(4)
|
||||
when.strong = strong[:]
|
||||
} else {
|
||||
when.class_name = look_muted
|
||||
}
|
||||
Text(look_session, when)
|
||||
Text.Draw(look_session, when)
|
||||
} else {
|
||||
unused EntryAnswers(item.summary, inner_x, y + pad,
|
||||
inner_width - buttons_width - Scale(8), true)
|
||||
@@ -316,7 +309,7 @@ DayEntries :: (x: s32, width: s32, y: s32, draw: bool) -> s32 {
|
||||
line_y += EntryAnswers(item.summary, inner_x, line_y, inner_width, true) + Scale(8)
|
||||
}
|
||||
if item.running {
|
||||
if Button(look_session, ButtonProps.{.id = 5739990,
|
||||
if Button.Draw(look_session, Button.Props.{.id = 5739990,
|
||||
.bounds = Bounds(inner_x, line_y + Scale(4), inner_width, Scale(44)),
|
||||
.label = Locale("habit_span_end_now"),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent,
|
||||
@@ -329,7 +322,7 @@ DayEntries :: (x: s32, width: s32, y: s32, draw: bool) -> s32 {
|
||||
y += card_height + Scale(12)
|
||||
}
|
||||
if draw {
|
||||
if Button(look_session, ButtonProps.{.id = 5739991, .bounds = Bounds(x, y, width, Scale(48)),
|
||||
if Button.Draw(look_session, Button.Props.{.id = 5739991, .bounds = Bounds(x, y, width, Scale(48)),
|
||||
.label = Locale("habit_entry_add"), .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft,
|
||||
.disabled = day.modal_active}) != 0 {
|
||||
@@ -341,7 +334,7 @@ DayEntries :: (x: s32, width: s32, y: s32, draw: bool) -> s32 {
|
||||
|
||||
// A line between the rows of a practice's card.
|
||||
Divider :: (x: s32, y: s32, width: s32) {
|
||||
unused Box(look_session, BoxProps.{.bounds = Bounds(x, y, width, Scale(1)),
|
||||
unused Box.Draw(look_session, Box.Props.{.bounds = Bounds(x, y, width, Scale(1)),
|
||||
.fill = Alpha(day.text_color, 0.1)})
|
||||
}
|
||||
|
||||
@@ -362,10 +355,10 @@ PracticeCard :: (first_session: s32, last_session: s32, content_x: s32, content_
|
||||
y += pad
|
||||
if draw {
|
||||
strong := Strong(title)
|
||||
Text(look_session, TextProps.{.bounds = Bounds(x, y, width - icon_width - Scale(8), Scale(34)),
|
||||
.text = title, .font = TitleFont(title, width - icon_width - Scale(8)),
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(x, y, width - icon_width - Scale(8), Scale(34)),
|
||||
.text = title, .size = TitleFont(title, width - icon_width - Scale(8)),
|
||||
.strong = strong[:], .vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
}
|
||||
y += Scale(34)
|
||||
for index: first_session..last_session {
|
||||
@@ -382,12 +375,12 @@ PracticeCard :: (first_session: s32, last_session: s32, content_x: s32, content_
|
||||
summary_x = x + Scale(68)
|
||||
}
|
||||
if draw {
|
||||
Text(look_session, TextProps.{.bounds = Bounds(x, y, summary_x - x - Scale(8), summary_height),
|
||||
.text = session.time, .font = font, .wrap = cast(TextWrap)TextWrapNone,
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(x, y, summary_x - x - Scale(8), summary_height),
|
||||
.text = session.time, .size = font, .wrap = cast(Text.Wrap)TextWrapNone,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
Text(look_session, TextProps.{.bounds = Bounds(summary_x, y, trash_x - summary_x - Scale(8),
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(summary_x, y, trash_x - summary_x - Scale(8),
|
||||
summary_height),
|
||||
.text = session.summary, .font = font, .wrap = cast(TextWrap)TextWrapNone,
|
||||
.text = session.summary, .size = font, .wrap = cast(Text.Wrap)TextWrapNone,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
if !day.editing && IconButton(cast(u64)(5750000 + index), 0,
|
||||
Bounds(trash_x, y + (summary_height - icon_width) / 2, icon_width, icon_width),
|
||||
@@ -398,9 +391,9 @@ PracticeCard :: (first_session: s32, last_session: s32, content_x: s32, content_
|
||||
y += summary_height
|
||||
if session.details.count > 0 {
|
||||
if draw {
|
||||
Text(look_session, TextProps.{.bounds = Bounds(x, y, width, Scale(32)),
|
||||
.text = session.details, .font = look_small_font,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(x, y, width, Scale(32)),
|
||||
.text = session.details, .size = look_small_font,
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
}
|
||||
y += Scale(32)
|
||||
}
|
||||
@@ -426,20 +419,20 @@ PracticeCard :: (first_session: s32, last_session: s32, content_x: s32, content_
|
||||
}
|
||||
Divider(x, y, width)
|
||||
if editing_round {
|
||||
unused Box(look_session, BoxProps.{.bounds = Bounds(x, y + Scale(2), width,
|
||||
unused Box.Draw(look_session, Box.Props.{.bounds = Bounds(x, y + Scale(2), width,
|
||||
row_height - Scale(4)),
|
||||
.fill = Alpha(day.surface_color, 0.75),
|
||||
.border = Alpha(day.text_color, 0.55), .radius = cast(float32)Scale(8)})
|
||||
unused Box(look_session, BoxProps.{.bounds = Bounds(value_x - Scale(8), y + Scale(6),
|
||||
unused Box.Draw(look_session, Box.Props.{.bounds = Bounds(value_x - Scale(8), y + Scale(6),
|
||||
Scale(78), row_height - Scale(12)),
|
||||
.border = day.text_color, .radius = cast(float32)Scale(6)})
|
||||
}
|
||||
Text(look_session, TextProps.{.bounds = Bounds(x, y, value_x - x - Scale(8), row_height),
|
||||
.text = Filled(Locale("round_number_label"), round + 1), .font = font,
|
||||
.wrap = cast(TextWrap)TextWrapNone,
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(x, y, value_x - x - Scale(8), row_height),
|
||||
.text = Filled(Locale("round_number_label"), round + 1), .size = font,
|
||||
.wrap = cast(Text.Wrap)TextWrapNone,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
Text(look_session, TextProps.{.bounds = Bounds(value_text_x, y, value_text_width, row_height),
|
||||
.text = value, .font = Scale(19), .wrap = cast(TextWrap)TextWrapNone,
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(value_text_x, y, value_text_width, row_height),
|
||||
.text = value, .size = Scale(19), .wrap = cast(Text.Wrap)TextWrapNone,
|
||||
.align = ifx editing_round then cast(TextAlign)TextAlignCenter
|
||||
else cast(TextAlign)TextAlignStart,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
@@ -478,8 +471,8 @@ DayContent :: (content_x: s32, content_width: s32, y: s32, draw: bool) -> s32 {
|
||||
}
|
||||
if day.session_count <= 0 {
|
||||
if draw {
|
||||
Text(look_session, TextProps.{.bounds = Bounds(content_x, y, content_width, Scale(40)),
|
||||
.text = Locale("no_sessions"), .wrap = cast(TextWrap)TextWrapNone})
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(content_x, y, content_width, Scale(40)),
|
||||
.text = Locale("no_sessions"), .wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
return y + Scale(40)
|
||||
}
|
||||
@@ -510,7 +503,7 @@ DayContent :: (content_x: s32, content_width: s32, y: s32, draw: bool) -> s32 {
|
||||
label_width := plus_x - label_x - gap
|
||||
y += Scale(6)
|
||||
if draw {
|
||||
if Button(look_session, ButtonProps.{.id = 5739992,
|
||||
if Button.Draw(look_session, Button.Props.{.id = 5739992,
|
||||
.bounds = Bounds(minus_x, y, step_width, button_height), .label = "-",
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft,
|
||||
@@ -518,14 +511,14 @@ DayContent :: (content_x: s32, content_width: s32, y: s32, draw: bool) -> s32 {
|
||||
DayAsk(HABITS_DAY_SCREEN_STEP_COUNT, -1, 0)
|
||||
day.action_step = -1
|
||||
}
|
||||
unused Box(look_session, BoxProps.{.bounds = Bounds(label_x, y, label_width, button_height),
|
||||
unused Box.Draw(look_session, Box.Props.{.bounds = Bounds(label_x, y, label_width, button_height),
|
||||
.fill = DarkenColor(day.canvas_color, 5), .radius = cast(float32)Scale(8)})
|
||||
Text(look_session, TextProps.{.bounds = Bounds(label_x + Scale(8), y,
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(label_x + Scale(8), y,
|
||||
label_width - Scale(8), button_height),
|
||||
.text = Filled(Locale("habit_session_total_count"), day.count),
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
if Button(look_session, ButtonProps.{.id = 5739993,
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
if Button.Draw(look_session, Button.Props.{.id = 5739993,
|
||||
.bounds = Bounds(plus_x, y, step_width, button_height), .label = "+",
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft,
|
||||
@@ -660,21 +653,21 @@ NumberPad :: () {
|
||||
y := day.view_height - height
|
||||
width := day.view_width - x * 2
|
||||
key_width := (width - gap * 2) / 3
|
||||
unused Box(look_session, BoxProps.{.bounds = Bounds(0, y, day.view_width, height),
|
||||
unused Box.Draw(look_session, Box.Props.{.bounds = Bounds(0, y, day.view_width, height),
|
||||
.fill = DarkenColor(day.canvas_color, 10)})
|
||||
unused Box(look_session, BoxProps.{.bounds = Bounds(0, y, day.view_width, Scale(1)),
|
||||
unused Box.Draw(look_session, Box.Props.{.bounds = Bounds(0, y, day.view_width, Scale(1)),
|
||||
.fill = DarkenColor(day.canvas_color, 42)})
|
||||
Text(look_session, TextProps.{.bounds = Bounds(x, y + pad, width, Scale(22)),
|
||||
.text = Filled(Locale("round_number_label"), day.edit_round + 1), .font = look_font,
|
||||
.wrap = cast(TextWrap)TextWrapNone, .align = cast(TextAlign)TextAlignCenter})
|
||||
Text(look_session, TextProps.{.bounds = Bounds(x, y + pad + Scale(24), width, Scale(28)),
|
||||
.text = day.edit_text, .font = Scale(24), .wrap = cast(TextWrap)TextWrapNone,
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(x, y + pad, width, Scale(22)),
|
||||
.text = Filled(Locale("round_number_label"), day.edit_round + 1), .size = look_font,
|
||||
.wrap = cast(Text.Wrap)TextWrapNone, .align = cast(TextAlign)TextAlignCenter})
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(x, y + pad + Scale(24), width, Scale(28)),
|
||||
.text = day.edit_text, .size = Scale(24), .wrap = cast(Text.Wrap)TextWrapNone,
|
||||
.align = cast(TextAlign)TextAlignCenter})
|
||||
labels: [11]string = .["1", "2", "3", "4", "5", "6", "7", "8", "9", "DEL", "0"]
|
||||
for key: cast(s32)0..10 {
|
||||
column := key % 3
|
||||
row := key / 3
|
||||
if Button(look_session, ButtonProps.{.key = cast(u64)(5770000 + key),
|
||||
if Button.Draw(look_session, Button.Props.{.key = cast(u64)(5770000 + key),
|
||||
.bounds = Bounds(x + column * (key_width + gap),
|
||||
y + pad + header_height + row * (key_height + gap), key_width, key_height),
|
||||
.label = labels[key], .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
@@ -688,14 +681,14 @@ NumberPad :: () {
|
||||
}
|
||||
action_y := y + pad + header_height + key_height * 4 + gap * 4
|
||||
action_width := (width - gap) / 2
|
||||
if Button(look_session, ButtonProps.{.key = cast(u64)5770011,
|
||||
if Button.Draw(look_session, Button.Props.{.key = cast(u64)5770011,
|
||||
.bounds = Bounds(x, action_y, action_width, action_height),
|
||||
.label = Locale("cancel_button"), .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
CancelRound()
|
||||
return
|
||||
}
|
||||
if Button(look_session, ButtonProps.{.key = cast(u64)5770012,
|
||||
if Button.Draw(look_session, Button.Props.{.key = cast(u64)5770012,
|
||||
.bounds = Bounds(x + action_width + gap, action_y, action_width, action_height),
|
||||
.label = Locale("save_button")}) != 0 {
|
||||
SaveRound()
|
||||
@@ -712,8 +705,8 @@ DayScreen :: () {
|
||||
if viewport_height < Scale(80) {
|
||||
viewport_height = Scale(80)
|
||||
}
|
||||
options: [1]DropdownOption
|
||||
unused TitleBar(look_session, TitleBarProps.{.title = day.title, .height = top_height,
|
||||
options: [1]Dropdown.Option
|
||||
unused TitleBar.Draw(look_session, TitleBar.Props.{.title = day.title, .height = top_height,
|
||||
.bounds = Bounds(0, 0, day.view_width, top_height)}, options[0:0])
|
||||
button_total := Scale(22) + Scale(11) * 2
|
||||
close_y := (top_height - button_total) / 2
|
||||
@@ -721,7 +714,7 @@ DayScreen :: () {
|
||||
close_y = 0
|
||||
}
|
||||
close_label := Locale("close_button")
|
||||
if !day.modal_active && Button(look_session, ButtonProps.{.id = 9101,
|
||||
if !day.modal_active && Button.Draw(look_session, Button.Props.{.id = 9101,
|
||||
.bounds = Bounds(day.view_width - button_total - Scale(8), close_y,
|
||||
button_total, button_total),
|
||||
.label = close_label, .image = UiImage(close_label, 448.0, 384.0),
|
||||
@@ -739,8 +732,8 @@ DayScreen :: () {
|
||||
content_width = max_width
|
||||
}
|
||||
content_height := DayContent(content_x, content_width, y, false) - y
|
||||
scroll := Scroll(look_session, ScrollProps.{
|
||||
.key = KeyHash("inbe/screens/habits/session/scroll/1"),
|
||||
scroll := Scroll.Draw(look_session, Scroll.Props.{
|
||||
.key = Layout.KeyHash("inbe/screens/habits/session/scroll/1"),
|
||||
.bounds = Bounds(0, y, day.view_width, viewport_height),
|
||||
.content_height = content_height, .scroll_offset = day.scroll})
|
||||
day.scroll = scroll.scroll_offset
|
||||
@@ -806,15 +799,15 @@ DateText :: (value: s32) -> string {
|
||||
TimeField :: (key: s32, label: string, x: s32, y: s32, width: s32, value: s32,
|
||||
clearable: bool, placeholder: string) -> s32 {
|
||||
if label.count > 0 {
|
||||
Text(look_session, TextProps.{.bounds = Bounds(x, y, width, Scale(24)), .text = label,
|
||||
.font = look_font, .wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(x, y, width, Scale(24)), .text = label,
|
||||
.size = look_font, .wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
}
|
||||
picker_width := Scale(160)
|
||||
if picker_width > width {
|
||||
picker_width = width
|
||||
}
|
||||
picked := TimePicker(look_session, TimePickerProps.{
|
||||
.key = KeyHash("habits/answers/time") + cast(u64)key, .id = 7960 + key,
|
||||
picked := TimePicker.Draw(look_session, TimePicker.Props.{
|
||||
.key = Layout.KeyHash("habits/answers/time") + cast(u64)key, .id = 7960 + key,
|
||||
.bounds = Bounds(x, y + Scale(DAY_ANSWER_INPUT_Y), picker_width, Scale(44)),
|
||||
.label = label, .value = value, .now = entry.now,
|
||||
.now_label = Locale("statistics_now_label"), .done_label = Locale("done_button"),
|
||||
@@ -830,7 +823,7 @@ TimeField :: (key: s32, label: string, x: s32, y: s32, width: s32, value: s32,
|
||||
AnswerField :: (index: s32, answer: *HabitsAnswer, bounds: Rectangle, numeric: bool,
|
||||
max_bytes: s32) -> bool {
|
||||
focused := entry.focus == index
|
||||
props := TextFieldProps.{.key = KeyHash("habits/answers/field") + cast(u64)index,
|
||||
props := TextField.Props.{.key = Layout.KeyHash("habits/answers/field") + cast(u64)index,
|
||||
.bounds = bounds, .value = answer.value, .focused = focused,
|
||||
.focus_id = 7800 + index, .numeric = numeric, .max_bytes = max_bytes,
|
||||
.max_codepoints = max_bytes, .disabled = entry.modal_active}
|
||||
@@ -840,7 +833,7 @@ AnswerField :: (index: s32, answer: *HabitsAnswer, bounds: Rectangle, numeric: b
|
||||
props.scroll_x = entry.scroll_x
|
||||
props.input = entry.input
|
||||
}
|
||||
result := TextField(look_session, props)
|
||||
result := TextField.Draw(look_session, props)
|
||||
changed := false
|
||||
if result.edit.changed {
|
||||
answer.value = Replaced(answer.value, result.edit.start, result.edit.end,
|
||||
@@ -871,7 +864,7 @@ YesNo :: (answer: *HabitsAnswer, id: s32, x: s32, y: s32, width: s32) -> bool {
|
||||
changed := false
|
||||
for option: cast(s32)0..1 {
|
||||
chosen := answer.value == values[option]
|
||||
if Button(look_session, ButtonProps.{.id = id + option,
|
||||
if Button.Draw(look_session, Button.Props.{.id = id + option,
|
||||
.bounds = Bounds(x + option * (half + gap), y, half, Scale(44)),
|
||||
.label = labels[option],
|
||||
.tone = cast(ButtonTone)(ifx chosen then ButtonToneAccent else ButtonToneNeutral),
|
||||
@@ -920,7 +913,7 @@ AnswerFields :: (x: s32, y: s32, width: s32) {
|
||||
picker_width := Scale(160)
|
||||
now_width := Scale(96)
|
||||
if picker_width + Scale(8) + now_width <= width {
|
||||
if Button(look_session, ButtonProps.{.id = 5730005,
|
||||
if Button.Draw(look_session, Button.Props.{.id = 5730005,
|
||||
.bounds = Bounds(x + picker_width + Scale(8), y + Scale(DAY_ANSWER_INPUT_Y),
|
||||
now_width, Scale(44)),
|
||||
.label = Locale("statistics_now_label"), .tone = cast(ButtonTone)ButtonToneAccent,
|
||||
@@ -936,9 +929,9 @@ AnswerFields :: (x: s32, y: s32, width: s32) {
|
||||
continue
|
||||
}
|
||||
answer := ReadHabitsAnswerHost(index)
|
||||
Text(look_session, TextProps.{.bounds = Bounds(x, y, width, Scale(24)),
|
||||
.text = answer.question, .font = look_font,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(x, y, width, Scale(24)),
|
||||
.text = answer.question, .size = look_font,
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
input_y := y + Scale(DAY_ANSWER_INPUT_Y)
|
||||
changed := false
|
||||
if answer.answer_type == HABIT_ANSWER_TIME {
|
||||
@@ -962,7 +955,7 @@ AnswerFields :: (x: s32, y: s32, width: s32) {
|
||||
|
||||
// The fields in a scrolling area, for entries that do not all fit.
|
||||
AnswerArea :: (bounds: Rectangle) {
|
||||
scroll := Scroll(look_session, ScrollProps.{.key = KeyHash("habits/answers/scroll"),
|
||||
scroll := Scroll.Draw(look_session, Scroll.Props.{.key = Layout.KeyHash("habits/answers/scroll"),
|
||||
.bounds = bounds, .content_height = AnswersHeight(),
|
||||
.scroll_offset = entry.scroll, .scale = look_scale})
|
||||
entry.scroll = scroll.scroll_offset
|
||||
@@ -997,7 +990,7 @@ EntryDialog :: () {
|
||||
date_room := date_height - date_lift + Scale(10)
|
||||
area_height := AnswerAreaHeight(date_room + gap + button_height)
|
||||
content_height := date_room + area_height + gap + button_height
|
||||
frame := ModalFrame(look_session, ModalFrameProps.{.key = KeyHash("habits/entry-dialog"),
|
||||
frame := Modal.Draw(look_session, Modal.Props.{.key = Layout.KeyHash("habits/entry-dialog"),
|
||||
.title = entry.name, .strong_title = true, .title_at_start = true,
|
||||
.width = Scale(380), .height = content_height + Scale(74), .scale = look_scale,
|
||||
.has_right_action = true, .right_label = Locale("cancel_button")})
|
||||
@@ -1013,21 +1006,21 @@ EntryDialog :: () {
|
||||
y := cast(s32)content.y
|
||||
width := cast(s32)content.width
|
||||
day_text := ifx entry.day == entry.today then Locale("habits_today") else DateText(entry.day)
|
||||
Text(look_session, TextProps.{.bounds = Bounds(x, y - date_lift, width, date_height),
|
||||
.text = day_text, .font = look_small_font, .class_name = look_muted,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
Text.Draw(look_session, Text.Props.{.bounds = Bounds(x, y - date_lift, width, date_height),
|
||||
.text = day_text, .size = look_small_font, .class_name = look_muted,
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
y += date_room
|
||||
AnswerArea(Bounds(x, y, width, area_height))
|
||||
y += area_height + gap
|
||||
if entry.existing {
|
||||
half := (width - gap) / 2
|
||||
if Button(look_session, ButtonProps.{.id = 5730001,
|
||||
if Button.Draw(look_session, Button.Props.{.id = 5730001,
|
||||
.bounds = Bounds(x, y, half, button_height), .label = Locale("delete_button"),
|
||||
.tone = cast(ButtonTone)ButtonToneDanger,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
EntryAsk(HABITS_ENTRY_DELETE)
|
||||
}
|
||||
if Button(look_session, ButtonProps.{.id = 5730002,
|
||||
if Button.Draw(look_session, Button.Props.{.id = 5730002,
|
||||
.bounds = Bounds(x + half + gap, y, width - half - gap, button_height),
|
||||
.label = Locale("save_button"), .tone = cast(ButtonTone)ButtonToneAccent,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
|
||||
@@ -1038,7 +1031,7 @@ EntryDialog :: () {
|
||||
done_x := x
|
||||
if entry.answer_count > 0 {
|
||||
half := (width - gap) / 2
|
||||
if Button(look_session, ButtonProps.{.id = 5730004,
|
||||
if Button.Draw(look_session, Button.Props.{.id = 5730004,
|
||||
.bounds = Bounds(x, y, half, button_height), .label = Locale("skip_button"),
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
@@ -1046,7 +1039,7 @@ EntryDialog :: () {
|
||||
}
|
||||
done_x = x + half + gap
|
||||
}
|
||||
if Button(look_session, ButtonProps.{.id = 5730003,
|
||||
if Button.Draw(look_session, Button.Props.{.id = 5730003,
|
||||
.bounds = Bounds(done_x, y, x + width - done_x, button_height),
|
||||
.label = Locale("done_button"), .tone = cast(ButtonTone)ButtonToneAccent,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
|
||||
|
||||
+120
-134
@@ -5,54 +5,42 @@
|
||||
// done). The host keeps the habit being edited; the editor changes it and
|
||||
// asks the host to save it, delete it, open the practice picker, or add or
|
||||
// remove a question.
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Checkbox :: #import "kryon/checkbox";
|
||||
Dropdown :: #import "kryon/dropdown";
|
||||
Fieldset :: #import "kryon/fieldset";
|
||||
Layout :: #import "kryon/layout";
|
||||
Modal :: #import "kryon/modal";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
SegmentedControl :: #import "kryon/segmented_control";
|
||||
Spinbox :: #import "kryon/spinbox";
|
||||
SvgIcon :: #import "kryon/svg_icon";
|
||||
Text :: #import "kryon/text";
|
||||
TextArea :: #import "kryon/text_area";
|
||||
TextField :: #import "kryon/text_field";
|
||||
TimePicker :: #import "kryon/time_picker";
|
||||
TitleBar :: #import "kryon/title_bar";
|
||||
Toggle :: #import "kryon/toggle";
|
||||
#import "kryon/system_clipboard"
|
||||
#import "session"
|
||||
#import "geometry"
|
||||
#import "vec"
|
||||
#import "dpi"
|
||||
#import "layout"
|
||||
#import "drawing_props"
|
||||
#import "semantic"
|
||||
#import "text_props"
|
||||
#import "text_align"
|
||||
#import "text_widget"
|
||||
#import "text_measure"
|
||||
#import "text_input_props"
|
||||
#import "text_field_widget"
|
||||
#import "text_area_widget"
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "checkbox_props"
|
||||
#import "checkbox_widget"
|
||||
#import "dropdown_props"
|
||||
#import "dropdown_widget"
|
||||
#import "fieldset_props"
|
||||
#import "fieldset_widget"
|
||||
#import "modal_props"
|
||||
#import "modal_frame_widget"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "segmented_control_props"
|
||||
#import "segmented_control_widget"
|
||||
#import "spinbox_props"
|
||||
#import "spinbox_widget"
|
||||
#import "svg_icon_props"
|
||||
#import "svg_icon_widget"
|
||||
#import "time_picker_props"
|
||||
#import "time_picker_widget"
|
||||
#import "title_bar_props"
|
||||
#import "title_bar_widget"
|
||||
#import "toggle_props"
|
||||
#import "toggle_widget"
|
||||
#import "toggle_measure"
|
||||
#import "tree"
|
||||
#import "kryon/tree"
|
||||
#import, file "../../src/apps/habits_ui_types.zi";
|
||||
#import, file "../../src/apps/habits_types.zi";
|
||||
#import, file "../../src/habits/habit_types.zi";
|
||||
#import, file "../../src/habits/habit_icons.zi";
|
||||
#import, file "../../src/habits/habit_links.zi";
|
||||
#import, file "../../src/habits/habit_coins.zi";
|
||||
#import, file "coin_color.zi";
|
||||
#import, file "../../src/habits/habit_schedule.zi";
|
||||
#import, file "../../src/habits/habit_questions.zi";
|
||||
CoinIcon :: #import "mingcute/mingcute_filled_copper_coin";
|
||||
@@ -61,7 +49,7 @@ using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
using SemanticKind;
|
||||
using TextAlign;
|
||||
using TextWrap;
|
||||
using Text.Wrap;
|
||||
host_api :: #system_library "host_api";
|
||||
ReadHabitsEditHost :: () -> HabitsEditFrame #foreign host_api;
|
||||
WriteHabitsEditHost :: (frame: HabitsEditFrame) #foreign host_api;
|
||||
@@ -122,7 +110,7 @@ Locale :: (key: string) -> string {
|
||||
}
|
||||
|
||||
Width :: (text: string, font: s32) -> s32 {
|
||||
return TextWidth(edit.session, TextProps.{.text = text, .font = font})
|
||||
return TextWidth(edit.session, Text.Props.{.text = text, .size = font})
|
||||
}
|
||||
|
||||
Number :: (value: s64) -> string {
|
||||
@@ -188,17 +176,17 @@ FitFont :: (text: string, max_width: s32, preferred: s32, minimum: s32) -> s32 {
|
||||
}
|
||||
|
||||
Label :: (text: string, x: s32, y: s32, width: s32, height: s32) {
|
||||
Text(edit.session, TextProps.{.bounds = Bounds(x, y, width, height), .text = text})
|
||||
Text.Draw(edit.session, Text.Props.{.bounds = Bounds(x, y, width, height), .text = text})
|
||||
}
|
||||
|
||||
// A label beside a row's 44-unit control, centred on it.
|
||||
RowLabel :: (text: string, x: s32, y: s32, width: s32) {
|
||||
Text(edit.session, TextProps.{.bounds = Bounds(x, y + Scale(4), width, Scale(44)),
|
||||
Text.Draw(edit.session, Text.Props.{.bounds = Bounds(x, y + Scale(4), width, Scale(44)),
|
||||
.text = text, .vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
}
|
||||
|
||||
Step :: (id: s32, label: string, bounds: Rectangle, disabled: bool) -> bool {
|
||||
return Button(edit.session, ButtonProps.{.id = id, .bounds = bounds, .label = label,
|
||||
return Button.Draw(edit.session, Button.Props.{.id = id, .bounds = bounds, .label = label,
|
||||
.disabled = disabled, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0
|
||||
}
|
||||
@@ -210,7 +198,7 @@ Ask :: (action: s32, index: s32) {
|
||||
}
|
||||
}
|
||||
|
||||
Clipboard :: (result: TextFieldResult) {
|
||||
Clipboard :: (result: TextField.Result) {
|
||||
if result.clipboard_write {
|
||||
edit.clipboard_write = true
|
||||
edit.clipboard_text = result.clipboard_text
|
||||
@@ -318,9 +306,9 @@ SpreadBounds :: (x: s32, y: s32, width: s32, count: s32, index: s32) -> Rectangl
|
||||
}
|
||||
|
||||
HintHeight :: (width: s32) -> s32 {
|
||||
return TextHeight(edit.session, TextProps.{.text = Locale("habit_formula_hint"),
|
||||
.font = edit.small_font, .bounds = Bounds(0, 0, width, 0),
|
||||
.wrap = cast(TextWrap)TextWrapAuto})
|
||||
return TextHeight(edit.session, Text.Props.{.text = Locale("habit_formula_hint"),
|
||||
.size = edit.small_font, .bounds = Bounds(0, 0, width, 0),
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
}
|
||||
|
||||
ScheduleHeight :: (width: s32) -> s32 {
|
||||
@@ -393,15 +381,15 @@ RepeatPhrase :: (repeat: s32, every: s32) -> string {
|
||||
LitDay :: (bounds: Rectangle, label: string) {
|
||||
color := edit.color
|
||||
color.a = 255
|
||||
unused Box(edit.session, BoxProps.{.bounds = bounds, .fill = color,
|
||||
unused Box.Draw(edit.session, Box.Props.{.bounds = bounds, .fill = color,
|
||||
.radius = bounds.width * 0.5})
|
||||
luma := cast(s32)color.r * 299 + cast(s32)color.g * 587 + cast(s32)color.b * 114
|
||||
Text(edit.session, TextProps.{.bounds = bounds, .text = label,
|
||||
.font = FitFont(label, cast(s32)bounds.width - Scale(6), edit.small_font, Scale(9)),
|
||||
Text.Draw(edit.session, Text.Props.{.bounds = bounds, .text = label,
|
||||
.size = FitFont(label, cast(s32)bounds.width - Scale(6), edit.small_font, Scale(9)),
|
||||
.class_name = ifx luma >= 128000 then edit.ink_dark_class else edit.ink_light_class,
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
|
||||
// Round day buttons from Monday to Sunday: a lit day is planned, and a tap
|
||||
@@ -413,7 +401,7 @@ WeekdayButtons :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
for day: cast(s32)0..6 {
|
||||
selected := (edit.weekdays & (1 << day)) != 0
|
||||
bounds := SpreadBounds(x, y, width, 7, day)
|
||||
clicked := Button(edit.session, ButtonProps.{.id = 7710 + day, .bounds = bounds,
|
||||
clicked := Button.Draw(edit.session, Button.Props.{.id = 7710 + day, .bounds = bounds,
|
||||
.label = days[day], .circle = true, .fit_content = true, .selected = selected,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0
|
||||
@@ -437,7 +425,7 @@ MonthDayButtons :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
selected := (edit.month_days & bit) != 0
|
||||
label := Number(cast(s64)day)
|
||||
bounds := GridBounds(x, y, width, day - 1)
|
||||
clicked := Button(edit.session, ButtonProps.{.id = 7730 + day, .bounds = bounds,
|
||||
clicked := Button.Draw(edit.session, Button.Props.{.id = 7730 + day, .bounds = bounds,
|
||||
.label = label, .circle = true, .selected = selected,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0
|
||||
@@ -453,7 +441,7 @@ MonthDayButtons :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
}
|
||||
y += GridHeight(31, width)
|
||||
last := edit.last_day
|
||||
if Button(edit.session, ButtonProps.{.id = 7729, .bounds = Bounds(x, y, width, Scale(40)),
|
||||
if Button.Draw(edit.session, Button.Props.{.id = 7729, .bounds = Bounds(x, y, width, Scale(40)),
|
||||
.label = Locale("habit_month_last_day"), .selected = last,
|
||||
.tone = cast(ButtonTone)(ifx last then ButtonToneAccent else ButtonToneNeutral),
|
||||
.emphasis = cast(ButtonEmphasis)(ifx last then ButtonEmphasisFilled
|
||||
@@ -468,10 +456,10 @@ MonthDayButtons :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
// A monthly schedule plans days of the month, or a weekday in a week of the
|
||||
// month such as the last Friday.
|
||||
Monthly :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
options: [2]SegmentOption = .[
|
||||
SegmentOption.{.label = Locale("habit_month_by_day")},
|
||||
SegmentOption.{.label = Locale("habit_month_by_weekday")}]
|
||||
switch := SegmentedControl(edit.session, SegmentedControlProps.{.id = 7720,
|
||||
options: [2]SegmentedControl.SegmentOption = .[
|
||||
SegmentedControl.SegmentOption.{.label = Locale("habit_month_by_day")},
|
||||
SegmentedControl.SegmentOption.{.label = Locale("habit_month_by_weekday")}]
|
||||
switch := SegmentedControl.Draw(edit.session, SegmentedControl.Props.{.id = 7720,
|
||||
.bounds = Bounds(x, y + Scale(4), width, Scale(42)), .height = Scale(42),
|
||||
.selected_index = ifx edit.week_of_month != 0 then 1 else 0,
|
||||
.has_selection = true}, options[:])
|
||||
@@ -500,11 +488,11 @@ Monthly :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
RowLabel(Locale("habit_week_of_month_label"), x, y, width - control_width - Scale(8))
|
||||
week_keys: [6]string = .["habit_week_first", "habit_week_second", "habit_week_third",
|
||||
"habit_week_fourth", "habit_week_fifth", "habit_week_last"]
|
||||
weeks: [6]DropdownOption
|
||||
weeks: [6]Dropdown.Option
|
||||
for index: cast(s32)0..5 {
|
||||
weeks[index].label = Locale(week_keys[index])
|
||||
}
|
||||
week_menu := Dropdown(edit.session, DropdownProps.{.id = 7721,
|
||||
week_menu := Dropdown.Draw(edit.session, Dropdown.Props.{.id = 7721,
|
||||
.bounds = Bounds(x + width - control_width, y + Scale(4), control_width, Scale(44)),
|
||||
.selected_index = ifx edit.week_of_month > 0 then edit.week_of_month - 1 else 5},
|
||||
weeks[:])
|
||||
@@ -530,18 +518,18 @@ Yearly :: (x: s32, y: s32, width: s32) {
|
||||
"habit_month_name_4", "habit_month_name_5", "habit_month_name_6", "habit_month_name_7",
|
||||
"habit_month_name_8", "habit_month_name_9", "habit_month_name_10",
|
||||
"habit_month_name_11", "habit_month_name_12"]
|
||||
months: [12]DropdownOption
|
||||
months: [12]Dropdown.Option
|
||||
for month: cast(s32)0..11 {
|
||||
months[month].label = Locale(keys[month])
|
||||
}
|
||||
month_menu := Dropdown(edit.session, DropdownProps.{.id = 7724,
|
||||
month_menu := Dropdown.Draw(edit.session, Dropdown.Props.{.id = 7724,
|
||||
.bounds = Bounds(x, y + Scale(4), month_width, Scale(44)),
|
||||
.selected_index = date.month - 1}, months[:])
|
||||
chosen_month := date.month
|
||||
if month_menu.changed {
|
||||
chosen_month = month_menu.selected_index + 1
|
||||
}
|
||||
stepped := Spinbox(edit.session, SpinboxProps.{.id = 7725,
|
||||
stepped := Spinbox.Draw(edit.session, Spinbox.Props.{.id = 7725,
|
||||
.bounds = Bounds(x + month_width + gap, y + Scale(4), width - month_width - gap, Scale(44)),
|
||||
.label = Locale("habit_every_year"), .min = 1, .max = 31, .step = 1,
|
||||
.value = date.day, .wrap = true, .value_text = Number(cast(s64)date.day)})
|
||||
@@ -560,12 +548,12 @@ Yearly :: (x: s32, y: s32, width: s32) {
|
||||
|
||||
FormulaField :: (bounds: Rectangle) -> bool {
|
||||
focused := edit.formula_focused
|
||||
result := TextField(edit.session, TextFieldProps.{.key = KeyHash("habit/edit/formula"),
|
||||
result := TextField.Draw(edit.session, TextField.Props.{.key = Layout.KeyHash("habit/edit/formula"),
|
||||
.bounds = bounds, .value = edit.formula, .cursor = edit.formula_cursor,
|
||||
.anchor = edit.formula_anchor, .scroll_x = edit.formula_scroll_x,
|
||||
.focused = focused, .focus_id = 7770, .max_bytes = HABIT_FORMULA_SIZE - 1,
|
||||
.max_codepoints = HABIT_FORMULA_SIZE - 1,
|
||||
.input = ifx focused then edit.input else TextFieldInput.{}})
|
||||
.input = ifx focused then edit.input else TextField.Input.{}})
|
||||
if result.edit.changed {
|
||||
edit.formula = Replaced(edit.formula, result.edit.start, result.edit.end,
|
||||
result.edit.replacement, HABIT_FORMULA_SIZE - 1)
|
||||
@@ -592,11 +580,11 @@ Routine :: (x: s32, y: s32, width: s32) {
|
||||
if counted {
|
||||
menu_width = width - step_width * 2 - Scale(8)
|
||||
}
|
||||
repeats: [6]DropdownOption
|
||||
repeats: [6]Dropdown.Option
|
||||
for index: cast(s32)0..5 {
|
||||
repeats[index].label = RepeatPhrase(index + 1, edit.every)
|
||||
}
|
||||
repeat_menu := Dropdown(edit.session, DropdownProps.{.id = 7700,
|
||||
repeat_menu := Dropdown.Draw(edit.session, Dropdown.Props.{.id = 7700,
|
||||
.bounds = Bounds(x, y + Scale(4), menu_width, Scale(44)),
|
||||
.selected_index = edit.repeat - 1}, repeats[:])
|
||||
if repeat_menu.changed {
|
||||
@@ -630,9 +618,9 @@ Routine :: (x: s32, y: s32, width: s32) {
|
||||
}
|
||||
y += row
|
||||
hint_height := HintHeight(width)
|
||||
Text(edit.session, TextProps.{.bounds = Bounds(x, y, width, hint_height),
|
||||
.text = Locale("habit_formula_hint"), .font = edit.small_font,
|
||||
.wrap = cast(TextWrap)TextWrapAuto})
|
||||
Text.Draw(edit.session, Text.Props.{.bounds = Bounds(x, y, width, hint_height),
|
||||
.text = Locale("habit_formula_hint"), .size = edit.small_font,
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
y += hint_height + Scale(8)
|
||||
if !FormulaValid() {
|
||||
Label(Locale("habit_formula_invalid"), x, y, width, Scale(24))
|
||||
@@ -643,7 +631,7 @@ Routine :: (x: s32, y: s32, width: s32) {
|
||||
return
|
||||
}
|
||||
RowLabel(Locale("habit_reminder_label"), x, y, width - Scale(144))
|
||||
hours: [25]DropdownOption
|
||||
hours: [25]Dropdown.Option
|
||||
hours[0].label = Locale("habit_reminder_off")
|
||||
for hour: cast(s32)0..23 {
|
||||
out: Vec(u8)
|
||||
@@ -653,7 +641,7 @@ Routine :: (x: s32, y: s32, width: s32) {
|
||||
BuilderPrint(*out, "%:00", hour)
|
||||
hours[hour + 1].label = BuilderFinish(out)
|
||||
}
|
||||
hour_menu := Dropdown(edit.session, DropdownProps.{.id = 7400,
|
||||
hour_menu := Dropdown.Draw(edit.session, Dropdown.Props.{.id = 7400,
|
||||
.bounds = Bounds(x + width - Scale(136), y + Scale(4), Scale(136), Scale(44)),
|
||||
.selected_index = edit.reminder_hour + 1}, hours[:])
|
||||
if hour_menu.changed {
|
||||
@@ -665,12 +653,12 @@ Routine :: (x: s32, y: s32, width: s32) {
|
||||
|
||||
NameField :: (bounds: Rectangle) -> bool {
|
||||
focused := edit.name_focused
|
||||
result := TextField(edit.session, TextFieldProps.{.key = KeyHash("habit/edit/name"),
|
||||
result := TextField.Draw(edit.session, TextField.Props.{.key = Layout.KeyHash("habit/edit/name"),
|
||||
.bounds = bounds, .value = edit.name, .cursor = edit.name_cursor,
|
||||
.anchor = edit.name_anchor, .scroll_x = edit.name_scroll_x, .focused = focused,
|
||||
.focus_id = 7511, .max_bytes = HABIT_NAME_SIZE - 1,
|
||||
.max_codepoints = HABIT_NAME_SIZE - 1,
|
||||
.input = ifx focused then edit.input else TextFieldInput.{}})
|
||||
.input = ifx focused then edit.input else TextField.Input.{}})
|
||||
if result.edit.changed {
|
||||
changed := Replaced(edit.name, result.edit.start, result.edit.end,
|
||||
result.edit.replacement, HABIT_NAME_SIZE - 1)
|
||||
@@ -692,12 +680,12 @@ NameField :: (bounds: Rectangle) -> bool {
|
||||
|
||||
DescriptionField :: (bounds: Rectangle) -> bool {
|
||||
focused := edit.description_focused
|
||||
result := TextArea(edit.session, TextAreaProps.{.key = KeyHash("habit/edit/description"),
|
||||
result := TextArea.Draw(edit.session, TextArea.Props.{.key = Layout.KeyHash("habit/edit/description"),
|
||||
.bounds = bounds, .value = edit.description, .cursor = edit.description_cursor,
|
||||
.anchor = edit.description_anchor, .scroll_y = edit.description_scroll_y,
|
||||
.focused = focused, .focus_id = 7512, .max_bytes = HABIT_DESCRIPTION_SIZE - 1,
|
||||
.max_codepoints = HABIT_DESCRIPTION_SIZE - 1, .wrap = true,
|
||||
.input = ifx focused then edit.area_input else TextAreaInput.{}})
|
||||
.input = ifx focused then edit.area_input else TextArea.Input.{}})
|
||||
if result.edit.changed {
|
||||
edit.description = Replaced(edit.description, result.edit.start, result.edit.end,
|
||||
result.edit.replacement, HABIT_DESCRIPTION_SIZE - 1)
|
||||
@@ -724,7 +712,7 @@ Colors :: (x: s32, y: s32, width: s32) {
|
||||
swatch := EditColor(index)
|
||||
chosen := !more && edit.color.r == swatch.r && edit.color.g == swatch.g &&
|
||||
edit.color.b == swatch.b
|
||||
if Button(edit.session, ButtonProps.{.id = 7530 + index,
|
||||
if Button.Draw(edit.session, Button.Props.{.id = 7530 + index,
|
||||
.bounds = Bounds(x + (index % columns) * Scale(48) + Scale(4),
|
||||
y + (index / columns) * Scale(44) + Scale(2), Scale(40), Scale(40)),
|
||||
.label = ifx more then "..." else "", .circle = true, .selected = chosen,
|
||||
@@ -774,7 +762,7 @@ Icons :: (x: s32, y: s32, width: s32) {
|
||||
chosen = HABIT_ICON_LETTER
|
||||
}
|
||||
selected := edit.icon == chosen
|
||||
button := ButtonProps.{.id = EDIT_ICON_BUTTON_BASE + icon, .bounds = GridBounds(x, y - Scale(2), width, slot),
|
||||
button := Button.Props.{.id = EDIT_ICON_BUTTON_BASE + icon, .bounds = GridBounds(x, y - Scale(2), width, slot),
|
||||
.circle = true, .selected = selected,
|
||||
.tone = cast(ButtonTone)(ifx selected then ButtonToneAccent else ButtonToneNeutral),
|
||||
.emphasis = cast(ButtonEmphasis)(ifx selected then ButtonEmphasisFilled
|
||||
@@ -785,12 +773,12 @@ Icons :: (x: s32, y: s32, width: s32) {
|
||||
button.icon_shape = HabitIconShape(icon)
|
||||
button.icon_only = true
|
||||
}
|
||||
if Button(edit.session, button) != 0 {
|
||||
if Button.Draw(edit.session, button) != 0 {
|
||||
edit.icon = chosen
|
||||
}
|
||||
}
|
||||
if collapsed {
|
||||
if Button(edit.session, ButtonProps.{.id = 7559,
|
||||
if Button.Draw(edit.session, Button.Props.{.id = 7559,
|
||||
.bounds = GridBounds(x, y - Scale(2), width, shown), .circle = true,
|
||||
.label = "...", .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
@@ -882,11 +870,11 @@ CoinField :: (bounds: Rectangle) {
|
||||
edit.coin_anchor = edit.coin_cursor
|
||||
}
|
||||
focused := edit.coin_focused
|
||||
result := TextField(edit.session, TextFieldProps.{.key = KeyHash("habit/edit/coins"),
|
||||
result := TextField.Draw(edit.session, TextField.Props.{.key = Layout.KeyHash("habit/edit/coins"),
|
||||
.bounds = bounds, .value = edit.coin_text, .cursor = edit.coin_cursor,
|
||||
.anchor = edit.coin_anchor, .scroll_x = edit.coin_scroll_x, .focused = focused,
|
||||
.focus_id = 7607, .max_bytes = 7, .max_codepoints = 7,
|
||||
.input = ifx focused then edit.input else TextFieldInput.{}})
|
||||
.input = ifx focused then edit.input else TextField.Input.{}})
|
||||
if result.edit.changed {
|
||||
edit.coin_text = Replaced(edit.coin_text, result.edit.start, result.edit.end,
|
||||
result.edit.replacement, 7)
|
||||
@@ -907,12 +895,12 @@ CoinField :: (bounds: Rectangle) {
|
||||
|
||||
Difficulty :: (x: s32, y: s32, width: s32) {
|
||||
Label(Locale("habit_difficulty_label"), x, y, width, Scale(26))
|
||||
options: [HABIT_DIFFICULTY_COUNT]SegmentOption = .[
|
||||
SegmentOption.{.label = DifficultyLabel(HABIT_DIFFICULTY_EASY)},
|
||||
SegmentOption.{.label = DifficultyLabel(HABIT_DIFFICULTY_MEDIUM)},
|
||||
SegmentOption.{.label = DifficultyLabel(HABIT_DIFFICULTY_HARD)},
|
||||
SegmentOption.{.label = DifficultyLabel(HABIT_DIFFICULTY_VERY_HARD)}]
|
||||
switch := SegmentedControl(edit.session, SegmentedControlProps.{.id = 7605,
|
||||
options: [HABIT_DIFFICULTY_COUNT]SegmentedControl.SegmentOption = .[
|
||||
SegmentedControl.SegmentOption.{.label = DifficultyLabel(HABIT_DIFFICULTY_EASY)},
|
||||
SegmentedControl.SegmentOption.{.label = DifficultyLabel(HABIT_DIFFICULTY_MEDIUM)},
|
||||
SegmentedControl.SegmentOption.{.label = DifficultyLabel(HABIT_DIFFICULTY_HARD)},
|
||||
SegmentedControl.SegmentOption.{.label = DifficultyLabel(HABIT_DIFFICULTY_VERY_HARD)}]
|
||||
switch := SegmentedControl.Draw(edit.session, SegmentedControl.Props.{.id = 7605,
|
||||
.bounds = Bounds(x, y + Scale(30), width, Scale(42)), .height = Scale(42),
|
||||
.selected_index = HabitDifficultyIndex(edit.difficulty),
|
||||
.has_selection = !edit.custom_coins}, options[:])
|
||||
@@ -922,19 +910,19 @@ Difficulty :: (x: s32, y: s32, width: s32) {
|
||||
}
|
||||
hint_y := y + Scale(80)
|
||||
coin := Scale(18)
|
||||
unused SvgIcon(edit.session, SvgIconProps.{.bounds = Bounds(x, hint_y + (Scale(22) - coin) / 2,
|
||||
unused SvgIcon.Draw(edit.session, SvgIcon.Props.{.bounds = Bounds(x, hint_y + (Scale(22) - coin) / 2,
|
||||
coin, coin),
|
||||
.shape = CoinIcon.Shape, .color = Color.{.r = 226, .g = 168, .b = 48, .a = 255}})
|
||||
Text(edit.session, TextProps.{.bounds = Bounds(x + coin + Scale(8), hint_y,
|
||||
.shape = CoinIcon.Shape, .color = HabitsCoinColor(edit.highlight_color, edit.text_color)})
|
||||
Text.Draw(edit.session, Text.Props.{.bounds = Bounds(x + coin + Scale(8), hint_y,
|
||||
width - coin - Scale(8), Scale(30)),
|
||||
.text = ifx edit.custom_coins then Locale("habit_coins_signed_hint")
|
||||
else DifficultyEarns(edit.difficulty),
|
||||
.font = edit.small_font, .class_name = edit.muted_class,
|
||||
.size = edit.small_font, .class_name = edit.muted_class,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapAuto})
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
y += Scale(112)
|
||||
Label(Locale("habit_custom_coins"), x, y + Scale(10), width - Scale(110), Scale(36))
|
||||
custom := Toggle(edit.session, ToggleProps.{.id = 7606,
|
||||
custom := Toggle.Draw(edit.session, Toggle.Props.{.id = 7606,
|
||||
.bounds = Bounds(x + width - Scale(100), y, Scale(100), Scale(36)),
|
||||
.value = edit.custom_coins, .off_label = Locale("toggle_off"),
|
||||
.on_label = Locale("toggle_on")})
|
||||
@@ -962,11 +950,11 @@ CounterField :: (bounds: Rectangle) -> bool {
|
||||
CounterText()
|
||||
}
|
||||
focused := edit.counter_focused
|
||||
result := TextField(edit.session, TextFieldProps.{.key = KeyHash("habit/edit/counter"),
|
||||
result := TextField.Draw(edit.session, TextField.Props.{.key = Layout.KeyHash("habit/edit/counter"),
|
||||
.bounds = bounds, .value = edit.counter_text, .cursor = edit.counter_cursor,
|
||||
.anchor = edit.counter_anchor, .scroll_x = edit.counter_scroll_x, .focused = focused,
|
||||
.focus_id = 7622, .numeric = true, .max_bytes = 4, .max_codepoints = 4,
|
||||
.input = ifx focused then edit.input else TextFieldInput.{}})
|
||||
.input = ifx focused then edit.input else TextField.Input.{}})
|
||||
if result.edit.changed {
|
||||
edit.counter_text = Replaced(edit.counter_text, result.edit.start, result.edit.end,
|
||||
result.edit.replacement, 4)
|
||||
@@ -994,8 +982,8 @@ CounterField :: (bounds: Rectangle) -> bool {
|
||||
|
||||
// A toggle at the row's end, as wide as its labels need, with its label
|
||||
// before it.
|
||||
RowToggle :: (id: s32, label: string, value: bool, x: s32, y: s32, width: s32) -> ToggleValueResult {
|
||||
props := ToggleProps.{.id = id, .value = value, .off_label = Locale("toggle_off"),
|
||||
RowToggle :: (id: s32, label: string, value: bool, x: s32, y: s32, width: s32) -> Toggle.ToggleValueResult {
|
||||
props := Toggle.Props.{.id = id, .value = value, .off_label = Locale("toggle_off"),
|
||||
.on_label = Locale("toggle_on")}
|
||||
size := ToggleSize(edit.session, props)
|
||||
toggle_width := cast(s32)size.x
|
||||
@@ -1006,7 +994,7 @@ RowToggle :: (id: s32, label: string, value: bool, x: s32, y: s32, width: s32) -
|
||||
props.bounds = Bounds(x + width - toggle_width, y + (Scale(44) - toggle_height) / 2,
|
||||
toggle_width, toggle_height)
|
||||
Label(label, x, y + Scale(10), width - toggle_width - Scale(8), Scale(36))
|
||||
return Toggle(edit.session, props)
|
||||
return Toggle.Draw(edit.session, props)
|
||||
}
|
||||
|
||||
// A number goal's bounds as typed, from its goal.
|
||||
@@ -1028,7 +1016,7 @@ GoalTexts :: (question: *HabitsEditQuestion) {
|
||||
// has it. Returns the typed text.
|
||||
GoalField :: (code: s32, bounds: Rectangle, value: string, max_bytes: s32) -> string {
|
||||
focused := edit.goal_focused == code + 1
|
||||
props := TextFieldProps.{.key = KeyHash("habit/edit/goal") + cast(u64)code,
|
||||
props := TextField.Props.{.key = Layout.KeyHash("habit/edit/goal") + cast(u64)code,
|
||||
.bounds = bounds, .value = value, .focused = focused, .focus_id = 7800 + code,
|
||||
.numeric = true, .max_bytes = max_bytes, .max_codepoints = max_bytes}
|
||||
if focused {
|
||||
@@ -1037,7 +1025,7 @@ GoalField :: (code: s32, bounds: Rectangle, value: string, max_bytes: s32) -> st
|
||||
props.scroll_x = edit.goal_scroll_x
|
||||
props.input = edit.input
|
||||
}
|
||||
result := TextField(edit.session, props)
|
||||
result := TextField.Draw(edit.session, props)
|
||||
typed := value
|
||||
if result.edit.changed {
|
||||
typed = Replaced(value, result.edit.start, result.edit.end, result.edit.replacement,
|
||||
@@ -1079,8 +1067,8 @@ GoalBound :: (slot: s32, high: bool, question: *HabitsEditQuestion, x: s32, y: s
|
||||
}
|
||||
picker_width := Scale(132)
|
||||
code := slot * 2 + ifx high then 1 else 0
|
||||
picked := TimePicker(edit.session, TimePickerProps.{
|
||||
.key = KeyHash("habit/edit/goal-time") + cast(u64)code, .id = 7940 + code,
|
||||
picked := TimePicker.Draw(edit.session, TimePicker.Props.{
|
||||
.key = Layout.KeyHash("habit/edit/goal-time") + cast(u64)code, .id = 7940 + code,
|
||||
.bounds = Bounds(x, y, picker_width, Scale(44)),
|
||||
.label = Locale(ifx high then "habit_goal_before" else "habit_goal_after"),
|
||||
.value = ifx high then question.goal_high else question.goal_low, .now = edit.now,
|
||||
@@ -1099,7 +1087,7 @@ GoalBound :: (slot: s32, high: bool, question: *HabitsEditQuestion, x: s32, y: s
|
||||
// The goals an answer type offers, as options with their kinds: none for
|
||||
// text, yes or no, and otherwise above or below the average, then at least,
|
||||
// at most or between; a time reads them as later, earlier, after and before.
|
||||
GoalOptions :: (answer_type: s32, options: []DropdownOption, kinds: []s32) -> s32 {
|
||||
GoalOptions :: (answer_type: s32, options: []Dropdown.Option, kinds: []s32) -> s32 {
|
||||
if answer_type == HABIT_ANSWER_TEXT {
|
||||
return 0
|
||||
}
|
||||
@@ -1158,7 +1146,7 @@ GoalMenuWidth :: (width: s32) -> s32 {
|
||||
// "Good when" and the goal's options, then its values: from, up to, or
|
||||
// from and to. Changes the question; returns the y below them.
|
||||
Goal :: (slot: s32, question: *HabitsEditQuestion, x: s32, y: s32, width: s32) -> s32 {
|
||||
options: [EDIT_GOAL_OPTIONS]DropdownOption
|
||||
options: [EDIT_GOAL_OPTIONS]Dropdown.Option
|
||||
kinds: [EDIT_GOAL_OPTIONS]s32
|
||||
count := GoalOptions(question.answer_type, options[:], kinds[:])
|
||||
if count == 0 {
|
||||
@@ -1172,7 +1160,7 @@ Goal :: (slot: s32, question: *HabitsEditQuestion, x: s32, y: s32, width: s32) -
|
||||
selected = option
|
||||
}
|
||||
}
|
||||
chosen := Dropdown(edit.session, DropdownProps.{.id = 7770 + slot,
|
||||
chosen := Dropdown.Draw(edit.session, Dropdown.Props.{.id = 7770 + slot,
|
||||
.bounds = Bounds(x + width - menu_width, y + Scale(4), menu_width, Scale(44)),
|
||||
.selected_index = selected}, options[:count])
|
||||
if chosen.changed {
|
||||
@@ -1188,7 +1176,7 @@ Goal :: (slot: s32, question: *HabitsEditQuestion, x: s32, y: s32, width: s32) -
|
||||
bound_x += GoalBound(slot, false, question, bound_x, y + Scale(4))
|
||||
}
|
||||
if question.goal_kind == HABIT_GOAL_BETWEEN {
|
||||
Text(edit.session, TextProps.{.bounds = Bounds(bound_x, y + Scale(4), Scale(40), Scale(44)),
|
||||
Text.Draw(edit.session, Text.Props.{.bounds = Bounds(bound_x, y + Scale(4), Scale(40), Scale(44)),
|
||||
.text = Locale("habit_goal_and"), .align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
bound_x += Scale(40)
|
||||
@@ -1267,7 +1255,7 @@ SpanLength :: (bound: s32, label: string, x: s32, y: s32, width: s32) -> s32 {
|
||||
edit.span_high_minutes = typed
|
||||
}
|
||||
parts[part] = HabitTimeTypedNumber(typed)
|
||||
Text(edit.session, TextProps.{.bounds = Bounds(field_x + part_width, y + Scale(4),
|
||||
Text.Draw(edit.session, Text.Props.{.bounds = Bounds(field_x + part_width, y + Scale(4),
|
||||
unit_width, Scale(44)),
|
||||
.text = Locale(units[part]), .align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
@@ -1283,7 +1271,7 @@ SpanLength :: (bound: s32, label: string, x: s32, y: s32, width: s32) -> s32 {
|
||||
// spans before them, or at least, at most or between lengths typed in hours
|
||||
// and minutes, such as at most 8 hours for an eating window.
|
||||
SpanGoal :: (x: s32, y: s32, width: s32) {
|
||||
options: [6]DropdownOption
|
||||
options: [6]Dropdown.Option
|
||||
kinds: [6]s32 = .[HABIT_GOAL_NONE, HABIT_GOAL_BELOW_AVERAGE, HABIT_GOAL_ABOVE_AVERAGE,
|
||||
HABIT_GOAL_AT_LEAST, HABIT_GOAL_AT_MOST, HABIT_GOAL_BETWEEN]
|
||||
options[0].label = Locale("habit_span_goal_any")
|
||||
@@ -1300,7 +1288,7 @@ SpanGoal :: (x: s32, y: s32, width: s32) {
|
||||
selected = option
|
||||
}
|
||||
}
|
||||
chosen := Dropdown(edit.session, DropdownProps.{.id = 7615,
|
||||
chosen := Dropdown.Draw(edit.session, Dropdown.Props.{.id = 7615,
|
||||
.bounds = Bounds(x + width - menu_width, y + Scale(4), menu_width, Scale(44)),
|
||||
.selected_index = selected}, options[:])
|
||||
if chosen.changed {
|
||||
@@ -1402,7 +1390,7 @@ AnswerLabel :: (answer_type: s32) -> string {
|
||||
|
||||
QuestionField :: (index: s32, question: *HabitsEditQuestion, bounds: Rectangle) -> bool {
|
||||
focused := edit.question_focused == index + 1
|
||||
props := TextFieldProps.{.key = KeyHash("habit/edit/question") + cast(u64)index,
|
||||
props := TextField.Props.{.key = Layout.KeyHash("habit/edit/question") + cast(u64)index,
|
||||
.bounds = bounds, .value = question.text,
|
||||
.placeholder = Locale("habit_question_placeholder"), .focused = focused,
|
||||
.focus_id = 7720 + index, .max_bytes = HABIT_QUESTION_TEXT_SIZE - 1,
|
||||
@@ -1413,7 +1401,7 @@ QuestionField :: (index: s32, question: *HabitsEditQuestion, bounds: Rectangle)
|
||||
props.scroll_x = edit.question_scroll_x
|
||||
props.input = edit.input
|
||||
}
|
||||
result := TextField(edit.session, props)
|
||||
result := TextField.Draw(edit.session, props)
|
||||
if result.edit.changed {
|
||||
question.text = Replaced(question.text, result.edit.start, result.edit.end,
|
||||
result.edit.replacement, HABIT_QUESTION_TEXT_SIZE - 1)
|
||||
@@ -1439,7 +1427,7 @@ Questions :: (x: s32, y: s32, width: s32) {
|
||||
y += Scale(48)
|
||||
remove_width := Scale(44)
|
||||
type_width := Scale(160)
|
||||
types: [HABIT_ANSWER_TYPE_COUNT]DropdownOption
|
||||
types: [HABIT_ANSWER_TYPE_COUNT]Dropdown.Option
|
||||
for answer_type: cast(s32)0..HABIT_ANSWER_TYPE_COUNT - 1 {
|
||||
types[answer_type].label = AnswerLabel(answer_type + 1)
|
||||
}
|
||||
@@ -1451,7 +1439,7 @@ Questions :: (x: s32, y: s32, width: s32) {
|
||||
question := questions[index]
|
||||
before := question
|
||||
card_height := QuestionCardHeight(index)
|
||||
unused Box(edit.session, BoxProps.{.bounds = Bounds(x, y, width, card_height),
|
||||
unused Box.Draw(edit.session, Box.Props.{.bounds = Bounds(x, y, width, card_height),
|
||||
.fill = edit.card_fill, .border = edit.card_border,
|
||||
.radius = cast(float32)Scale(12)})
|
||||
card_bottom := y + card_height
|
||||
@@ -1466,7 +1454,7 @@ Questions :: (x: s32, y: s32, width: s32) {
|
||||
Ask(HABITS_EDIT_REMOVE_QUESTION, index)
|
||||
}
|
||||
RowLabel(Locale("habit_answer_as"), inner_x, y + Scale(48), inner_width - type_width - Scale(8))
|
||||
chosen := Dropdown(edit.session, DropdownProps.{.id = 7750 + index,
|
||||
chosen := Dropdown.Draw(edit.session, Dropdown.Props.{.id = 7750 + index,
|
||||
.bounds = Bounds(inner_x + inner_width - type_width, y + Scale(52), type_width,
|
||||
Scale(44)),
|
||||
.selected_index = question.answer_type - 1}, types[:])
|
||||
@@ -1494,7 +1482,7 @@ Questions :: (x: s32, y: s32, width: s32) {
|
||||
}
|
||||
y = card_bottom + Scale(EDIT_QUESTION_GAP)
|
||||
}
|
||||
if Button(edit.session, ButtonProps.{.id = 7760, .bounds = Bounds(x, y, width, Scale(44)),
|
||||
if Button.Draw(edit.session, Button.Props.{.id = 7760, .bounds = Bounds(x, y, width, Scale(44)),
|
||||
.label = Filled("+ %s", 0, Locale("habit_question_add")),
|
||||
.disabled = edit.question_count >= HABIT_QUESTION_MAX,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
@@ -1559,7 +1547,7 @@ Tracking :: (x: s32, y: s32, width: s32) {
|
||||
linked += 1
|
||||
}
|
||||
}
|
||||
if Button(edit.session, ButtonProps.{.id = 7630, .bounds = Bounds(x, y, width, Scale(44)),
|
||||
if Button.Draw(edit.session, Button.Props.{.id = 7630, .bounds = Bounds(x, y, width, Scale(44)),
|
||||
.label = Filled("%s · %d", linked, Locale("habit_link_practices")),
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
@@ -1611,8 +1599,8 @@ ContentHeight :: (width: s32) -> s32 {
|
||||
Form :: () {
|
||||
top := Scale(56)
|
||||
footer := Scale(ifx edit.name_error != 0 then 92 else 64)
|
||||
options: [1]DropdownOption
|
||||
title := TitleBar(edit.session, TitleBarProps.{
|
||||
options: [1]Dropdown.Option
|
||||
title := TitleBar.Draw(edit.session, TitleBar.Props.{
|
||||
.title = Locale(ifx edit.is_new then "habit_new_title" else "habit_edit_title"),
|
||||
.height = top, .strong_title = true, .bounds = Bounds(0, 0, edit.view_width, top),
|
||||
.has_leading_action = true, .leading_label = Locale("back_button")}, options[0:0])
|
||||
@@ -1635,7 +1623,7 @@ Form :: () {
|
||||
form_top = top
|
||||
form_height = viewport_height
|
||||
form_content = content_height
|
||||
scrolled := Scroll(edit.session, ScrollProps.{.key = KeyHash("habit/edit/scroll"),
|
||||
scrolled := Scroll.Draw(edit.session, Scroll.Props.{.key = Layout.KeyHash("habit/edit/scroll"),
|
||||
.bounds = Bounds(0, top, edit.view_width, viewport_height),
|
||||
.content_height = content_height, .scroll_offset = edit.scroll})
|
||||
edit.scroll = scrolled.scroll_offset
|
||||
@@ -1646,10 +1634,10 @@ Form :: () {
|
||||
for section: cast(s32)0..2 {
|
||||
body_width := width - Scale(24)
|
||||
body_height := SectionBody(section, body_width)
|
||||
Text(edit.session, TextProps.{.bounds = Bounds(x + Scale(4), y, width - Scale(4), Scale(26)),
|
||||
.text = titles[section], .font = edit.font, .wrap = cast(TextWrap)TextWrapNone,
|
||||
Text.Draw(edit.session, Text.Props.{.bounds = Bounds(x + Scale(4), y, width - Scale(4), Scale(26)),
|
||||
.text = titles[section], .size = edit.font, .wrap = cast(Text.Wrap)TextWrapNone,
|
||||
.semantic_kind = cast(SemanticKind)SemanticHeading, .heading_level = 2})
|
||||
Fieldset(edit.session, FieldsetProps.{.bounds = Bounds(x, y + Scale(30), width,
|
||||
Fieldset.Draw(edit.session, Fieldset.Props.{.bounds = Bounds(x, y + Scale(30), width,
|
||||
body_height + Scale(24))})
|
||||
body_x := x + Scale(12)
|
||||
body_y := y + Scale(42)
|
||||
@@ -1665,12 +1653,12 @@ Form :: () {
|
||||
unused End(edit.session)
|
||||
}
|
||||
// The footer keeps Save and Delete apart from the scrolling form.
|
||||
unused Box(edit.session, BoxProps.{.bounds = Bounds(0, edit.view_height - footer,
|
||||
unused Box.Draw(edit.session, Box.Props.{.bounds = Bounds(0, edit.view_height - footer,
|
||||
edit.view_width, footer),
|
||||
.fill = edit.canvas_color})
|
||||
rule := edit.text_color
|
||||
rule.a = cast(u8)(255.0 * 0.12)
|
||||
unused Box(edit.session, BoxProps.{.bounds = Bounds(0, edit.view_height - footer,
|
||||
unused Box.Draw(edit.session, Box.Props.{.bounds = Bounds(0, edit.view_height - footer,
|
||||
edit.view_width, Scale(1)),
|
||||
.fill = rule})
|
||||
if edit.name_error != 0 {
|
||||
@@ -1681,7 +1669,7 @@ Form :: () {
|
||||
action_width := width
|
||||
if !edit.is_new {
|
||||
delete_width := Scale(104)
|
||||
if Button(edit.session, ButtonProps.{.id = 7650,
|
||||
if Button.Draw(edit.session, Button.Props.{.id = 7650,
|
||||
.bounds = Bounds(x, edit.view_height - Scale(54), delete_width, Scale(44)),
|
||||
.label = Locale("habit_delete_button"), .tone = cast(ButtonTone)ButtonToneDanger,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
@@ -1690,7 +1678,7 @@ Form :: () {
|
||||
action_x += delete_width + Scale(8)
|
||||
action_width -= delete_width + Scale(8)
|
||||
}
|
||||
if Button(edit.session, ButtonProps.{.id = 7651,
|
||||
if Button.Draw(edit.session, Button.Props.{.id = 7651,
|
||||
.bounds = Bounds(action_x, edit.view_height - Scale(54), action_width, Scale(44)),
|
||||
.label = Locale(ifx edit.is_new then "habit_create_button" else "save_button"),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent,
|
||||
@@ -1706,7 +1694,7 @@ PracticePicker :: () {
|
||||
if width > Scale(400) {
|
||||
width = Scale(400)
|
||||
}
|
||||
frame := ModalFrame(edit.session, ModalFrameProps.{.key = KeyHash("habit/edit/practices"),
|
||||
frame := Modal.Draw(edit.session, Modal.Props.{.key = Layout.KeyHash("habit/edit/practices"),
|
||||
.title = Locale("habit_link_practices"), .width = width,
|
||||
.height = Scale(160 + edit.practice_count * 42), .scale = edit.scale})
|
||||
if frame.dismissed {
|
||||
@@ -1721,15 +1709,15 @@ PracticePicker :: () {
|
||||
y := cast(s32)content.y
|
||||
width = cast(s32)content.width
|
||||
hint := Locale("habit_link_practices_hint")
|
||||
hint_height := TextHeight(edit.session, TextProps.{.text = hint, .font = edit.font,
|
||||
.bounds = Bounds(0, 0, width, 0), .wrap = cast(TextWrap)TextWrapAuto})
|
||||
hint_height := TextHeight(edit.session, Text.Props.{.text = hint, .size = edit.font,
|
||||
.bounds = Bounds(0, 0, width, 0), .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
Label(hint, x, y, width, hint_height)
|
||||
y += hint_height + Scale(8)
|
||||
choices_height := cast(s32)(content.y + content.height) - y - Scale(52)
|
||||
if choices_height < Scale(40) {
|
||||
choices_height = Scale(40)
|
||||
}
|
||||
choices := Scroll(edit.session, ScrollProps.{.key = KeyHash("habit/edit/practice-list"),
|
||||
choices := Scroll.Draw(edit.session, Scroll.Props.{.key = Layout.KeyHash("habit/edit/practice-list"),
|
||||
.bounds = Bounds(x, y, width, choices_height), .scale = edit.scale,
|
||||
.content_height = edit.practice_count * Scale(42), .scroll_offset = practice_scroll})
|
||||
practice_scroll = choices.scroll_offset
|
||||
@@ -1737,21 +1725,19 @@ PracticePicker :: () {
|
||||
y = cast(s32)choices.content.y
|
||||
for index: cast(s32)0..edit.practice_count - 1 {
|
||||
practice := ReadHabitsEditPracticeHost(index)
|
||||
checkbox := Checkbox(edit.session, CheckboxProps.{.id = 9120 + index,
|
||||
checkbox := Checkbox.Draw(edit.session, Checkbox.Props.{.id = 9120 + index,
|
||||
.bounds = Bounds(x, y, cast(s32)choices.content.width, Scale(38)),
|
||||
.label = practice.label, .checked = (edit.sync_activity & practice.mask) != 0})
|
||||
.label = practice.label, .checked = (edit.sync_activity & practice.mask) != 0,
|
||||
.disabled = (edit.sync_activity & HABIT_LINK_DIARY) != 0 &&
|
||||
practice.mask != HABIT_LINK_DIARY})
|
||||
if checkbox.changed {
|
||||
if checkbox.checked {
|
||||
edit.sync_activity |= practice.mask
|
||||
} else {
|
||||
edit.sync_activity &= ~practice.mask
|
||||
}
|
||||
edit.sync_activity = HabitLinkSelect(edit.sync_activity, practice.mask, checkbox.checked)
|
||||
}
|
||||
y += Scale(42)
|
||||
}
|
||||
unused End(edit.session)
|
||||
}
|
||||
if Button(edit.session, ButtonProps.{
|
||||
if Button.Draw(edit.session, Button.Props.{
|
||||
.id = 9160,
|
||||
.bounds = Rectangle.{cast(float32)x, content.y + content.height - cast(float32)Scale(44),
|
||||
cast(float32)width, cast(float32)Scale(40)},
|
||||
|
||||
+182
-156
@@ -6,42 +6,38 @@
|
||||
// below the table. A habit's page lists its days, or shows them on a
|
||||
// calendar. The host keeps the habits and their days and does what the
|
||||
// page asks once it is drawn.
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Layout :: #import "kryon/layout";
|
||||
Press :: #import "kryon/press";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
SegmentedControl :: #import "kryon/segmented_control";
|
||||
SvgIcon :: #import "kryon/svg_icon";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/system_clipboard"
|
||||
#import "session"
|
||||
#import "geometry"
|
||||
#import "vec"
|
||||
#import "dpi"
|
||||
#import "layout"
|
||||
#import "drawing_props"
|
||||
#import "date_parse"
|
||||
#import "text_props"
|
||||
#import "text_align"
|
||||
#import "text_widget"
|
||||
#import "text_measure"
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "press_props"
|
||||
#import "press_widget"
|
||||
#import "pointer_input"
|
||||
#import "input_protocol"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "segmented_control_props"
|
||||
#import "segmented_control_widget"
|
||||
#import "svg_icon_props"
|
||||
#import "svg_icon_widget"
|
||||
#import "icon"
|
||||
#import "tree"
|
||||
#import "kryon/tree"
|
||||
#import, file "../../src/apps/habits_ui_types.zi";
|
||||
#import, file "../../src/apps/habits_types.zi";
|
||||
#import, file "../../src/habits/habit_types.zi";
|
||||
#import, file "../../src/habits/habit_icons.zi";
|
||||
#import, file "../../src/habits/habit_date.zi";
|
||||
#import, file "coin_color.zi";
|
||||
#import, file "table_layout.zi";
|
||||
CoinIcon :: #import "mingcute/mingcute_filled_copper_coin";
|
||||
ShopIcon :: #import "mingcute/mingcute_regular_shop";
|
||||
StatisticsIcon :: #import "mingcute/mingcute_regular_chart_line";
|
||||
|
||||
using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
@@ -49,7 +45,7 @@ using ButtonState;
|
||||
using ContentAlignment;
|
||||
using IconType;
|
||||
using TextAlign;
|
||||
using TextWrap;
|
||||
using Text.Wrap;
|
||||
host_api :: #system_library "host_api";
|
||||
ReadHabitsListHost :: () -> HabitsListFrame #foreign host_api;
|
||||
WriteHabitsListHost :: (frame: HabitsListFrame) #foreign host_api;
|
||||
@@ -123,7 +119,7 @@ Locale :: (key: string) -> string {
|
||||
|
||||
// The width a line of text takes in the host's fonts.
|
||||
Width :: (text: string, font: s32) -> s32 {
|
||||
return TextWidth(list.session, TextProps.{.text = text, .font = font})
|
||||
return TextWidth(list.session, Text.Props.{.text = text, .size = font})
|
||||
}
|
||||
|
||||
Number :: (value: s64) -> string {
|
||||
@@ -170,15 +166,15 @@ Coins :: (halves: s64) -> string {
|
||||
|
||||
// The title as large as it fits.
|
||||
TitleFont :: (title: string, max_width: s32) -> s32 {
|
||||
large := Scale(Text24)
|
||||
large := Scale(Text.Text24)
|
||||
if max_width <= 0 || Width(title, large) <= max_width {
|
||||
return large
|
||||
}
|
||||
medium := Scale(Text16)
|
||||
medium := Scale(Text.Text16)
|
||||
if Width(title, medium) <= max_width {
|
||||
return medium
|
||||
}
|
||||
return Scale(Text14)
|
||||
return Scale(Text.Text14)
|
||||
}
|
||||
|
||||
// The largest font from preferred down to minimum that fits the width.
|
||||
@@ -230,7 +226,7 @@ OffDay :: (accent: Color) -> Color {
|
||||
}
|
||||
|
||||
Fill :: (bounds: Rectangle, radius: float32, color: Color) {
|
||||
unused Box(list.session, BoxProps.{.bounds = bounds, .fill = color, .radius = radius})
|
||||
unused Box.Draw(list.session, Box.Props.{.bounds = bounds, .fill = color, .radius = radius})
|
||||
}
|
||||
|
||||
Circle :: (x: s32, y: s32, radius: s32, color: Color) {
|
||||
@@ -251,9 +247,9 @@ Hairline :: () -> s32 {
|
||||
Outline :: (bounds: Rectangle) {
|
||||
radius := cast(float32)Scale(12)
|
||||
color := Alpha(list.text_color, 0.8)
|
||||
unused Box(list.session, BoxProps.{.bounds = bounds, .border = color, .radius = radius})
|
||||
unused Box.Draw(list.session, Box.Props.{.bounds = bounds, .border = color, .radius = radius})
|
||||
inset := cast(float32)Hairline()
|
||||
unused Box(list.session, BoxProps.{.bounds = Rectangle.{bounds.x + inset,
|
||||
unused Box.Draw(list.session, Box.Props.{.bounds = Rectangle.{bounds.x + inset,
|
||||
bounds.y + inset, bounds.width - inset * 2.0, bounds.height - inset * 2.0},
|
||||
.border = color, .radius = radius - inset})
|
||||
}
|
||||
@@ -350,7 +346,7 @@ FaceState :: (bounds: Rectangle, selected: bool) -> ButtonState {
|
||||
// A button's face with a press over it, which holds, drags and counts a
|
||||
// secondary click as well. Returns the press; its click also counts a
|
||||
// keyboard activation of the face.
|
||||
PressButton :: (face: ButtonProps, press: PressProps) -> PressResult {
|
||||
PressButton :: (face: Button.Props, press: Press.Props) -> Press.PressResult {
|
||||
face.key = cast(u64)(LIST_FACE_KEYS + press.id)
|
||||
face.id = 0
|
||||
face.disabled = face.disabled || list.modal_active
|
||||
@@ -360,13 +356,13 @@ PressButton :: (face: ButtonProps, press: PressProps) -> PressResult {
|
||||
if face.disabled {
|
||||
face.state = cast(ButtonState)ButtonStateAuto
|
||||
}
|
||||
activated := Button(list.session, face) != 0
|
||||
activated := Button.Draw(list.session, face) != 0
|
||||
press.key = cast(u64)press.id
|
||||
press.bounds = face.bounds
|
||||
press.label = face.label
|
||||
press.now = list.now
|
||||
press.disabled = press.disabled || face.disabled
|
||||
result := Press(list.session, press)
|
||||
result := Press.Draw(list.session, press)
|
||||
result.clicked = result.clicked || activated
|
||||
return result
|
||||
}
|
||||
@@ -374,17 +370,17 @@ PressButton :: (face: ButtonProps, press: PressProps) -> PressResult {
|
||||
// A coin and its amount, centred on the bounds' height from their left.
|
||||
CoinAmount :: (amount: string, bounds: Rectangle, font: s32) {
|
||||
size := cast(float32)font
|
||||
unused SvgIcon(list.session, SvgIconProps.{.bounds = Rectangle.{bounds.x,
|
||||
unused SvgIcon.Draw(list.session, SvgIcon.Props.{.bounds = Rectangle.{bounds.x,
|
||||
bounds.y + (bounds.height - size) * 0.5, size, size},
|
||||
.shape = CoinIcon.Shape, .color = Color.{.r = 226, .g = 168, .b = 48, .a = 255}})
|
||||
strong: [1]TextRange
|
||||
strong[0] = TextRange.{.start = 0, .end = cast(s32)amount.count}
|
||||
Text(list.session, TextProps.{
|
||||
.shape = CoinIcon.Shape, .color = HabitsCoinColor(list.highlight_color, list.text_color)})
|
||||
strong: [1]Text.Range
|
||||
strong[0] = Text.Range.{.start = 0, .end = cast(s32)amount.count}
|
||||
Text.Draw(list.session, Text.Props.{
|
||||
.bounds = Rectangle.{bounds.x + size + cast(float32)Scale(6), bounds.y,
|
||||
bounds.width - size - cast(float32)Scale(6), bounds.height},
|
||||
.text = amount, .font = font, .strong = strong[:],
|
||||
.text = amount, .size = font, .strong = strong[:],
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
}
|
||||
|
||||
// A figure on a card: its label muted above it and the figure strong, with
|
||||
@@ -393,24 +389,24 @@ FigureCard :: (bounds: Rectangle, label: string, value: string, accent: Color) {
|
||||
radius := cast(float32)Scale(LIST_CARD_RADIUS)
|
||||
bar := cast(float32)Scale(5)
|
||||
Fill(bounds, radius, accent)
|
||||
unused Box(list.session, BoxProps.{.bounds = Rectangle.{bounds.x + bar, bounds.y,
|
||||
unused Box.Draw(list.session, Box.Props.{.bounds = Rectangle.{bounds.x + bar, bounds.y,
|
||||
bounds.width - bar, bounds.height}, .fill = list.card_fill, .radius = radius})
|
||||
unused Box(list.session, BoxProps.{.bounds = bounds, .border = list.card_border,
|
||||
unused Box.Draw(list.session, Box.Props.{.bounds = bounds, .border = list.card_border,
|
||||
.radius = radius})
|
||||
pad := cast(float32)Scale(LIST_CARD_PADDING)
|
||||
inner := bounds.width - bar - pad * 2.0
|
||||
Text(list.session, TextProps.{
|
||||
Text.Draw(list.session, Text.Props.{
|
||||
.bounds = Rectangle.{bounds.x + bar + pad, bounds.y + cast(float32)Scale(10),
|
||||
inner, cast(float32)Scale(22)},
|
||||
.text = label, .font = list.small_font, .class_name = list.muted_class,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
strong: [1]TextRange
|
||||
strong[0] = TextRange.{.start = 0, .end = cast(s32)value.count}
|
||||
Text(list.session, TextProps.{
|
||||
.text = label, .size = list.small_font, .class_name = list.muted_class,
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
strong: [1]Text.Range
|
||||
strong[0] = Text.Range.{.start = 0, .end = cast(s32)value.count}
|
||||
Text.Draw(list.session, Text.Props.{
|
||||
.bounds = Rectangle.{bounds.x + bar + pad, bounds.y + cast(float32)Scale(34),
|
||||
inner, cast(float32)Scale(32)},
|
||||
.text = value, .font = FitFont(value, cast(s32)inner, Scale(Text24), Scale(Text16)),
|
||||
.strong = strong[:], .wrap = cast(TextWrap)TextWrapNone})
|
||||
.text = value, .size = FitFont(value, cast(s32)inner, Scale(Text.Text24), Scale(Text.Text16)),
|
||||
.strong = strong[:], .wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
|
||||
// ---- Habits and days --------------------------------------------------------
|
||||
@@ -482,16 +478,16 @@ HabitIcon :: (index: s32, bounds: Rectangle) {
|
||||
shape := HabitIconShape(row.icon)
|
||||
if row.icon >= 1 && shape.count > 0 {
|
||||
inset := bounds.width * 0.22
|
||||
unused SvgIcon(list.session, SvgIconProps.{.bounds = Rectangle.{bounds.x + inset,
|
||||
unused SvgIcon.Draw(list.session, SvgIcon.Props.{.bounds = Rectangle.{bounds.x + inset,
|
||||
bounds.y + inset, bounds.width - inset * 2.0, bounds.height - inset * 2.0},
|
||||
.shape = shape, .color = TextOn(row.color)})
|
||||
return
|
||||
}
|
||||
Text(list.session, TextProps.{.bounds = bounds, .text = FirstLetter(row.name),
|
||||
.font = list.font, .class_name = InkClass(row.color),
|
||||
Text.Draw(list.session, Text.Props.{.bounds = bounds, .text = FirstLetter(row.name),
|
||||
.size = list.font, .class_name = InkClass(row.color),
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
|
||||
// A day's dot: filled once the day is complete, showing the day's count
|
||||
@@ -505,8 +501,8 @@ DayDot :: (center_x: s32, center_y: s32, radius: s32, accent: Color,
|
||||
Circle(center_x, center_y, radius - Scale(1), accent)
|
||||
if !show_count {
|
||||
reach := radius - Scale(4)
|
||||
unused SvgIcon(list.session, SvgIconProps.{.bounds = Bounds(center_x - reach,
|
||||
center_y - reach, reach * 2, reach * 2),
|
||||
unused SvgIcon.Draw(list.session, SvgIcon.Props.{.bounds = Bounds(center_x - reach,
|
||||
center_y - reach, reach * 2, reach * 2),
|
||||
.shape = LIST_CHECK_SHAPE, .color = TextOn(accent)})
|
||||
}
|
||||
} else {
|
||||
@@ -514,21 +510,21 @@ DayDot :: (center_x: s32, center_y: s32, radius: s32, accent: Color,
|
||||
Circle(center_x, center_y, radius - Scale(1), list.surface_color)
|
||||
if half {
|
||||
face := radius - Scale(1)
|
||||
unused SvgIcon(list.session, SvgIconProps.{.bounds = Bounds(center_x - face,
|
||||
center_y - face, face * 2, face * 2),
|
||||
unused SvgIcon.Draw(list.session, SvgIcon.Props.{.bounds = Bounds(center_x - face,
|
||||
center_y - face, face * 2, face * 2),
|
||||
.shape = LIST_HALF_DOT_SHAPE, .color = accent})
|
||||
}
|
||||
}
|
||||
if show_count {
|
||||
count_text := Number(cast(s64)count)
|
||||
Text(list.session, TextProps.{.bounds = Bounds(center_x - radius, center_y - radius,
|
||||
radius * 2, radius * 2),
|
||||
Text.Draw(list.session, Text.Props.{.bounds = Bounds(center_x - radius, center_y - radius,
|
||||
radius * 2, radius * 2),
|
||||
.text = count_text,
|
||||
.font = FitFont(count_text, radius * 2 - Scale(2), radius + Scale(4), Scale(8)),
|
||||
.size = FitFont(count_text, radius * 2 - Scale(2), radius + Scale(4), Scale(8)),
|
||||
.class_name = ifx complete then InkClass(accent) else 0,
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,7 +539,7 @@ DayCell :: (index: s32, first_active: bool, day: s32, column: s32, bounds: Recta
|
||||
state := Day(index, day)
|
||||
shown := state.planned || state.complete || state.count > 0 || state.running
|
||||
id := 5200000 + index * 16 + column
|
||||
press := Press(list.session, PressProps.{.key = cast(u64)id, .id = id, .bounds = bounds,
|
||||
press := Press.Draw(list.session, Press.Props.{.key = cast(u64)id, .id = id, .bounds = bounds,
|
||||
.now = list.now, .disabled = list.modal_active || !shown})
|
||||
if first_active && column == 0 {
|
||||
list.first_day = bounds
|
||||
@@ -576,13 +572,13 @@ DayCell :: (index: s32, first_active: bool, day: s32, column: s32, bounds: Recta
|
||||
TableHeader :: (x: s32, y: s32, layout: HabitTableLayout, height: s32) {
|
||||
for column: cast(s32)0..layout.days - 1 {
|
||||
label := WeekdayLabel(DayAgo(column), column)
|
||||
Text(list.session, TextProps.{
|
||||
Text.Draw(list.session, Text.Props.{
|
||||
.bounds = Bounds(x + column * layout.day_width, y, layout.day_width, height),
|
||||
.text = label,
|
||||
.font = FitFont(label, layout.day_width - Scale(4), list.small_font, Scale(10)),
|
||||
.size = FitFont(label, layout.day_width - Scale(4), list.small_font, Scale(10)),
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -591,12 +587,12 @@ TableHeader :: (x: s32, y: s32, layout: HabitTableLayout, height: s32) {
|
||||
// handle sits left of the border, so it never covers today's day name.
|
||||
NameResize :: (x: s32, y: s32, height: s32, name_width: s32) {
|
||||
handle_width := Scale(LIST_NAME_RESIZE_HANDLE_WIDTH)
|
||||
press := PressButton(ButtonProps.{
|
||||
press := PressButton(Button.Props.{
|
||||
.bounds = Bounds(x - handle_width - Scale(2), y, handle_width, height),
|
||||
.label = Locale("session_resize_button"), .icon_only = true,
|
||||
.icon_shape = LIST_RESIZE_SHAPE, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost},
|
||||
PressProps.{.id = 4100000, .capture = true})
|
||||
Press.Props.{.id = 4100000, .capture = true})
|
||||
unit := cast(float32)Scale(1)
|
||||
if unit <= 0.0 {
|
||||
unit = 1.0
|
||||
@@ -645,17 +641,17 @@ RowFace :: (index: s32, bounds: Rectangle, layout: HabitTableLayout, pad: s32) {
|
||||
if !layout.names {
|
||||
return
|
||||
}
|
||||
Text(list.session, TextProps.{
|
||||
Text.Draw(list.session, Text.Props.{
|
||||
.bounds = Bounds(cast(s32)bounds.x + pad + icon_size + Scale(10), cast(s32)bounds.y,
|
||||
layout.name_width - icon_size - Scale(14), cast(s32)bounds.height),
|
||||
.text = rows[index].name, .font = list.font,
|
||||
layout.name_width - icon_size - Scale(14), cast(s32)bounds.height),
|
||||
.text = rows[index].name, .size = list.font,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
}
|
||||
|
||||
// A mouse drags a habit row as soon as it moves. On a touch screen a swipe
|
||||
// over the rows scrolls them, so a row is lifted only once held.
|
||||
BeginDrag :: (index: s32, bounds: Rectangle, press: PressResult) {
|
||||
BeginDrag :: (index: s32, bounds: Rectangle, press: Press.PressResult) {
|
||||
list.dragging = true
|
||||
list.drag_habit = index
|
||||
list.drag_lifted = !list.touch
|
||||
@@ -687,7 +683,7 @@ Moved :: (point: Vector2) -> bool {
|
||||
// A press on a habit row that moves drags the row to another place in the
|
||||
// list; the list keeps scrolling with a swipe until a touch is held.
|
||||
// Returns true when the row was tapped without being dragged.
|
||||
RowDrag :: (index: s32, bounds: Rectangle, press: PressResult) -> bool {
|
||||
RowDrag :: (index: s32, bounds: Rectangle, press: Press.PressResult) -> bool {
|
||||
if press.down && !list.dragging && !list.modal_active && !list.name_resizing {
|
||||
BeginDrag(index, bounds, press)
|
||||
}
|
||||
@@ -726,10 +722,10 @@ Row :: (index: s32, first_active: bool, bounds: Rectangle, layout: HabitTableLay
|
||||
pad: s32, open: bool) -> bool {
|
||||
touch := RowTouch(bounds)
|
||||
lifted := list.dragging && list.drag_habit == index && list.drag_lifted
|
||||
press := PressButton(ButtonProps.{.bounds = touch,
|
||||
press := PressButton(Button.Props.{.bounds = touch,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost, .selected = open},
|
||||
PressProps.{.id = 4200 + index, .hold_seconds = LIST_CARD_HOLD_SECONDS,
|
||||
Press.Props.{.id = 4200 + index, .hold_seconds = LIST_CARD_HOLD_SECONDS,
|
||||
.capture = !list.touch || lifted})
|
||||
tapped := RowDrag(index, touch, press)
|
||||
RowFace(index, bounds, layout, pad)
|
||||
@@ -772,15 +768,15 @@ RowDetail :: (index: s32, first_active: bool, bounds: Rectangle, pad: s32) {
|
||||
x := panel_x + inner
|
||||
width := panel_width - inner * 2
|
||||
y := panel_y + inner
|
||||
Text(list.session, TextProps.{.bounds = Bounds(x, y, width, Scale(LIST_DETAIL_TITLE_HEIGHT)),
|
||||
.text = row.name, .font = list.font,
|
||||
Text.Draw(list.session, Text.Props.{.bounds = Bounds(x, y, width, Scale(LIST_DETAIL_TITLE_HEIGHT)),
|
||||
.text = row.name, .size = list.font,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
y += Scale(LIST_DETAIL_TITLE_HEIGHT + LIST_DETAIL_TITLE_GAP)
|
||||
if row.description.count > 0 {
|
||||
Text(list.session, TextProps.{.bounds = Bounds(x, y, width, Scale(22)),
|
||||
.text = row.description, .font = list.small_font,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
Text.Draw(list.session, Text.Props.{.bounds = Bounds(x, y, width, Scale(22)),
|
||||
.text = row.description, .size = list.small_font,
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
y += Scale(30)
|
||||
}
|
||||
action_size := Scale(LIST_DETAIL_ACTION_SIZE)
|
||||
@@ -790,7 +786,7 @@ RowDetail :: (index: s32, first_active: bool, bounds: Rectangle, pad: s32) {
|
||||
for column: cast(s32)0..2 {
|
||||
action_bounds := Bounds(x + column * (action_size + action_gap), y,
|
||||
action_size, action_size)
|
||||
if Button(list.session, ButtonProps.{.id = 5600000 + index * 3 + column,
|
||||
if Button.Draw(list.session, Button.Props.{.id = 5600000 + index * 3 + column,
|
||||
.bounds = action_bounds, .icon_type = icons[column], .icon_only = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisOutline,
|
||||
@@ -863,12 +859,12 @@ DragFace :: (index: s32, bounds: Rectangle) {
|
||||
HabitIcon(index, Bounds(cast(s32)bounds.x + Scale(12),
|
||||
cast(s32)(bounds.y + (bounds.height - cast(float32)icon_size) * 0.5),
|
||||
icon_size, icon_size))
|
||||
Text(list.session, TextProps.{
|
||||
Text.Draw(list.session, Text.Props.{
|
||||
.bounds = Bounds(cast(s32)bounds.x + Scale(54), cast(s32)bounds.y,
|
||||
cast(s32)bounds.width - Scale(104), cast(s32)bounds.height),
|
||||
.text = rows[index].name, .font = list.font,
|
||||
cast(s32)bounds.width - Scale(104), cast(s32)bounds.height),
|
||||
.text = rows[index].name, .size = list.font,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
Grip(bounds)
|
||||
}
|
||||
|
||||
@@ -877,10 +873,10 @@ DragFace :: (index: s32, bounds: Rectangle) {
|
||||
DeactivatedRow :: (index: s32, bounds: Rectangle) {
|
||||
touch := RowTouch(bounds)
|
||||
lifted := list.dragging && list.drag_habit == index && list.drag_lifted
|
||||
press := PressButton(ButtonProps.{.bounds = touch,
|
||||
press := PressButton(Button.Props.{.bounds = touch,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost},
|
||||
PressProps.{.id = 4900 + index, .hold_seconds = LIST_CARD_HOLD_SECONDS,
|
||||
Press.Props.{.id = 4900 + index, .hold_seconds = LIST_CARD_HOLD_SECONDS,
|
||||
.capture = !list.touch || lifted})
|
||||
unused RowDrag(index, touch, press)
|
||||
DragFace(index, bounds)
|
||||
@@ -890,7 +886,7 @@ DeactivatedRow :: (index: s32, bounds: Rectangle) {
|
||||
// chevron. A tap shows or hides their rows below it.
|
||||
InactiveHeader :: (bounds: Rectangle, count: s32, pad: s32) {
|
||||
open := list.show_deactivated
|
||||
if Button(list.session, ButtonProps.{.id = 4110, .bounds = RowTouch(bounds),
|
||||
if Button.Draw(list.session, Button.Props.{.id = 4110, .bounds = RowTouch(bounds),
|
||||
.label = Filled(Locale("habits_inactive_section"), count, 0),
|
||||
.content_alignment = cast(ContentAlignment)ContentAlignmentStart,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
@@ -904,8 +900,8 @@ InactiveHeader :: (bounds: Rectangle, count: s32, pad: s32) {
|
||||
center_x := cast(s32)(bounds.x + bounds.width) - pad - Scale(12)
|
||||
center_y := cast(s32)(bounds.y + bounds.height * 0.5)
|
||||
shape := ifx open then "S2.4rr:M0 18L12 6L24 18" else "S2.4rr:M0 6L12 18L24 6"
|
||||
unused SvgIcon(list.session, SvgIconProps.{.bounds = Bounds(center_x - span, center_y - span,
|
||||
span * 2, span * 2),
|
||||
unused SvgIcon.Draw(list.session, SvgIcon.Props.{.bounds = Bounds(center_x - span, center_y - span,
|
||||
span * 2, span * 2),
|
||||
.shape = shape, .color = Alpha(list.text_color, 0.7)})
|
||||
}
|
||||
|
||||
@@ -1054,13 +1050,13 @@ Overview :: () {
|
||||
add_width = width * 2 / 3
|
||||
}
|
||||
heading := Locale("tab_habits")
|
||||
heading_strong: [1]TextRange
|
||||
heading_strong[0] = TextRange.{.start = 0, .end = cast(s32)heading.count}
|
||||
heading_strong: [1]Text.Range
|
||||
heading_strong[0] = Text.Range.{.start = 0, .end = cast(s32)heading.count}
|
||||
heading_width := width - add_width - gap
|
||||
Text(list.session, TextProps.{.bounds = Bounds(x, y, heading_width, heading_height),
|
||||
.text = heading, .font = TitleFont(heading, heading_width),
|
||||
.strong = heading_strong[:], .wrap = cast(TextWrap)TextWrapNone})
|
||||
if Button(list.session, ButtonProps.{.id = 4100,
|
||||
Text.Draw(list.session, Text.Props.{.bounds = Bounds(x, y, heading_width, heading_height),
|
||||
.text = heading, .size = TitleFont(heading, heading_width),
|
||||
.strong = heading_strong[:], .wrap = cast(Text.Wrap)TextWrapNone})
|
||||
if Button.Draw(list.session, Button.Props.{.id = 4100,
|
||||
.bounds = Bounds(x + width - add_width, y, add_width, button_height),
|
||||
.label = add_label, .tone = cast(ButtonTone)ButtonToneAccent,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled, .pill = true,
|
||||
@@ -1069,31 +1065,31 @@ Overview :: () {
|
||||
return
|
||||
}
|
||||
summary_y := y + heading_height + gap
|
||||
progress_y := summary_y + Scale(28)
|
||||
progress_height := Scale(6)
|
||||
// The coins to spend and the shop's mark end today's count, both the
|
||||
// size of its text, centred on the count and its progress bar together;
|
||||
// a tap on either opens the shop.
|
||||
icon := list.font
|
||||
coins := Coins(list.halves)
|
||||
coins_width := list.font + Scale(6) + Width(coins, list.font)
|
||||
cluster_width := coins_width + Scale(12) + icon
|
||||
cluster_x := x + width - cluster_width
|
||||
cluster_height := Scale(32)
|
||||
cluster_y := summary_y + (progress_y + progress_height - summary_y - cluster_height) / 2
|
||||
if Button(list.session, ButtonProps.{.id = 4120,
|
||||
.bounds = Bounds(cluster_x - Scale(6), cluster_y, cluster_width + Scale(6),
|
||||
cluster_height),
|
||||
.label = Locale("habits_shop_button"), .invisible = true,
|
||||
.disabled = list.modal_active}) != 0 {
|
||||
Ask(HABITS_LIST_SHOP, -1, 0)
|
||||
return
|
||||
minimum_action_size: s32 = 44
|
||||
action_size := Scale(minimum_action_size)
|
||||
action_gap := Scale(8)
|
||||
coin_padding := Scale(6)
|
||||
coin_gap := Scale(10)
|
||||
wide_actions_width := coins_width + coin_padding + coin_gap + action_gap + 2 * minimum_action_size
|
||||
if action_size < minimum_action_size && width >= wide_actions_width {
|
||||
action_size = minimum_action_size
|
||||
}
|
||||
CoinAmount(coins, Bounds(cluster_x, cluster_y, coins_width, cluster_height), list.font)
|
||||
unused SvgIcon(list.session, SvgIconProps.{.bounds = Bounds(cluster_x + cluster_width - icon,
|
||||
cluster_y + (cluster_height - icon) / 2, icon, icon),
|
||||
.shape = ShopIcon.Shape, .color = list.text_color})
|
||||
list.anchor_coins = Bounds(cluster_x, cluster_y, cluster_width, cluster_height)
|
||||
icon_size := Scale(20)
|
||||
icon_inset := (action_size - icon_size) / 2
|
||||
statistics_x := x + width - action_size
|
||||
shop_right := statistics_x - action_gap
|
||||
shop_icon_x := shop_right - action_size + icon_inset
|
||||
shop_x := shop_icon_x - coins_width - coin_gap - coin_padding
|
||||
if shop_x < x {
|
||||
shop_x = x
|
||||
coin_padding = 0
|
||||
coins_width = shop_icon_x - x - Scale(5)
|
||||
}
|
||||
// Keep the coin balance and storefront in the same tap target.
|
||||
action_y := summary_y + (Scale(34) - action_size) / 2
|
||||
summary_width := shop_x - x - gap
|
||||
due: s32 = 0
|
||||
done: s32 = 0
|
||||
for index: cast(s32)0..row_count - 1 {
|
||||
@@ -1104,10 +1100,40 @@ Overview :: () {
|
||||
}
|
||||
}
|
||||
}
|
||||
summary_width := cluster_x - x - Scale(12)
|
||||
Text(list.session, TextProps.{.bounds = Bounds(x, summary_y, summary_width, Scale(24)),
|
||||
.text = Filled(Locale("habits_done_count_label"), done, due),
|
||||
.font = list.font, .wrap = cast(TextWrap)TextWrapNone})
|
||||
summary := Filled(Locale("habits_done_count_label"), done, due)
|
||||
if summary_width < Width(summary, list.font) {
|
||||
action_y = summary_y
|
||||
summary_y += action_size + Scale(6)
|
||||
summary_width = width
|
||||
}
|
||||
shop_bounds := Bounds(shop_x, action_y, shop_right - shop_x, action_size)
|
||||
if Button.Draw(list.session, Button.Props.{.id = 4120,
|
||||
.bounds = shop_bounds,
|
||||
.label = Locale("habits_shop_button"), .invisible = true,
|
||||
.disabled = list.modal_active}) != 0 {
|
||||
Ask(HABITS_LIST_SHOP, -1, 0)
|
||||
return
|
||||
}
|
||||
if Button.Draw(list.session, Button.Props.{.id = 4121,
|
||||
.bounds = Bounds(statistics_x, action_y, action_size, action_size),
|
||||
.label = Locale("habit_statistics_title"), .icon_only = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost,
|
||||
.disabled = list.modal_active}) != 0 {
|
||||
Ask(HABITS_LIST_ALL_STATISTICS, -1, 0)
|
||||
return
|
||||
}
|
||||
CoinAmount(coins, Bounds(shop_x + coin_padding, action_y, coins_width, action_size), list.font)
|
||||
unused SvgIcon.Draw(list.session, SvgIcon.Props.{.bounds = Bounds(shop_icon_x,
|
||||
action_y + icon_inset, icon_size, icon_size),
|
||||
.shape = ShopIcon.Shape, .color = list.text_color})
|
||||
unused SvgIcon.Draw(list.session, SvgIcon.Props.{.bounds = Bounds(statistics_x + icon_inset,
|
||||
action_y + icon_inset, icon_size, icon_size),
|
||||
.shape = StatisticsIcon.Shape, .color = list.text_color})
|
||||
list.anchor_coins = shop_bounds
|
||||
progress_y := summary_y + Scale(28)
|
||||
progress_height := Scale(6)
|
||||
Text.Draw(list.session, Text.Props.{.bounds = Bounds(x, summary_y, summary_width, Scale(24)),
|
||||
.text = summary, .size = list.font, .wrap = cast(Text.Wrap)TextWrapNone})
|
||||
list.anchor_progress = Bounds(x, summary_y, summary_width, Scale(24))
|
||||
progress_width := summary_width
|
||||
if progress_width > Scale(420) {
|
||||
@@ -1175,8 +1201,8 @@ Overview :: () {
|
||||
if panel_rows_height > cast(s32)viewport.height {
|
||||
panel_rows_height = cast(s32)viewport.height
|
||||
}
|
||||
unused Box(list.session, BoxProps.{.bounds = Bounds(x, list_y, width,
|
||||
header_height + panel_rows_height),
|
||||
unused Box.Draw(list.session, Box.Props.{.bounds = Bounds(x, list_y, width,
|
||||
header_height + panel_rows_height),
|
||||
.fill = list.surface_color, .border = Alpha(list.text_color, 0.12),
|
||||
.radius = cast(float32)Scale(14)})
|
||||
// A habit that just opened scrolls into view: all of it when it fits,
|
||||
@@ -1202,7 +1228,7 @@ Overview :: () {
|
||||
}
|
||||
}
|
||||
}
|
||||
scrolled := Scroll(list.session, ScrollProps.{.key = KeyHash("inbe/habits/overview"),
|
||||
scrolled := Scroll.Draw(list.session, Scroll.Props.{.key = Layout.KeyHash("inbe/habits/overview"),
|
||||
.bounds = Bounds(x, rows_y, width, panel_rows_height),
|
||||
.content_height = content_height, .keep_scrollbar = keep_scrollbar,
|
||||
.scroll_offset = list.scroll})
|
||||
@@ -1227,10 +1253,10 @@ Overview :: () {
|
||||
Scale(LIST_NAME_MIN_WIDTH), Scale(LIST_ICON_COLUMN_WIDTH), Scale(LIST_DAY_MIN_WIDTH),
|
||||
Scale(LIST_DAY_MAX_WIDTH))
|
||||
if active_count == 0 {
|
||||
Text(list.session, TextProps.{.bounds = Bounds(table_x + pad,
|
||||
cast(s32)scrolled.content.y + Scale(10), table_width - pad * 2, Scale(48)),
|
||||
.text = Locale("habit_empty_title"), .font = list.font,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
Text.Draw(list.session, Text.Props.{.bounds = Bounds(table_x + pad,
|
||||
cast(s32)scrolled.content.y + Scale(10), table_width - pad * 2, Scale(48)),
|
||||
.text = Locale("habit_empty_title"), .size = list.font,
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
cards: [HABIT_MAX]Rectangle
|
||||
for position: cast(s32)0..active_count - 1 {
|
||||
@@ -1265,11 +1291,11 @@ Overview :: () {
|
||||
}
|
||||
if show_section && list.show_deactivated {
|
||||
row_y := cast(s32)section.y + Scale(LIST_INACTIVE_HEADER_HEIGHT)
|
||||
Text(list.session, TextProps.{.bounds = Bounds(table_x + pad, row_y,
|
||||
table_width - pad * 2, Scale(LIST_DEACTIVATED_HINT_HEIGHT)),
|
||||
.text = Locale("habits_deactivated_hint"), .font = list.small_font,
|
||||
Text.Draw(list.session, Text.Props.{.bounds = Bounds(table_x + pad, row_y,
|
||||
table_width - pad * 2, Scale(LIST_DEACTIVATED_HINT_HEIGHT)),
|
||||
.text = Locale("habits_deactivated_hint"), .size = list.small_font,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapAuto})
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
row_y += Scale(LIST_DEACTIVATED_HINT_HEIGHT)
|
||||
for index: cast(s32)0..row_count - 1 {
|
||||
if rows[index].deactivated {
|
||||
@@ -1301,7 +1327,7 @@ PageHeader :: (x: s32, y: s32, width: s32, title: string) -> s32 {
|
||||
if back_width > width / 3 {
|
||||
back_width = width / 3
|
||||
}
|
||||
if Button(list.session, ButtonProps.{.id = 4300,
|
||||
if Button.Draw(list.session, Button.Props.{.id = 4300,
|
||||
.bounds = Bounds(x, y + Scale(2), back_width, Scale(42)),
|
||||
.label = back_label, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisOutline,
|
||||
@@ -1311,21 +1337,21 @@ PageHeader :: (x: s32, y: s32, width: s32, title: string) -> s32 {
|
||||
}
|
||||
title_x := x + back_width + Scale(16)
|
||||
title_width := width - back_width - Scale(16)
|
||||
strong: [1]TextRange
|
||||
strong[0] = TextRange.{.start = 0, .end = cast(s32)title.count}
|
||||
Text(list.session, TextProps.{.bounds = Bounds(title_x, y, title_width, Scale(46)),
|
||||
.text = title, .font = TitleFont(title, title_width), .strong = strong[:],
|
||||
strong: [1]Text.Range
|
||||
strong[0] = Text.Range.{.start = 0, .end = cast(s32)title.count}
|
||||
Text.Draw(list.session, Text.Props.{.bounds = Bounds(title_x, y, title_width, Scale(46)),
|
||||
.text = title, .size = TitleFont(title, title_width), .strong = strong[:],
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
return y + Scale(58)
|
||||
}
|
||||
|
||||
// The habit's page switches only between its week list and its calendar.
|
||||
ViewSwitch :: (x: s32, width: s32, top: s32) -> s32 {
|
||||
options: [2]SegmentOption = .[
|
||||
SegmentOption.{.label = Locale("habit_focus_week")},
|
||||
SegmentOption.{.label = Locale("habit_focus_calendar")}]
|
||||
switch := SegmentedControl(list.session, SegmentedControlProps.{.id = 4301,
|
||||
options: [2]SegmentedControl.SegmentOption = .[
|
||||
SegmentedControl.SegmentOption.{.label = Locale("habit_focus_week")},
|
||||
SegmentedControl.SegmentOption.{.label = Locale("habit_focus_calendar")}]
|
||||
switch := SegmentedControl.Draw(list.session, SegmentedControl.Props.{.id = 4301,
|
||||
.bounds = Bounds(x, top, width, Scale(42)), .height = Scale(42),
|
||||
.selected_index = ifx list.view_mode == HABIT_VIEW_CALENDAR then 1 else 0,
|
||||
.has_selection = true, .disabled = list.modal_active}, options[:])
|
||||
@@ -1351,7 +1377,7 @@ DayButton :: (index: s32, day: s32, label: string, id: s32, bounds: Rectangle, d
|
||||
disabled := list.modal_active || (!scheduled && !recorded)
|
||||
filled := complete && !dot
|
||||
faded_label := !scheduled && !filled
|
||||
face := ButtonProps.{.bounds = bounds,
|
||||
face := Button.Props.{.bounds = bounds,
|
||||
.label = ifx dot || faded_label then "" else label,
|
||||
.tone = cast(ButtonTone)(ifx filled then ButtonToneAccent else ButtonToneNeutral),
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft, .selected = filled,
|
||||
@@ -1366,20 +1392,20 @@ DayButton :: (index: s32, day: s32, label: string, id: s32, bounds: Rectangle, d
|
||||
face.tone = cast(ButtonTone)ButtonToneAccent
|
||||
face.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft
|
||||
}
|
||||
press := PressButton(face, PressProps.{.id = id})
|
||||
press := PressButton(face, Press.Props.{.id = id})
|
||||
if faded_label && !dot {
|
||||
Text(list.session, TextProps.{.bounds = bounds, .text = label,
|
||||
Text.Draw(list.session, Text.Props.{.bounds = bounds, .text = label,
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone, .disabled = true})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone, .disabled = true})
|
||||
}
|
||||
if dot {
|
||||
top := cast(s32)bounds.y + Scale(3)
|
||||
Text(list.session, TextProps.{.bounds = Bounds(cast(s32)bounds.x, top,
|
||||
cast(s32)bounds.width, Scale(18)),
|
||||
.text = label, .font = list.small_font, .align = cast(TextAlign)TextAlignCenter,
|
||||
Text.Draw(list.session, Text.Props.{.bounds = Bounds(cast(s32)bounds.x, top,
|
||||
cast(s32)bounds.width, Scale(18)),
|
||||
.text = label, .size = list.small_font, .align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone, .disabled = disabled || !scheduled})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone, .disabled = disabled || !scheduled})
|
||||
if state.count > 0 || complete {
|
||||
radius := Scale(12)
|
||||
accent := row.color
|
||||
@@ -1412,7 +1438,7 @@ Weekly :: (index: s32, x: s32, width: s32, top: s32, bottom: s32) {
|
||||
list.weekly_days = count
|
||||
content_height := count * (row_height + gap) + Scale(52)
|
||||
viewport := Bounds(x, top, width, bottom - top)
|
||||
scrolled := Scroll(list.session, ScrollProps.{.key = KeyHash("inbe/habits/week"),
|
||||
scrolled := Scroll.Draw(list.session, Scroll.Props.{.key = Layout.KeyHash("inbe/habits/week"),
|
||||
.bounds = viewport, .content_height = content_height,
|
||||
.scroll_offset = list.scroll})
|
||||
list.scroll = scrolled.scroll_offset
|
||||
@@ -1442,7 +1468,7 @@ Weekly :: (index: s32, x: s32, width: s32, top: s32, bottom: s32) {
|
||||
}
|
||||
if count < HABIT_WEEKLY_MAX_DAYS {
|
||||
button_y := cast(s32)scrolled.content.y + count * (row_height + gap)
|
||||
if Button(list.session, ButtonProps.{.id = 4500,
|
||||
if Button.Draw(list.session, Button.Props.{.id = 4500,
|
||||
.bounds = Bounds(x, button_y, width, Scale(42)),
|
||||
.label = Locale("habit_load_more_button"),
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
@@ -1475,13 +1501,13 @@ Calendar :: (index: s32, x: s32, width: s32, top: s32) {
|
||||
header_height := Scale(42)
|
||||
gap := Scale(6)
|
||||
arrow_width := Scale(48)
|
||||
if Button(list.session, ButtonProps.{.id = 4600, .bounds = Bounds(x, top, arrow_width,
|
||||
header_height), .label = "<", .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
if Button.Draw(list.session, Button.Props.{.id = 4600, .bounds = Bounds(x, top, arrow_width,
|
||||
header_height), .label = "<", .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft,
|
||||
.disabled = list.modal_active}) != 0 {
|
||||
list.month_offset -= 1
|
||||
}
|
||||
if Button(list.session, ButtonProps.{.id = 4601,
|
||||
if Button.Draw(list.session, Button.Props.{.id = 4601,
|
||||
.bounds = Bounds(x + width - arrow_width, top, arrow_width, header_height),
|
||||
.label = ">", .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft,
|
||||
@@ -1491,12 +1517,12 @@ Calendar :: (index: s32, x: s32, width: s32, top: s32) {
|
||||
month_keys: [12]string = .["habit_month_1", "habit_month_2", "habit_month_3",
|
||||
"habit_month_4", "habit_month_5", "habit_month_6", "habit_month_7", "habit_month_8",
|
||||
"habit_month_9", "habit_month_10", "habit_month_11", "habit_month_12"]
|
||||
Text(list.session, TextProps.{.bounds = Bounds(x + arrow_width + gap, top,
|
||||
width - (arrow_width + gap) * 2, header_height),
|
||||
.text = Filled(Locale(month_keys[month - 1]), year, 0), .font = list.font,
|
||||
Text.Draw(list.session, Text.Props.{.bounds = Bounds(x + arrow_width + gap, top,
|
||||
width - (arrow_width + gap) * 2, header_height),
|
||||
.text = Filled(Locale(month_keys[month - 1]), year, 0), .size = list.font,
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
weekday := Weekday(year * 10000 + month * 100 + 1)
|
||||
cell_width := (width - gap * 6) / 7
|
||||
counting := rows[index].counting
|
||||
|
||||
+308
-84
@@ -8,23 +8,18 @@
|
||||
#import "geometry"
|
||||
#import "vec"
|
||||
#import "dpi"
|
||||
#import "layout"
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Layout :: #import "kryon/layout";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
Shape :: #import "kryon/shape";
|
||||
Text :: #import "kryon/text";
|
||||
#import "drawing_props"
|
||||
#import "semantic"
|
||||
#import "text_props"
|
||||
#import "text_align"
|
||||
#import "text_widget"
|
||||
#import "text_measure"
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "tree"
|
||||
#import "shape_props"
|
||||
#import "shape_widget"
|
||||
#import "kryon/tree"
|
||||
#import "plot/band_chart"
|
||||
#import "plot/band_chart_props"
|
||||
#import, file "../../src/apps/habits_ui_types.zi";
|
||||
@@ -35,7 +30,7 @@ using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
using SemanticKind;
|
||||
using TextAlign;
|
||||
using TextWrap;
|
||||
using Text.Wrap;
|
||||
host_api :: #system_library "host_api";
|
||||
ReadHabitsStatsHost :: () -> HabitsStatsFrame #foreign host_api;
|
||||
WriteHabitsStatsHost :: (frame: HabitsStatsFrame) #foreign host_api;
|
||||
@@ -64,6 +59,11 @@ STATS_HOLD_MAX :: 256
|
||||
STATS_HOLD_DAYS_MAX :: 31
|
||||
STATS_BACK_SHAPE :: "S1.8rr:M15 5L8 12L15 19"
|
||||
STATS_MINUTES_PER_DAY :: 1440
|
||||
STATS_TREND_HEIGHT :: 200
|
||||
STATS_TREND_LEGEND_HEIGHT :: 44
|
||||
trend_selected_habit: s32;
|
||||
trend_selected_chart: s32 = -1;
|
||||
trend_selected_slot: s32 = 29;
|
||||
|
||||
Scale :: (pixels: s32) -> s32 {
|
||||
return ScalePixels(pixels, stats.scale)
|
||||
@@ -79,7 +79,7 @@ Locale :: (key: string) -> string {
|
||||
}
|
||||
|
||||
Width :: (text: string, font: s32) -> s32 {
|
||||
return TextWidth(stats.session, TextProps.{.text = text, .font = font})
|
||||
return TextWidth(stats.session, Text.Props.{.text = text, .size = font})
|
||||
}
|
||||
|
||||
Alpha :: (color: Color, opacity: float32) -> Color {
|
||||
@@ -87,9 +87,9 @@ Alpha :: (color: Color, opacity: float32) -> Color {
|
||||
return color
|
||||
}
|
||||
|
||||
Strong :: (text: string) -> [1]TextRange {
|
||||
ranges: [1]TextRange
|
||||
ranges[0] = TextRange.{.start = 0, .end = cast(s32)text.count}
|
||||
Strong :: (text: string) -> [1]Text.Range {
|
||||
ranges: [1]Text.Range
|
||||
ranges[0] = Text.Range.{.start = 0, .end = cast(s32)text.count}
|
||||
return ranges
|
||||
}
|
||||
|
||||
@@ -192,21 +192,225 @@ DayCountText :: (count: s32) -> string {
|
||||
}
|
||||
|
||||
Card :: (x: s32, y: s32, width: s32, height: s32) {
|
||||
unused Box(stats.session, BoxProps.{.bounds = Bounds(x, y, width, height),
|
||||
unused Box.Draw(stats.session, Box.Props.{.bounds = Bounds(x, y, width, height),
|
||||
.fill = stats.card_fill, .border = stats.card_border,
|
||||
.radius = cast(float32)Scale(STATS_CARD_RADIUS)})
|
||||
}
|
||||
|
||||
Fill :: (bounds: Rectangle, radius: float32, color: Color) {
|
||||
unused Box(stats.session, BoxProps.{.bounds = bounds, .fill = color, .radius = radius})
|
||||
unused Box.Draw(stats.session, Box.Props.{.bounds = bounds, .fill = color, .radius = radius})
|
||||
}
|
||||
|
||||
// A line of a chart, from one end to the other, one pixel wide.
|
||||
ChartLine :: (x1: s32, y1: s32, x2: s32, y2: s32, color: Color) {
|
||||
unused Line(stats.session, LineProps.{.start = Vector2.{cast(float32)x1, cast(float32)y1},
|
||||
unused Shape.Draw(stats.session, Shape.Props.{.start = Vector2.{cast(float32)x1, cast(float32)y1},
|
||||
.end = Vector2.{cast(float32)x2, cast(float32)y2}, .color = color})
|
||||
}
|
||||
|
||||
TrendDate :: (label: string) -> string {
|
||||
if label.count < 8 {
|
||||
return label
|
||||
}
|
||||
out: Vec(u8)
|
||||
BuilderPrint(*out, "%-%-%", label[0:4], label[4:6], label[6:8])
|
||||
return BuilderFinish(out)
|
||||
}
|
||||
|
||||
// A daily completion series, oldest to newest, with zero days retained.
|
||||
// The same chart draws one habit and the whole collection.
|
||||
CompletionTrend :: (chart_index: s32, x: s32, y: s32, width: s32) {
|
||||
chart := ReadHabitsStatsChartHost(chart_index)
|
||||
height := Scale(STATS_TREND_HEIGHT)
|
||||
Card(x, y, width, height)
|
||||
left := x + Scale(32)
|
||||
right := x + width - Scale(14)
|
||||
top := y + Scale(18)
|
||||
bottom := y + height - Scale(52)
|
||||
highest := chart.highest
|
||||
if highest < 1 {
|
||||
highest = 1
|
||||
}
|
||||
for grid: cast(s32)0..2 {
|
||||
grid_y := top + (bottom - top) * grid / 2
|
||||
ChartLine(left, grid_y, right, grid_y, Alpha(stats.text_color, 0.12))
|
||||
}
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(x + Scale(4), top - Scale(8),
|
||||
Scale(24), Scale(18)), .text = Number(cast(s64)highest),
|
||||
.size = stats.small_font, .class_name = stats.muted_class,
|
||||
.align = cast(TextAlign)TextAlignEnd})
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(x + Scale(4), bottom - Scale(8),
|
||||
Scale(24), Scale(18)), .text = "0", .size = stats.small_font,
|
||||
.class_name = stats.muted_class, .align = cast(TextAlign)TextAlignEnd})
|
||||
count := chart.point_count
|
||||
if count > STATS_DAYS {
|
||||
count = STATS_DAYS
|
||||
}
|
||||
previous_x := left
|
||||
previous_y := bottom
|
||||
selected: HabitsStatsPoint
|
||||
first: HabitsStatsPoint
|
||||
last: HabitsStatsPoint
|
||||
for slot: cast(s32)0..count - 1 {
|
||||
point := ReadHabitsStatsPointHost(chart_index, slot)
|
||||
point_x := left + (right - left) * slot / (STATS_DAYS - 1)
|
||||
point_y := bottom - (bottom - top) * point.value / highest
|
||||
if slot > 0 {
|
||||
ChartLine(previous_x, previous_y, point_x, point_y, stats.color)
|
||||
}
|
||||
dot := Scale(4)
|
||||
Fill(Bounds(point_x - dot / 2, point_y - dot / 2, dot, dot),
|
||||
cast(float32)dot * 0.5, stats.color)
|
||||
if Button.Draw(stats.session, Button.Props.{
|
||||
.id = 6100000 + (-chart_index) * STATS_DAYS + slot,
|
||||
.bounds = Bounds(point_x - Scale(8), point_y - Scale(10), Scale(16), Scale(20)),
|
||||
.label = point.label, .invisible = true, .disabled = stats.modal_active}) != 0 {
|
||||
trend_selected_chart = chart_index
|
||||
trend_selected_slot = slot
|
||||
}
|
||||
if slot == 0 {
|
||||
first = point
|
||||
}
|
||||
last = point
|
||||
if slot == trend_selected_slot {
|
||||
selected = point
|
||||
}
|
||||
previous_x = point_x
|
||||
previous_y = point_y
|
||||
}
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(left, bottom + Scale(6),
|
||||
(right - left) / 2, Scale(18)), .text = TrendDate(first.label),
|
||||
.size = stats.small_font, .class_name = stats.muted_class})
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(left + (right - left) / 2,
|
||||
bottom + Scale(6), (right - left) / 2, Scale(18)), .text = TrendDate(last.label),
|
||||
.size = stats.small_font, .class_name = stats.muted_class,
|
||||
.align = cast(TextAlign)TextAlignEnd})
|
||||
if trend_selected_chart != chart_index {
|
||||
selected = last
|
||||
}
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(left, bottom + Scale(28),
|
||||
right - left, Scale(20)), .text = selected.label, .size = stats.small_font,
|
||||
.class_name = stats.muted_class, .align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
}
|
||||
|
||||
HabitTrendLegendColumns :: (width: s32) -> s32 {
|
||||
return ifx width >= Scale(260) then 2 else 1
|
||||
}
|
||||
|
||||
HabitsTrendsHeight :: (width: s32) -> s32 {
|
||||
columns := HabitTrendLegendColumns(width)
|
||||
rows := (stats.habit_count + columns - 1) / columns
|
||||
return Scale(STATS_TREND_HEIGHT + 8) + rows * Scale(STATS_TREND_LEGEND_HEIGHT)
|
||||
}
|
||||
|
||||
// The overview plots all habits against the same dates and 0–1 completion scale.
|
||||
// At a shared point, draw the selected habit last so its line stays visible.
|
||||
CompletionTrends :: (x: s32, y: s32, width: s32) {
|
||||
Card(x, y, width, HabitsTrendsHeight(width))
|
||||
left := x + Scale(32)
|
||||
right := x + width - Scale(14)
|
||||
top := y + Scale(18)
|
||||
bottom := y + Scale(STATS_TREND_HEIGHT - 52)
|
||||
plot_width := right - left
|
||||
if plot_width <= 0 {
|
||||
return
|
||||
}
|
||||
for grid: cast(s32)0..1 {
|
||||
grid_y := ifx grid == 0 then top else bottom
|
||||
ChartLine(left, grid_y, right, grid_y, Alpha(stats.text_color, 0.12))
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(x + Scale(4), grid_y - Scale(8),
|
||||
Scale(24), Scale(18)), .text = ifx grid == 0 then "1" else "0",
|
||||
.size = stats.small_font, .class_name = stats.muted_class,
|
||||
.align = cast(TextAlign)TextAlignEnd})
|
||||
}
|
||||
if trend_selected_habit >= stats.habit_count {
|
||||
trend_selected_habit = 0
|
||||
}
|
||||
selected := trend_selected_habit
|
||||
selected_slot := trend_selected_slot
|
||||
columns := HabitTrendLegendColumns(width)
|
||||
legend_x := x + Scale(10)
|
||||
legend_y := y + Scale(STATS_TREND_HEIGHT)
|
||||
legend_width := (width - Scale(20)) / columns
|
||||
first: string
|
||||
last: string
|
||||
detail: string
|
||||
for offset: cast(s32)1..stats.habit_count {
|
||||
index := (selected + offset) % stats.habit_count
|
||||
chart_index := -2 - index
|
||||
chart := ReadHabitsStatsChartHost(chart_index)
|
||||
chip_size := Scale(8)
|
||||
entry_x := legend_x + (index % columns) * legend_width
|
||||
entry_y := legend_y + (index / columns) * Scale(STATS_TREND_LEGEND_HEIGHT)
|
||||
entry := Bounds(entry_x, entry_y, legend_width - Scale(4), Scale(STATS_TREND_LEGEND_HEIGHT))
|
||||
if index == selected {
|
||||
Fill(entry, cast(float32)Scale(8), Alpha(chart.color, 0.16))
|
||||
}
|
||||
if Button.Draw(stats.session, Button.Props.{.id = 6101000 + index, .bounds = entry,
|
||||
.label = chart.title, .invisible = true, .selected = index == selected,
|
||||
.disabled = stats.modal_active}) != 0 {
|
||||
trend_selected_habit = index
|
||||
}
|
||||
Fill(Bounds(entry_x + Scale(8), entry_y + Scale(18), chip_size, chip_size),
|
||||
cast(float32)chip_size * 0.5, chart.color)
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(entry_x + Scale(22), entry_y,
|
||||
legend_width - Scale(32), Scale(STATS_TREND_LEGEND_HEIGHT)),
|
||||
.text = chart.title, .size = stats.small_font,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
count := chart.point_count
|
||||
if count > STATS_DAYS {
|
||||
count = STATS_DAYS
|
||||
}
|
||||
previous_x := left
|
||||
previous_y := bottom
|
||||
for slot: cast(s32)0..count - 1 {
|
||||
point := ReadHabitsStatsPointHost(chart_index, slot)
|
||||
point_x := left + plot_width * slot / (STATS_DAYS - 1)
|
||||
point_y := ifx point.value > 0 then top else bottom
|
||||
if slot > 0 {
|
||||
ChartLine(previous_x, previous_y, point_x, point_y, chart.color)
|
||||
}
|
||||
if index == selected {
|
||||
if slot == 0 {
|
||||
first = TrendDate(point.label)
|
||||
}
|
||||
if slot == count - 1 {
|
||||
last = TrendDate(point.label)
|
||||
}
|
||||
// Divide the plot into adjacent day targets so a point's hit
|
||||
// area never covers the neighbouring or a different series.
|
||||
bin_left := left + plot_width * (slot * 2 - 1) / ((STATS_DAYS - 1) * 2)
|
||||
bin_right := left + plot_width * (slot * 2 + 1) / ((STATS_DAYS - 1) * 2)
|
||||
if Button.Draw(stats.session, Button.Props.{.id = 6100000 + slot,
|
||||
.bounds = Bounds(bin_left, top - Scale(8), bin_right - bin_left, bottom - top + Scale(16)),
|
||||
.label = point.label, .invisible = true, .selected = selected_slot == slot,
|
||||
.disabled = stats.modal_active}) != 0 {
|
||||
trend_selected_slot = slot
|
||||
}
|
||||
if selected_slot == slot {
|
||||
dot := Scale(8)
|
||||
Fill(Bounds(point_x - dot / 2, point_y - dot / 2, dot, dot),
|
||||
cast(float32)dot * 0.5, chart.color)
|
||||
out: Vec(u8)
|
||||
BuilderPrint(*out, "% · %", chart.title, point.label)
|
||||
detail = BuilderFinish(out)
|
||||
}
|
||||
}
|
||||
previous_x = point_x
|
||||
previous_y = point_y
|
||||
}
|
||||
}
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(left, bottom + Scale(6), plot_width / 2, Scale(18)),
|
||||
.text = first, .size = stats.small_font, .class_name = stats.muted_class})
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(left + plot_width / 2, bottom + Scale(6),
|
||||
plot_width / 2, Scale(18)), .text = last, .size = stats.small_font,
|
||||
.class_name = stats.muted_class, .align = cast(TextAlign)TextAlignEnd})
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(left, bottom + Scale(28), plot_width, Scale(20)),
|
||||
.text = detail, .size = stats.small_font, .class_name = stats.muted_class,
|
||||
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
}
|
||||
|
||||
// A bar of a chart, its top a little rounded.
|
||||
Bar :: (x: s32, y: s32, width: s32, height: s32, color: Color) {
|
||||
radius := Scale(3)
|
||||
@@ -222,25 +426,25 @@ FigureCard :: (bounds: Rectangle, label: string, value: string) {
|
||||
radius := cast(float32)Scale(STATS_CARD_RADIUS)
|
||||
bar := cast(float32)Scale(5)
|
||||
Fill(bounds, radius, stats.color)
|
||||
unused Box(stats.session, BoxProps.{.bounds = Rectangle.{bounds.x + bar, bounds.y,
|
||||
unused Box.Draw(stats.session, Box.Props.{.bounds = Rectangle.{bounds.x + bar, bounds.y,
|
||||
bounds.width - bar, bounds.height}, .fill = stats.card_fill, .radius = radius})
|
||||
unused Box(stats.session, BoxProps.{.bounds = bounds, .border = stats.card_border,
|
||||
unused Box.Draw(stats.session, Box.Props.{.bounds = bounds, .border = stats.card_border,
|
||||
.radius = radius})
|
||||
pad := cast(float32)Scale(STATS_CARD_PADDING)
|
||||
inner := bounds.width - bar - pad * 2.0
|
||||
Text(stats.session, TextProps.{.bounds = Rectangle.{bounds.x + bar + pad,
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Rectangle.{bounds.x + bar + pad,
|
||||
bounds.y + cast(float32)Scale(10), inner, cast(float32)Scale(22)},
|
||||
.text = label, .font = stats.small_font, .class_name = stats.muted_class,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
font := Scale(Text24)
|
||||
while font > Scale(Text16) && Width(value, font) > cast(s32)inner {
|
||||
.text = label, .size = stats.small_font, .class_name = stats.muted_class,
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
font := Scale(Text.Text24)
|
||||
while font > Scale(Text.Text16) && Width(value, font) > cast(s32)inner {
|
||||
font -= 1
|
||||
}
|
||||
strong := Strong(value)
|
||||
Text(stats.session, TextProps.{.bounds = Rectangle.{bounds.x + bar + pad,
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Rectangle.{bounds.x + bar + pad,
|
||||
bounds.y + cast(float32)Scale(34), inner, cast(float32)Scale(32)},
|
||||
.text = value, .font = font, .strong = strong[:],
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.text = value, .size = font, .strong = strong[:],
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
|
||||
Figure :: (x: s32, y: s32, width: s32, label: string, value: string) {
|
||||
@@ -260,8 +464,8 @@ SectionFont :: () -> s32 {
|
||||
}
|
||||
|
||||
SectionTitleHeight :: (title: string, width: s32) -> s32 {
|
||||
return TextHeight(stats.session, TextProps.{.text = title, .font = SectionFont(),
|
||||
.bounds = Bounds(0, 0, width, 0), .wrap = cast(TextWrap)TextWrapAuto,
|
||||
return TextHeight(stats.session, Text.Props.{.text = title, .size = SectionFont(),
|
||||
.bounds = Bounds(0, 0, width, 0), .wrap = cast(Text.Wrap)TextWrapAuto,
|
||||
.line_gap = Scale(3)})
|
||||
}
|
||||
|
||||
@@ -270,10 +474,10 @@ SectionTitleHeight :: (title: string, width: s32) -> s32 {
|
||||
SectionTitle :: (title: string, x: s32, y: s32, width: s32) -> s32 {
|
||||
height := SectionTitleHeight(title, width)
|
||||
strong := Strong(title)
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(x, y, width, height), .text = title,
|
||||
.font = SectionFont(), .strong = strong[:],
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(x, y, width, height), .text = title,
|
||||
.size = SectionFont(), .strong = strong[:],
|
||||
.semantic_kind = cast(SemanticKind)SemanticHeading, .heading_level = 2,
|
||||
.wrap = cast(TextWrap)TextWrapAuto, .line_gap = Scale(3)})
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto, .line_gap = Scale(3)})
|
||||
return height
|
||||
}
|
||||
|
||||
@@ -329,11 +533,11 @@ MoodPanel :: (x: s32, y: s32, width: s32) {
|
||||
color = Alpha(stats.text_color, 0.16)
|
||||
}
|
||||
Bar(bar_x, bars_y + bars_height - bar_height - Scale(22), bar_width, bar_height, color)
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(bar_x, bars_y + bars_height - Scale(20),
|
||||
bar_width, Scale(16)),
|
||||
.text = Number(cast(s64)(mood + 1)), .font = Text12,
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(bar_x, bars_y + bars_height - Scale(20),
|
||||
bar_width, Scale(16)),
|
||||
.text = Number(cast(s64)(mood + 1)), .size = Text.Text12,
|
||||
.class_name = stats.muted_class, .align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -360,10 +564,10 @@ HoldRange :: (x: s32, y: s32, width: s32) {
|
||||
for index: cast(s32)0..1 {
|
||||
segment_x := x + index * segment
|
||||
segment_width := ifx index == 1 then x + width - segment_x else segment
|
||||
if Button(stats.session, ButtonProps.{.id = 24700 + index,
|
||||
if Button.Draw(stats.session, Button.Props.{.id = 24700 + index,
|
||||
.bounds = Bounds(segment_x, y, segment_width, Scale(34)), .label = labels[index],
|
||||
.tone = cast(ButtonTone)(ifx index == selected then ButtonToneAccent
|
||||
else ButtonToneNeutral),
|
||||
else ButtonToneNeutral),
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft, .selected = index == selected,
|
||||
.disabled = stats.modal_active}) != 0 && selected != index {
|
||||
stats.hold_days = values[index]
|
||||
@@ -426,10 +630,10 @@ HoldGraph :: (x: s32, y: s32, width: s32) {
|
||||
line_y := plot_y + (plot_height * step) / 2
|
||||
ChartLine(plot_x, line_y, plot_x + plot_width, line_y, grid)
|
||||
out: Vec(u8)
|
||||
BuilderPrint(*out, "%s", longest - (longest * step) / 2)
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(x + Scale(4), line_y - Scale(8),
|
||||
axis_width - Scale(4), Scale(18)),
|
||||
.text = BuilderFinish(out), .wrap = cast(TextWrap)TextWrapNone})
|
||||
BuilderPrint(*out, "%", longest - (longest * step) / 2)
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(x + Scale(4), line_y - Scale(8),
|
||||
axis_width - Scale(4), Scale(18)),
|
||||
.text = BuilderFinish(out), .wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
ChartLine(plot_x, plot_y + plot_height, plot_x + plot_width, plot_y + plot_height,
|
||||
Alpha(stats.text_color, 0.4))
|
||||
@@ -482,10 +686,10 @@ HoldGraph :: (x: s32, y: s32, width: s32) {
|
||||
if count <= 0 {
|
||||
empty := Locale(ifx days == 31 then "habit_stats_no_rounds_month"
|
||||
else "habit_stats_no_rounds_week")
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(x, y + graph_height / 2 - Scale(8), width,
|
||||
Scale(18)),
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(x, y + graph_height / 2 - Scale(8), width,
|
||||
Scale(18)),
|
||||
.text = empty, .align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
for day: cast(s32)0..days - 1 {
|
||||
days_ago := days - 1 - day
|
||||
@@ -496,9 +700,9 @@ HoldGraph :: (x: s32, y: s32, width: s32) {
|
||||
if days_ago > 0 {
|
||||
label = Filled(Locale("statistics_day_offset_label"), days_ago, 0)
|
||||
}
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(plot_x + (plot_width * day) / days + Scale(2),
|
||||
y + graph_height - Scale(20), Scale(48), Scale(18)),
|
||||
.text = label, .wrap = cast(TextWrap)TextWrapNone})
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(plot_x + (plot_width * day) / days + Scale(2),
|
||||
y + graph_height - Scale(20), Scale(48), Scale(18)),
|
||||
.text = label, .wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,7 +865,7 @@ AnswerChart :: (chart_index: s32, chart: HabitsStatsChart, x: s32, y: s32, width
|
||||
}
|
||||
inset := Scale(10)
|
||||
unused BandChart(stats.session, BandChartProps.{
|
||||
.key = KeyHash("statistics/answer-chart") + cast(u64)chart_index,
|
||||
.key = Layout.KeyHash("statistics/answer-chart") + cast(u64)chart_index,
|
||||
.bounds = Bounds(x + inset, y + inset, width - inset * 2, chart_height - inset * 2),
|
||||
.semantic_label = Locale("habit_stats_answers_title"), .slots = STATS_DAYS,
|
||||
.min_value = low, .max_value = high, .bars = !is_time,
|
||||
@@ -689,14 +893,14 @@ TextAnswers :: (chart_index: s32, chart: HabitsStatsChart, answered: string, x:
|
||||
for index: cast(s32)0..chart.recent_count - 1 {
|
||||
recent := ReadHabitsStatsRecentHost(chart_index, index)
|
||||
Fill(Bounds(row_x, row_y, row_width, Scale(1)), 0.0, Alpha(stats.text_color, 0.1))
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(row_x, row_y, date_width, row_height),
|
||||
.text = DateText(recent.day), .font = stats.small_font,
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(row_x, row_y, date_width, row_height),
|
||||
.text = DateText(recent.day), .size = stats.small_font,
|
||||
.class_name = stats.muted_class, .vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(row_x + date_width, row_y,
|
||||
row_width - date_width, row_height),
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(row_x + date_width, row_y,
|
||||
row_width - date_width, row_height),
|
||||
.text = recent.text, .vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
row_y += row_height
|
||||
}
|
||||
}
|
||||
@@ -795,8 +999,8 @@ Answers :: (x: s32, y: s32, width: s32) {
|
||||
// ---- Changes ------------------------------------------------------------------
|
||||
|
||||
ChangeRowHeight :: (line: string, width: s32) -> s32 {
|
||||
return Scale(30) + TextHeight(stats.session, TextProps.{.text = line, .font = stats.font,
|
||||
.bounds = Bounds(0, 0, width, 0), .wrap = cast(TextWrap)TextWrapAuto,
|
||||
return Scale(30) + TextHeight(stats.session, Text.Props.{.text = line, .size = stats.font,
|
||||
.bounds = Bounds(0, 0, width, 0), .wrap = cast(Text.Wrap)TextWrapAuto,
|
||||
.line_gap = Scale(6)}) + Scale(12)
|
||||
}
|
||||
|
||||
@@ -834,13 +1038,13 @@ Changes :: (x: s32, y: s32, width: s32) {
|
||||
if index > 0 {
|
||||
Fill(Bounds(row_x, row_y, row_width, Scale(1)), 0.0, Alpha(stats.text_color, 0.1))
|
||||
}
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(row_x, row_y + Scale(6), row_width, Scale(18)),
|
||||
.text = change.when, .font = stats.small_font, .class_name = stats.muted_class,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(row_x, row_y + Scale(6), row_width, Scale(18)),
|
||||
.text = change.when, .size = stats.small_font, .class_name = stats.muted_class,
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
row_height := ChangeRowHeight(change.line, row_width)
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(row_x, row_y + Scale(28), row_width,
|
||||
row_height - Scale(36)),
|
||||
.text = change.line, .font = stats.font, .wrap = cast(TextWrap)TextWrapAuto,
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(row_x, row_y + Scale(28), row_width,
|
||||
row_height - Scale(36)),
|
||||
.text = change.line, .size = stats.font, .wrap = cast(Text.Wrap)TextWrapAuto,
|
||||
.line_gap = Scale(6)})
|
||||
row_y += row_height
|
||||
}
|
||||
@@ -859,7 +1063,7 @@ PageHeader :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
if back_width > width / 3 {
|
||||
back_width = width / 3
|
||||
}
|
||||
if Button(stats.session, ButtonProps.{.id = 4300,
|
||||
if Button.Draw(stats.session, Button.Props.{.id = 4300,
|
||||
.bounds = Bounds(x, y + Scale(2), back_width, Scale(42)),
|
||||
.label = back_label, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisOutline,
|
||||
@@ -869,27 +1073,32 @@ PageHeader :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
}
|
||||
title_x := x + back_width + Scale(16)
|
||||
title_width := width - back_width - Scale(16)
|
||||
font := Scale(Text24)
|
||||
font := Scale(Text.Text24)
|
||||
if Width(stats.name, font) > title_width {
|
||||
font = Scale(Text16)
|
||||
font = Scale(Text.Text16)
|
||||
if Width(stats.name, font) > title_width {
|
||||
font = Scale(Text14)
|
||||
font = Scale(Text.Text14)
|
||||
}
|
||||
}
|
||||
strong := Strong(stats.name)
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(title_x, y, title_width, Scale(34)),
|
||||
.text = stats.name, .font = font, .strong = strong[:],
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(title_x, y, title_width, Scale(34)),
|
||||
.text = stats.name, .size = font, .strong = strong[:],
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(title_x, y + Scale(34), title_width, Scale(22)),
|
||||
.text = Locale("habit_statistics_title"), .font = stats.small_font,
|
||||
.class_name = stats.muted_class, .wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(title_x, y + Scale(34), title_width, Scale(22)),
|
||||
.text = Locale("habit_statistics_title"), .size = stats.small_font,
|
||||
.class_name = stats.muted_class, .wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
return y + Scale(68)
|
||||
}
|
||||
|
||||
ContentHeight :: (width: s32) -> s32 {
|
||||
gap := Scale(STATS_SECTION_GAP)
|
||||
height := Scale(8) + Scale(STATS_FIGURE_HEIGHT) + gap
|
||||
trend_height := ifx stats.overview && stats.habit_count > 0 then HabitsTrendsHeight(width) else Scale(STATS_TREND_HEIGHT)
|
||||
height += SectionTitleHeight(Locale("habit_stats_daily_completions"), width) + Scale(10) + trend_height + gap
|
||||
if stats.overview {
|
||||
return height
|
||||
}
|
||||
if stats.span {
|
||||
height += SpanHeight(width)
|
||||
}
|
||||
@@ -912,9 +1121,24 @@ ContentHeight :: (width: s32) -> s32 {
|
||||
Content :: (x: s32, y: s32, width: s32) {
|
||||
gap := Scale(STATS_SECTION_GAP)
|
||||
card_gap := Scale(STATS_CARD_GAP)
|
||||
FigurePair(x, y, width, Locale("habit_stats_current_streak"), DayCountText(stats.current_streak),
|
||||
Locale("habit_stats_last_30_days"), Filled("%d/%d", stats.last_30_done, 30))
|
||||
if stats.overview {
|
||||
FigurePair(x, y, width, Locale("tab_habits"), Number(cast(s64)stats.habit_count),
|
||||
Locale("habit_stats_last_30_days"), Number(cast(s64)stats.last_30_done))
|
||||
} else {
|
||||
FigurePair(x, y, width, Locale("habit_stats_current_streak"), DayCountText(stats.current_streak),
|
||||
Locale("habit_stats_last_30_days"), Filled("%d/%d", stats.last_30_done, stats.last_30_due))
|
||||
}
|
||||
y += Scale(STATS_FIGURE_HEIGHT) + gap
|
||||
y += SectionTitle(Locale("habit_stats_daily_completions"), x, y, width) + Scale(10)
|
||||
if stats.overview && stats.habit_count > 0 {
|
||||
CompletionTrends(x, y, width)
|
||||
return
|
||||
}
|
||||
CompletionTrend(-1, x, y, width)
|
||||
y += Scale(STATS_TREND_HEIGHT) + gap
|
||||
if stats.overview {
|
||||
return
|
||||
}
|
||||
// A habit that measures spans is about their length: it comes first.
|
||||
if stats.span {
|
||||
Spans(x, y, width)
|
||||
@@ -957,10 +1181,10 @@ Content :: (x: s32, y: s32, width: s32) {
|
||||
}
|
||||
Bar(bar_x, y + chart_height - height - Scale(28), bar_width, height,
|
||||
ifx counts[day] > 0 then LightenColor(stats.color, 12) else Alpha(stats.text_color, 0.16))
|
||||
Text(stats.session, TextProps.{.bounds = Bounds(bar_x, y + chart_height - Scale(24),
|
||||
bar_width, Scale(18)),
|
||||
.text = labels[day], .font = Text12, .class_name = stats.muted_class,
|
||||
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapNone})
|
||||
Text.Draw(stats.session, Text.Props.{.bounds = Bounds(bar_x, y + chart_height - Scale(24),
|
||||
bar_width, Scale(18)),
|
||||
.text = labels[day], .size = Text.Text12, .class_name = stats.muted_class,
|
||||
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
y += chart_height + gap
|
||||
if stats.linked {
|
||||
@@ -998,8 +1222,8 @@ HabitsStatsView :: (message: HabitsMessage) -> HabitsMessage {
|
||||
if viewport_height < 0 {
|
||||
viewport_height = 0
|
||||
}
|
||||
scrolled := Scroll(stats.session, ScrollProps.{
|
||||
.key = KeyHash("inbe/screens/statistics_screen/scroll/1"),
|
||||
scrolled := Scroll.Draw(stats.session, Scroll.Props.{
|
||||
.key = Layout.KeyHash("inbe/screens/statistics_screen/scroll/1"),
|
||||
.bounds = Bounds(0, top + Scale(4), stats.view_width, viewport_height),
|
||||
.content_height = ContentHeight(width), .scroll_offset = stats.scroll})
|
||||
stats.scroll = scrolled.scroll_offset
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
#import, file "../../src/apps/habits_types.zi";
|
||||
#import, file "habits_view.zi";
|
||||
#import, file "shop_view.zi";
|
||||
#import, file "shop_stats_view.zi";
|
||||
#import, file "habit_list_view.zi";
|
||||
#import, file "habit_day_view.zi";
|
||||
#import, file "habit_edit_view.zi";
|
||||
#import, file "habit_stats_view.zi";
|
||||
#import, file "../../src/habits/habit_types.zi";
|
||||
#import, file "../../src/habits/habit_links.zi";
|
||||
#import, file "../../src/core/types.zi";
|
||||
#import, file "../../src/apps/module_types.zi";
|
||||
#import "apps/node_types"
|
||||
@@ -39,6 +41,9 @@ HabitsApply :: (message: HabitsMessage) -> HabitsMessage {
|
||||
if message.action == HABITS_UNSAVED_DIALOG || message.action == HABITS_DELETE_DIALOG {
|
||||
return HabitsEditorView(message)
|
||||
}
|
||||
if message.action == HABITS_SHOP_STATS_VIEW {
|
||||
return HabitsShopStatisticsView(message)
|
||||
}
|
||||
if message.action == HABITS_SHOP_VIEW || message.action == HABITS_SHOP_BUY_DIALOG {
|
||||
return HabitsShopView(message)
|
||||
}
|
||||
@@ -67,7 +72,9 @@ HabitsApply :: (message: HabitsMessage) -> HabitsMessage {
|
||||
if message.modal_active || message.index < 0 || message.index >= message.count {
|
||||
return message
|
||||
}
|
||||
if message.counter_enabled != 0 {
|
||||
if (message.sync_activity & HABIT_LINK_DIARY) != 0 {
|
||||
message.day_action = HABITS_DAY_DIARY
|
||||
} else if message.counter_enabled != 0 {
|
||||
message.day_action = ifx message.decrement then HABITS_DAY_DECREMENT else HABITS_DAY_COUNT
|
||||
} else if message.linked_count > 0 {
|
||||
message.day_action = HABITS_DAY_LINKED
|
||||
@@ -105,6 +112,7 @@ HabitsApply :: (message: HabitsMessage) -> HabitsMessage {
|
||||
message.reset_scroll = true
|
||||
return message
|
||||
}
|
||||
message.sync_activity = HabitLinkNormalize(message.sync_activity)
|
||||
message.sync_mode = ifx message.sync_activity != 0 then HABIT_SYNC_ACTIVITIES else HABIT_SYNC_NONE
|
||||
message.weekdays = message.weekdays & 0xff
|
||||
message.color.a = 255
|
||||
|
||||
+23
-27
@@ -5,19 +5,15 @@
|
||||
#import "geometry"
|
||||
#import "vec"
|
||||
#import "dpi"
|
||||
#import "layout"
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Layout :: #import "kryon/layout";
|
||||
Modal :: #import "kryon/modal";
|
||||
Text :: #import "kryon/text";
|
||||
#import "drawing_props"
|
||||
#import "text_props"
|
||||
#import "text_align"
|
||||
#import "text_widget"
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "modal_props"
|
||||
#import "modal_frame_widget"
|
||||
#import "tree"
|
||||
#import "kryon/tree"
|
||||
#import, file "../../src/apps/habits_ui_types.zi";
|
||||
#import, file "../../src/apps/habits_types.zi";
|
||||
#import, file "../../src/app/color.zi";
|
||||
@@ -26,7 +22,7 @@
|
||||
using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
using TextAlign;
|
||||
using TextWrap;
|
||||
using Text.Wrap;
|
||||
host_api :: #system_library "host_api";
|
||||
ReadHabitsUiHost :: () -> HabitsUiFrame #foreign host_api;
|
||||
WriteHabitsUiHost :: (frame: HabitsUiFrame) #foreign host_api;
|
||||
@@ -85,17 +81,17 @@ CountText :: (template: string, count: s32) -> string {
|
||||
}
|
||||
|
||||
CountLabel :: (bounds: Rectangle, text: string) {
|
||||
Text(frame.session, TextProps.{
|
||||
.bounds = bounds, .text = text, .font = frame.small_font,
|
||||
Text.Draw(frame.session, Text.Props.{
|
||||
.bounds = bounds, .text = text, .size = frame.small_font,
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
|
||||
// A step button draws its minus or plus as bars sized to the button, which
|
||||
// read clearly where a "-" or "+" glyph is thin and small.
|
||||
StepButton :: (id: s32, bounds: Rectangle, plus: bool, disabled: bool) -> bool {
|
||||
clicked := Button(frame.session, ButtonProps.{
|
||||
clicked := Button.Draw(frame.session, Button.Props.{
|
||||
.id = id, .bounds = bounds,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft,
|
||||
@@ -112,12 +108,12 @@ StepButton :: (id: s32, bounds: Rectangle, plus: bool, disabled: bool) -> bool {
|
||||
if disabled {
|
||||
color = color_with_alpha(color, 0.35)
|
||||
}
|
||||
unused Box(frame.session, BoxProps.{
|
||||
unused Box.Draw(frame.session, Box.Props.{
|
||||
.bounds = Rectangle.{center_x - length * 0.5, center_y - thickness * 0.5,
|
||||
length, thickness},
|
||||
.fill = color, .radius = thickness * 0.5})
|
||||
if plus {
|
||||
unused Box(frame.session, BoxProps.{
|
||||
unused Box.Draw(frame.session, Box.Props.{
|
||||
.bounds = Rectangle.{center_x - thickness * 0.5, center_y - length * 0.5,
|
||||
thickness, length},
|
||||
.fill = color, .radius = thickness * 0.5})
|
||||
@@ -140,8 +136,8 @@ CountDialog :: () {
|
||||
if frame.asks {
|
||||
content_h += button_h + gap
|
||||
}
|
||||
dialog := ModalFrame(frame.session, ModalFrameProps.{
|
||||
.key = KeyHash("habits/count-dialog"),
|
||||
dialog := Modal.Draw(frame.session, Modal.Props.{
|
||||
.key = Layout.KeyHash("habits/count-dialog"),
|
||||
.title = frame.name,
|
||||
.strong_title = true,
|
||||
.width = Scale(340), .height = content_h + Scale(74),
|
||||
@@ -169,15 +165,15 @@ CountDialog :: () {
|
||||
count_out: Vec(u8)
|
||||
BuilderPrint(*count_out, "%", frame.count)
|
||||
count_text := BuilderFinish(count_out)
|
||||
count_strong: [1]TextRange
|
||||
count_strong[0] = TextRange.{.start = 0, .end = cast(s32)count_text.count}
|
||||
Text(frame.session, TextProps.{
|
||||
count_strong: [1]Text.Range
|
||||
count_strong[0] = Text.Range.{.start = 0, .end = cast(s32)count_text.count}
|
||||
Text.Draw(frame.session, Text.Props.{
|
||||
.bounds = Bounds(x, y, width, Scale(64)),
|
||||
.text = count_text, .font = Scale(Text48),
|
||||
.text = count_text, .size = Scale(Text.Text48),
|
||||
.strong = count_strong[:],
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
y += Scale(64)
|
||||
target_out: Vec(u8)
|
||||
BuilderPrint(*target_out, "% %", HabitsLocaleHost("habit_counter_target"), frame.target)
|
||||
@@ -194,7 +190,7 @@ CountDialog :: () {
|
||||
}
|
||||
y += step_h + gap
|
||||
if frame.asks {
|
||||
if Button(frame.session, ButtonProps.{
|
||||
if Button.Draw(frame.session, Button.Props.{
|
||||
.id = 5720004, .bounds = Bounds(x, y, width, button_h),
|
||||
.label = HabitsLocaleHost("habit_day_entries"),
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
@@ -209,7 +205,7 @@ CountDialog :: () {
|
||||
if frame.linked_count > 0 {
|
||||
template := HabitsLocaleHost(ifx frame.linked_count == 1
|
||||
then "session_count_singular" else "session_count_plural")
|
||||
if Button(frame.session, ButtonProps.{
|
||||
if Button.Draw(frame.session, Button.Props.{
|
||||
.id = 5720002, .bounds = Bounds(x, y, width, button_h),
|
||||
.label = CountText(template, frame.linked_count),
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
@@ -220,7 +216,7 @@ CountDialog :: () {
|
||||
}
|
||||
y += button_h + gap
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{
|
||||
if Button.Draw(frame.session, Button.Props.{
|
||||
.id = 5720003, .bounds = Bounds(x, y, width, button_h),
|
||||
.label = HabitsLocaleHost("done_button"),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent,
|
||||
|
||||
@@ -0,0 +1,239 @@
|
||||
// A separate, read-only view of the persisted shop purchase history.
|
||||
#import, file "shop_view.zi";
|
||||
#import, file "../../src/apps/habits_types.zi";
|
||||
#import, file "../../src/apps/habits_ui_types.zi";
|
||||
Box :: #import "kryon/box";
|
||||
Layout :: #import "kryon/layout";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
Text :: #import "kryon/text";
|
||||
#import "kryon/drawing_props"
|
||||
#import "text_measure"
|
||||
#import "text_align"
|
||||
#import "kryon/tree"
|
||||
#import "vec"
|
||||
using Text.Wrap;
|
||||
host_api :: #system_library "host_api";
|
||||
ReadHabitsShopHost :: () -> HabitsShopFrame #foreign host_api;
|
||||
WriteHabitsShopHost :: (frame: HabitsShopFrame) #foreign host_api;
|
||||
ReadHabitRewardHost :: (index: s32) -> HabitsShopReward #foreign host_api;
|
||||
|
||||
|
||||
PurchaseDate :: (date: s32) -> string {
|
||||
month := (date / 100) % 100
|
||||
day := date % 100
|
||||
out: Vec(u8)
|
||||
BuilderPrint(*out, "%-", date / 10000)
|
||||
if month < 10 {
|
||||
BuilderPrint(*out, "0")
|
||||
}
|
||||
BuilderPrint(*out, "%-", month)
|
||||
if day < 10 {
|
||||
BuilderPrint(*out, "0")
|
||||
}
|
||||
BuilderPrint(*out, "%", day)
|
||||
return BuilderFinish(out)
|
||||
}
|
||||
|
||||
RewardStatisticsText :: (reward: HabitsShopReward) -> string {
|
||||
out: Vec(u8)
|
||||
BuilderPrint(*out, "%: % · %: %", Locale("habit_shop_stats_purchases"),
|
||||
reward.statistics.purchase_count, Locale("habit_shop_stats_month"),
|
||||
reward.statistics.month_count)
|
||||
return BuilderFinish(out)
|
||||
}
|
||||
|
||||
RewardStatisticsHeight :: (reward: HabitsShopReward, width: s32) -> s32 {
|
||||
inner := width - Scale(SHOP_CARD_PADDING * 2 + 10)
|
||||
height := ParagraphHeight(RewardStatisticsText(reward), inner, shop.small_font)
|
||||
if reward.statistics.purchase_count > 0 {
|
||||
height += Scale(4) + ParagraphHeight(Filled(Locale("habit_shop_stats_last"),
|
||||
PurchaseDate(reward.statistics.last_date)), inner, shop.small_font)
|
||||
}
|
||||
return height + Scale(14)
|
||||
}
|
||||
|
||||
// Coins spent show in the coins' own color.
|
||||
StatisticsColor :: (index: s32) -> Color {
|
||||
colors: [4]Color = .[Color.{63, 137, 216, 255}, CoinColor(),
|
||||
Color.{48, 159, 128, 255}, Color.{155, 104, 207, 255}]
|
||||
return colors[index]
|
||||
}
|
||||
|
||||
StatisticsLabel :: (index: s32) -> string {
|
||||
keys: [4]string = .["habit_shop_stats_purchases", "habit_shop_stats_spent",
|
||||
"habit_shop_stats_week", "habit_shop_stats_month"]
|
||||
return Locale(keys[index])
|
||||
}
|
||||
|
||||
StatisticsValue :: (index: s32) -> string {
|
||||
values: [4]s64 = .[shop.statistics.purchase_count, shop.statistics.spent_coins,
|
||||
shop.statistics.week_count, shop.statistics.month_count]
|
||||
return Number(values[index])
|
||||
}
|
||||
|
||||
StatisticsColumns :: (width: s32) -> s32 {
|
||||
return ifx width >= Scale(280) then 2 else 1
|
||||
}
|
||||
|
||||
StatisticsInnerWidth :: (width: s32) -> s32 {
|
||||
return (width - Scale(8) * (StatisticsColumns(width) - 1)) /
|
||||
StatisticsColumns(width) - Scale(32)
|
||||
}
|
||||
|
||||
StatisticsNumberHeight :: (width: s32) -> s32 {
|
||||
height := Scale(30)
|
||||
for index: cast(s32)0..3 {
|
||||
value_h := TextHeight(shop.session, Text.Props.{.text = StatisticsValue(index),
|
||||
.size = shop.font + Scale(6),
|
||||
.bounds = Bounds(0, 0, StatisticsInnerWidth(width), 0),
|
||||
.wrap = cast(Text.Wrap)TextWrapAnywhere})
|
||||
if value_h > height {
|
||||
height = value_h
|
||||
}
|
||||
}
|
||||
return height
|
||||
}
|
||||
|
||||
StatisticsCardHeight :: (width: s32) -> s32 {
|
||||
inner := StatisticsInnerWidth(width)
|
||||
height: s32 = 0
|
||||
for index: cast(s32)0..3 {
|
||||
label_h := ParagraphHeight(StatisticsLabel(index), inner, shop.small_font)
|
||||
if label_h > height {
|
||||
height = label_h
|
||||
}
|
||||
}
|
||||
return height + StatisticsNumberHeight(width) + Scale(34)
|
||||
}
|
||||
|
||||
StatisticsHeight :: (width: s32) -> s32 {
|
||||
title_h := SectionTitleHeight(Locale("habit_shop_stats_title"), width) + Scale(10)
|
||||
if shop.statistics.purchase_count == 0 {
|
||||
return title_h + ParagraphHeight(Locale("habit_shop_stats_empty"), width,
|
||||
shop.small_font)
|
||||
}
|
||||
rows := 4 / StatisticsColumns(width)
|
||||
last := Filled(Locale("habit_shop_stats_last"), PurchaseDate(shop.statistics.last_date))
|
||||
return title_h + rows * StatisticsCardHeight(width) + rows * Scale(8) +
|
||||
ParagraphHeight(last, width, shop.small_font)
|
||||
}
|
||||
|
||||
Statistics :: (x: s32, y: s32, width: s32) {
|
||||
y += SectionTitle(Locale("habit_shop_stats_title"), x, y, width) + Scale(10)
|
||||
if shop.statistics.purchase_count == 0 {
|
||||
text := Locale("habit_shop_stats_empty")
|
||||
Text.Draw(shop.session, Text.Props.{.bounds = Bounds(x, y, width,
|
||||
ParagraphHeight(text, width, shop.small_font)), .text = text,
|
||||
.size = shop.small_font, .class_name = shop.muted_class,
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
return
|
||||
}
|
||||
columns := StatisticsColumns(width)
|
||||
card_w := (width - Scale(8) * (columns - 1)) / columns
|
||||
card_h := StatisticsCardHeight(width)
|
||||
number_h := StatisticsNumberHeight(width)
|
||||
for index: cast(s32)0..3 {
|
||||
card_x := x + (index % columns) * (card_w + Scale(8))
|
||||
card_y := y + (index / columns) * (card_h + Scale(8))
|
||||
Card(Bounds(card_x, card_y, card_w, card_h), "")
|
||||
Box.Draw(shop.session, Box.Props.{.bounds = Bounds(card_x, card_y + Scale(12),
|
||||
Scale(4), card_h - Scale(24)), .fill = StatisticsColor(index)})
|
||||
value := StatisticsValue(index)
|
||||
strong: [1]Text.Range
|
||||
strong[0] = Text.Range.{.start = 0, .end = cast(s32)value.count}
|
||||
Text.Draw(shop.session, Text.Props.{.bounds = Bounds(card_x + Scale(16),
|
||||
card_y + Scale(12), card_w - Scale(32), number_h),
|
||||
.text = value, .size = shop.font + Scale(6), .strong = strong[:],
|
||||
.wrap = cast(Text.Wrap)TextWrapAnywhere})
|
||||
Text.Draw(shop.session, Text.Props.{.bounds = Bounds(card_x + Scale(16),
|
||||
card_y + number_h + Scale(18), card_w - Scale(32), card_h - number_h - Scale(30)),
|
||||
.text = StatisticsLabel(index), .size = shop.small_font,
|
||||
.class_name = shop.muted_class, .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
}
|
||||
last := Filled(Locale("habit_shop_stats_last"), PurchaseDate(shop.statistics.last_date))
|
||||
last_y := y + (4 / columns) * (card_h + Scale(8))
|
||||
Text.Draw(shop.session, Text.Props.{.bounds = Bounds(x, last_y, width,
|
||||
ParagraphHeight(last, width, shop.small_font)), .text = last,
|
||||
.size = shop.small_font, .class_name = shop.muted_class,
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
}
|
||||
|
||||
StatisticsRewardHeight :: (index: s32, width: s32) -> s32 {
|
||||
reward := ReadHabitRewardHost(index)
|
||||
return ParagraphHeight(reward.name, width - Scale(32), shop.font) +
|
||||
RewardStatisticsHeight(reward, width) + Scale(32)
|
||||
}
|
||||
|
||||
StatisticsReward :: (index: s32, x: s32, y: s32, width: s32) -> s32 {
|
||||
reward := ReadHabitRewardHost(index)
|
||||
height := StatisticsRewardHeight(index, width)
|
||||
Card(Bounds(x, y, width, height), "")
|
||||
pad := Scale(16)
|
||||
inner := width - pad * 2
|
||||
name_h := ParagraphHeight(reward.name, inner, shop.font)
|
||||
Text.Draw(shop.session, Text.Props.{.bounds = Bounds(x + pad, y + pad, inner, name_h),
|
||||
.text = reward.name, .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
text := RewardStatisticsText(reward)
|
||||
text_h := ParagraphHeight(text, inner, shop.small_font)
|
||||
line_y := y + pad + name_h + Scale(8)
|
||||
Text.Draw(shop.session, Text.Props.{.bounds = Bounds(x + pad, line_y, inner, text_h),
|
||||
.text = text, .size = shop.small_font, .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
if reward.statistics.purchase_count > 0 {
|
||||
last := Filled(Locale("habit_shop_stats_last"),
|
||||
PurchaseDate(reward.statistics.last_date))
|
||||
Text.Draw(shop.session, Text.Props.{.bounds = Bounds(x + pad,
|
||||
line_y + text_h + Scale(4), inner,
|
||||
ParagraphHeight(last, inner, shop.small_font)),
|
||||
.text = last, .size = shop.small_font,
|
||||
.class_name = shop.muted_class, .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
}
|
||||
return height
|
||||
}
|
||||
|
||||
ShopStatisticsPage :: () {
|
||||
bounds := shop.bounds
|
||||
width := cast(s32)bounds.width
|
||||
x := cast(s32)bounds.x
|
||||
if width > Scale(SHOP_COLUMN_MAX) {
|
||||
x += (width - Scale(SHOP_COLUMN_MAX)) / 2
|
||||
width = Scale(SHOP_COLUMN_MAX)
|
||||
}
|
||||
top := PageHeader(x, cast(s32)bounds.y, width,
|
||||
Locale("habit_shop_stats_title"), "")
|
||||
if top < 0 {
|
||||
shop.action = HABITS_SHOP_STATS_BACK
|
||||
return
|
||||
}
|
||||
content_width := width - Scale(SHOP_SCROLLBAR_ROOM)
|
||||
gap := Scale(SHOP_GAP)
|
||||
content_h := StatisticsHeight(content_width) + gap
|
||||
for index: cast(s32)0..shop.reward_count - 1 {
|
||||
content_h += StatisticsRewardHeight(index, content_width) + gap
|
||||
}
|
||||
scrolled := Scroll.Draw(shop.session, Scroll.Props.{
|
||||
.key = Layout.KeyHash("inbe/habits/shop/statistics"),
|
||||
.bounds = Bounds(x, top, width,
|
||||
cast(s32)(bounds.y + bounds.height) - top),
|
||||
.content_height = content_h, .scroll_offset = shop.scroll})
|
||||
shop.scroll = scrolled.scroll_offset
|
||||
if !scrolled.opened {
|
||||
return
|
||||
}
|
||||
y := cast(s32)scrolled.content.y
|
||||
Statistics(x, y, content_width)
|
||||
y += StatisticsHeight(content_width) + gap
|
||||
for index: cast(s32)0..shop.reward_count - 1 {
|
||||
y += StatisticsReward(index, x, y, content_width) + gap
|
||||
}
|
||||
unused End(shop.session)
|
||||
}
|
||||
|
||||
HabitsShopStatisticsView :: (message: HabitsMessage) -> HabitsMessage {
|
||||
shop = ReadHabitsShopHost()
|
||||
shop.action = HABITS_SHOP_NONE
|
||||
shop.clipboard_write = false
|
||||
ShopStatisticsPage()
|
||||
WriteHabitsShopHost(shop)
|
||||
message.succeeded = true
|
||||
return message
|
||||
}
|
||||
+206
-124
@@ -8,39 +8,52 @@
|
||||
#import "geometry"
|
||||
#import "vec"
|
||||
#import "dpi"
|
||||
#import "layout"
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Image :: #import "kryon/image";
|
||||
Layout :: #import "kryon/layout";
|
||||
Modal :: #import "kryon/modal";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
SvgIcon :: #import "kryon/svg_icon";
|
||||
Text :: #import "kryon/text";
|
||||
TextField :: #import "kryon/text_field";
|
||||
#import "drawing_props"
|
||||
#import "semantic"
|
||||
#import "text_props"
|
||||
#import "text_align"
|
||||
#import "text_widget"
|
||||
#import "text_measure"
|
||||
#import "text_input_props"
|
||||
#import "text_field_widget"
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "modal_props"
|
||||
#import "modal_frame_widget"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "svg_icon_props"
|
||||
#import "svg_icon_widget"
|
||||
#import "tree"
|
||||
#import "kryon/tree"
|
||||
#import, file "../../src/apps/habits_ui_types.zi";
|
||||
#import, file "../../src/apps/habits_types.zi";
|
||||
#import, file "coin_color.zi";
|
||||
#import, file "../../src/habits/habit_types.zi";
|
||||
#import, file "../../src/habits/habit_icons.zi";
|
||||
#import, file "../../src/habits/reward_icons.zi";
|
||||
#import, file "../../src/habits/habit_coins.zi";
|
||||
// Generated reward artwork shares the regular image surface with other app media.
|
||||
RewardImage :: (icon: s32) -> Image.Props {
|
||||
return Image.Props.{.asset_path = RewardIconAsset(icon),
|
||||
.alt_text = Locale(RewardIconLabelKey(icon)), .smooth = true}
|
||||
}
|
||||
|
||||
RewardSymbol :: (icon: s32, bounds: Rectangle) {
|
||||
if RewardIconAsset(icon).count > 0 {
|
||||
picture := RewardImage(icon)
|
||||
picture.bounds = bounds
|
||||
Image.Draw(shop.session, picture)
|
||||
} else {
|
||||
SvgIcon.Draw(shop.session, SvgIcon.Props.{.bounds = bounds,
|
||||
.shape = RewardIconShape(icon), .color = shop.text_color})
|
||||
}
|
||||
}
|
||||
|
||||
CoinIcon :: #import "mingcute/mingcute_filled_copper_coin";
|
||||
|
||||
using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
using SemanticKind;
|
||||
using TextAlign;
|
||||
using TextWrap;
|
||||
using Text.Wrap;
|
||||
host_api :: #system_library "host_api";
|
||||
ReadHabitsShopHost :: () -> HabitsShopFrame #foreign host_api;
|
||||
WriteHabitsShopHost :: (frame: HabitsShopFrame) #foreign host_api;
|
||||
@@ -91,22 +104,21 @@ Locale :: (key: string) -> string {
|
||||
|
||||
// The width a line of text takes in the host's fonts.
|
||||
Width :: (text: string, font: s32) -> s32 {
|
||||
return TextWidth(shop.session, TextProps.{.text = text, .font = font})
|
||||
return TextWidth(shop.session, Text.Props.{.text = text, .size = font})
|
||||
}
|
||||
|
||||
// The height Text takes for a paragraph wrapped in width.
|
||||
ParagraphHeight :: (text: string, width: s32, font: s32) -> s32 {
|
||||
return TextHeight(shop.session, TextProps.{.text = text, .font = font,
|
||||
return TextHeight(shop.session, Text.Props.{.text = text, .size = font,
|
||||
.bounds = Bounds(0, 0, width, 0)})
|
||||
}
|
||||
|
||||
// A warm gold that reads on light and dark themes alike.
|
||||
CoinColor :: () -> Color {
|
||||
return Color.{.r = 226, .g = 168, .b = 48, .a = 255}
|
||||
return HabitsCoinColor(shop.highlight_color, shop.text_color)
|
||||
}
|
||||
|
||||
Coin :: (bounds: Rectangle) {
|
||||
SvgIcon(shop.session, SvgIconProps.{.bounds = bounds, .shape = CoinIcon.Shape,
|
||||
SvgIcon.Draw(shop.session, SvgIcon.Props.{.bounds = bounds, .shape = CoinIcon.Shape,
|
||||
.color = CoinColor()})
|
||||
}
|
||||
|
||||
@@ -165,8 +177,8 @@ Replaced :: (value: string, start: s32, end: s32, replacement: string,
|
||||
}
|
||||
|
||||
Card :: (bounds: Rectangle, key: string) {
|
||||
unused Box(shop.session, BoxProps.{
|
||||
.key = ifx key.count > 0 then KeyHash(key) else cast(u64)0,
|
||||
unused Box.Draw(shop.session, Box.Props.{
|
||||
.key = ifx key.count > 0 then Layout.KeyHash(key) else cast(u64)0,
|
||||
.bounds = bounds, .fill = shop.card_fill, .border = shop.card_border,
|
||||
.radius = cast(float32)shop.card_radius})
|
||||
}
|
||||
@@ -180,19 +192,19 @@ CoinAmountWidth :: (amount: string, font: s32) -> s32 {
|
||||
CoinAmount :: (amount: string, bounds: Rectangle, font: s32) {
|
||||
size := cast(float32)font
|
||||
Coin(Rectangle.{bounds.x, bounds.y + (bounds.height - size) * 0.5, size, size})
|
||||
strong: [1]TextRange
|
||||
strong[0] = TextRange.{.start = 0, .end = cast(s32)amount.count}
|
||||
Text(shop.session, TextProps.{
|
||||
strong: [1]Text.Range
|
||||
strong[0] = Text.Range.{.start = 0, .end = cast(s32)amount.count}
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Rectangle.{bounds.x + size + cast(float32)Scale(6), bounds.y,
|
||||
bounds.width - size - cast(float32)Scale(6), bounds.height},
|
||||
.text = amount, .font = font, .strong = strong[:],
|
||||
.text = amount, .size = font, .strong = strong[:],
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
}
|
||||
|
||||
ShopButton :: (id: s32, label: string, bounds: Rectangle, tone: ButtonTone,
|
||||
emphasis: ButtonEmphasis, disabled: bool) -> bool {
|
||||
return Button(shop.session, ButtonProps.{
|
||||
return Button.Draw(shop.session, Button.Props.{
|
||||
.id = id, .bounds = bounds, .label = label, .tone = tone,
|
||||
.emphasis = emphasis, .fit_content = true,
|
||||
.disabled = disabled || shop.modal_active}) != 0
|
||||
@@ -273,15 +285,15 @@ FormSubmit :: () {
|
||||
FormReset()
|
||||
}
|
||||
|
||||
NameField :: (bounds: Rectangle) -> TextFieldResult {
|
||||
result := TextField(shop.session, TextFieldProps.{
|
||||
.key = KeyHash("inbe/habits/shop/name"), .bounds = bounds,
|
||||
NameField :: (bounds: Rectangle) -> TextField.Result {
|
||||
result := TextField.Draw(shop.session, TextField.Props.{
|
||||
.key = Layout.KeyHash("inbe/habits/shop/name"), .bounds = bounds,
|
||||
.value = shop.name, .placeholder = Locale("habit_shop_name_placeholder"),
|
||||
.cursor = shop.name_cursor, .anchor = shop.name_anchor,
|
||||
.scroll_x = shop.name_scroll_x, .focused = shop.name_focused,
|
||||
.focus_id = 8411, .max_bytes = HABIT_REWARD_NAME_SIZE - 1,
|
||||
.max_codepoints = HABIT_REWARD_NAME_SIZE - 1, .disabled = shop.modal_active,
|
||||
.input = ifx shop.name_focused then shop.input else TextFieldInput.{}})
|
||||
.input = ifx shop.name_focused then shop.input else TextField.Input.{}})
|
||||
if result.edit.changed {
|
||||
shop.name = Replaced(shop.name, result.edit.start, result.edit.end,
|
||||
result.edit.replacement, HABIT_REWARD_NAME_SIZE - 1)
|
||||
@@ -303,17 +315,17 @@ NameField :: (bounds: Rectangle) -> TextFieldResult {
|
||||
|
||||
// The price as typed; an empty or zero entry keeps the last price until
|
||||
// the field is left.
|
||||
PriceField :: (bounds: Rectangle) -> TextFieldResult {
|
||||
PriceField :: (bounds: Rectangle) -> TextField.Result {
|
||||
if !shop.price_focused {
|
||||
PriceText()
|
||||
}
|
||||
result := TextField(shop.session, TextFieldProps.{
|
||||
.key = KeyHash("inbe/habits/shop/price"), .bounds = bounds,
|
||||
result := TextField.Draw(shop.session, TextField.Props.{
|
||||
.key = Layout.KeyHash("inbe/habits/shop/price"), .bounds = bounds,
|
||||
.value = shop.price_text, .cursor = shop.price_cursor,
|
||||
.anchor = shop.price_anchor, .scroll_x = shop.price_scroll_x,
|
||||
.focused = shop.price_focused, .focus_id = 8412, .numeric = true,
|
||||
.max_bytes = 4, .max_codepoints = 4, .disabled = shop.modal_active,
|
||||
.input = ifx shop.price_focused then shop.input else TextFieldInput.{}})
|
||||
.input = ifx shop.price_focused then shop.input else TextField.Input.{}})
|
||||
if result.edit.changed {
|
||||
shop.price_text = Replaced(shop.price_text, result.edit.start, result.edit.end,
|
||||
result.edit.replacement, 4)
|
||||
@@ -346,17 +358,17 @@ PriceField :: (bounds: Rectangle) -> TextFieldResult {
|
||||
}
|
||||
|
||||
// The limit as typed; an empty field means no borrowing.
|
||||
BorrowField :: (bounds: Rectangle) -> TextFieldResult {
|
||||
BorrowField :: (bounds: Rectangle) -> TextField.Result {
|
||||
if !shop.borrow_focused {
|
||||
BorrowText()
|
||||
}
|
||||
result := TextField(shop.session, TextFieldProps.{
|
||||
.key = KeyHash("inbe/habits/shop/borrow"), .bounds = bounds,
|
||||
result := TextField.Draw(shop.session, TextField.Props.{
|
||||
.key = Layout.KeyHash("inbe/habits/shop/borrow"), .bounds = bounds,
|
||||
.value = shop.borrow_text, .cursor = shop.borrow_cursor,
|
||||
.anchor = shop.borrow_anchor, .scroll_x = shop.borrow_scroll_x,
|
||||
.focused = shop.borrow_focused, .focus_id = 8413, .numeric = true,
|
||||
.max_bytes = 4, .max_codepoints = 4, .disabled = shop.modal_active,
|
||||
.input = ifx shop.borrow_focused then shop.input else TextFieldInput.{}})
|
||||
.input = ifx shop.borrow_focused then shop.input else TextField.Input.{}})
|
||||
if result.edit.changed {
|
||||
shop.borrow_text = Replaced(shop.borrow_text, result.edit.start,
|
||||
result.edit.end, result.edit.replacement, 4)
|
||||
@@ -400,7 +412,7 @@ PageHeader :: (x: s32, y: s32, width: s32, title_text: string, subtitle: string)
|
||||
if back_w > width / 3 {
|
||||
back_w = width / 3
|
||||
}
|
||||
if Button(shop.session, ButtonProps.{
|
||||
if Button.Draw(shop.session, Button.Props.{
|
||||
.id = 8400, .bounds = Bounds(x, y + Scale(2), back_w, Scale(42)),
|
||||
.label = back_label, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisOutline,
|
||||
@@ -411,24 +423,24 @@ PageHeader :: (x: s32, y: s32, width: s32, title_text: string, subtitle: string)
|
||||
title_x := x + back_w + Scale(16)
|
||||
title_w := width - back_w - Scale(16)
|
||||
// The title as large as it fits, as on Habits' other pages.
|
||||
title_font := Scale(Text24)
|
||||
title_font := Scale(Text.Text24)
|
||||
if Width(title_text, title_font) > title_w {
|
||||
title_font = Scale(Text16)
|
||||
title_font = Scale(Text.Text16)
|
||||
if Width(title_text, title_font) > title_w {
|
||||
title_font = Scale(Text14)
|
||||
title_font = Scale(Text.Text14)
|
||||
}
|
||||
}
|
||||
strong: [1]TextRange
|
||||
strong[0] = TextRange.{.start = 0, .end = cast(s32)title_text.count}
|
||||
Text(shop.session, TextProps.{
|
||||
strong: [1]Text.Range
|
||||
strong[0] = Text.Range.{.start = 0, .end = cast(s32)title_text.count}
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(title_x, y, title_w, Scale(34)), .text = title_text,
|
||||
.font = title_font, .strong = strong[:],
|
||||
.size = title_font, .strong = strong[:],
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
Text(shop.session, TextProps.{
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(title_x, y + Scale(34), title_w, Scale(22)), .text = subtitle,
|
||||
.font = shop.small_font, .class_name = shop.muted_class,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.size = shop.small_font, .class_name = shop.muted_class,
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
return y + Scale(68)
|
||||
}
|
||||
|
||||
@@ -442,17 +454,49 @@ BalanceCard :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
text_x := x + pad + coin + Scale(14)
|
||||
text_w := width - (text_x - x) - pad
|
||||
amount := Coins(shop.halves)
|
||||
strong: [1]TextRange
|
||||
strong[0] = TextRange.{.start = 0, .end = cast(s32)amount.count}
|
||||
Text(shop.session, TextProps.{
|
||||
strong: [1]Text.Range
|
||||
strong[0] = Text.Range.{.start = 0, .end = cast(s32)amount.count}
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(text_x, y + Scale(14), text_w, Scale(40)), .text = amount,
|
||||
.font = shop.font + Scale(16), .strong = strong[:],
|
||||
.size = shop.font + Scale(16), .strong = strong[:],
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
Text(shop.session, TextProps.{
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(text_x, y + Scale(54), text_w, Scale(24)),
|
||||
.text = Locale("habit_shop_balance_label"), .font = shop.small_font,
|
||||
.class_name = shop.muted_class, .wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.text = Locale("habit_shop_balance_label"), .size = shop.small_font,
|
||||
.class_name = shop.muted_class, .wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
return height
|
||||
}
|
||||
|
||||
// Today's daily reward: Claim for today's coins, or that they are claimed.
|
||||
SHOP_DAILY_CLAIM_HEIGHT :: 44
|
||||
|
||||
DailyCardHeight :: () -> s32 {
|
||||
return Scale(SHOP_DAILY_CLAIM_HEIGHT)
|
||||
}
|
||||
|
||||
DailyCard :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
height := DailyCardHeight()
|
||||
if shop.daily_claimed {
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(x, y, width, height),
|
||||
.text = Locale("habit_shop_daily_claimed"),
|
||||
.class_name = shop.muted_class,
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
return height
|
||||
}
|
||||
label := Filled(Locale("habit_shop_daily_claim"),
|
||||
Number(cast(s64)HabitDailyRewardCoins(shop.daily_day)))
|
||||
if ShopButton(8450, label, Bounds(x, y, width, height),
|
||||
cast(ButtonTone)ButtonToneAccent, cast(ButtonEmphasis)ButtonEmphasisFilled,
|
||||
false) {
|
||||
shop.name_focused = false
|
||||
shop.price_focused = false
|
||||
shop.borrow_focused = false
|
||||
shop.action = HABITS_SHOP_DAILY_CLAIM
|
||||
}
|
||||
return height
|
||||
}
|
||||
|
||||
@@ -472,12 +516,12 @@ BorrowRow :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
step := Scale(44)
|
||||
controls_w := step + Scale(6) + Scale(64) + Scale(6) + step + Scale(8) + coin
|
||||
label_w := width - pad * 2 - controls_w
|
||||
Text(shop.session, TextProps.{
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(inner_x, field_y, label_w, field_h),
|
||||
.text = Locale("habit_shop_borrow_label"),
|
||||
.class_name = shop.muted_class,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
control_x := inner_x + label_w
|
||||
if ShopButton(8440, "-", Bounds(control_x, field_y, step, field_h),
|
||||
cast(ButtonTone)ButtonToneNeutral, cast(ButtonEmphasis)ButtonEmphasisSoft,
|
||||
@@ -535,11 +579,13 @@ ActivityRow :: (index: s32, x: s32, y: s32, width: s32) -> s32 {
|
||||
first_height := ifx stacked then height - Scale(32) else height
|
||||
symbol := Scale(20)
|
||||
icon_height := ifx stacked then Scale(24) else height
|
||||
shape := ifx line.icon > 0 then HabitIconShape(line.icon) else ""
|
||||
SvgIcon(shop.session, SvgIconProps.{
|
||||
.bounds = Bounds(x, y + (icon_height - symbol) / 2, symbol, symbol),
|
||||
.shape = ifx shape.count > 0 then shape else SHOP_DONE_SHAPE,
|
||||
.color = shop.text_color})
|
||||
symbol_bounds := Bounds(x, y + (icon_height - symbol) / 2, symbol, symbol)
|
||||
if line.icon > 0 {
|
||||
RewardSymbol(HabitRewardIconClamp(line.icon), symbol_bounds)
|
||||
} else {
|
||||
SvgIcon.Draw(shop.session, SvgIcon.Props.{.bounds = symbol_bounds,
|
||||
.shape = SHOP_DONE_SHAPE, .color = shop.text_color})
|
||||
}
|
||||
amount := ActivityAmount(line)
|
||||
amount_w := CoinAmountWidth(amount, shop.font)
|
||||
day_w := Width(line.day, shop.small_font) + Scale(12)
|
||||
@@ -547,16 +593,16 @@ ActivityRow :: (index: s32, x: s32, y: s32, width: s32) -> s32 {
|
||||
amount_x := x + width - amount_w
|
||||
day_x := ifx stacked then name_x else amount_x - Scale(12) - day_w
|
||||
name_w := ifx stacked then amount_x - Scale(12) - name_x else day_x - name_x
|
||||
Text(shop.session, TextProps.{
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(name_x, y, name_w, first_height), .text = line.name,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)(ifx stacked then TextWrapAuto else TextWrapEllipsis)})
|
||||
Text(shop.session, TextProps.{
|
||||
.wrap = cast(Text.Wrap)(ifx stacked then TextWrapAuto else TextWrapEllipsis)})
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(day_x, ifx stacked then y + first_height else y,
|
||||
day_w, ifx stacked then Scale(24) else height), .text = line.day,
|
||||
.font = shop.small_font, .class_name = shop.muted_class,
|
||||
.size = shop.small_font, .class_name = shop.muted_class,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
CoinAmount(amount, Bounds(amount_x, y, amount_w, ifx stacked then Scale(24) else height), shop.font)
|
||||
return height
|
||||
}
|
||||
@@ -569,13 +615,13 @@ SectionTitleHeight :: (title: string, width: s32) -> s32 {
|
||||
|
||||
SectionTitle :: (title: string, x: s32, y: s32, width: s32) -> s32 {
|
||||
height := SectionTitleHeight(title, width)
|
||||
strong: [1]TextRange
|
||||
strong[0] = TextRange.{.start = 0, .end = cast(s32)title.count}
|
||||
Text(shop.session, TextProps.{
|
||||
strong: [1]Text.Range
|
||||
strong[0] = Text.Range.{.start = 0, .end = cast(s32)title.count}
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(x, y, width, height), .text = title,
|
||||
.font = shop.font + Scale(2), .strong = strong[:],
|
||||
.size = shop.font + Scale(2), .strong = strong[:],
|
||||
.semantic_kind = cast(SemanticKind)SemanticHeading, .heading_level = 2,
|
||||
.wrap = cast(TextWrap)TextWrapAuto})
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
return height
|
||||
}
|
||||
|
||||
@@ -591,8 +637,7 @@ RewardStacked :: (reward: HabitsShopReward, width: s32) -> bool {
|
||||
return width - Scale(94) - price_w - RewardBuyWidth() < Scale(100)
|
||||
}
|
||||
|
||||
RewardRowHeight :: (index: s32, width: s32) -> s32 {
|
||||
reward := ReadHabitRewardHost(index)
|
||||
RewardMainHeight :: (reward: HabitsShopReward, width: s32) -> s32 {
|
||||
if !RewardStacked(reward, width) {
|
||||
return Scale(SHOP_ROW_HEIGHT)
|
||||
}
|
||||
@@ -603,9 +648,15 @@ RewardRowHeight :: (index: s32, width: s32) -> s32 {
|
||||
return name_h + Scale(SHOP_CARD_PADDING) * 2 + Scale(48)
|
||||
}
|
||||
|
||||
RewardRowHeight :: (index: s32, width: s32) -> s32 {
|
||||
reward := ReadHabitRewardHost(index)
|
||||
return RewardMainHeight(reward, width)
|
||||
}
|
||||
|
||||
RewardRow :: (index: s32, x: s32, y: s32, width: s32) -> s32 {
|
||||
reward := ReadHabitRewardHost(index)
|
||||
height := RewardRowHeight(index, width)
|
||||
main_height := RewardMainHeight(reward, width)
|
||||
stacked := RewardStacked(reward, width)
|
||||
Card(Bounds(x, y, width, height), ifx index == 0 then "inbe/habits/shop/first-reward" else "")
|
||||
pad := Scale(SHOP_CARD_PADDING)
|
||||
@@ -619,23 +670,21 @@ RewardRow :: (index: s32, x: s32, y: s32, width: s32) -> s32 {
|
||||
name_x := x + pad + symbol + Scale(12)
|
||||
name_w := ifx stacked then x + width - pad - name_x else price_x - name_x - Scale(10)
|
||||
name_y := ifx stacked then y + pad else y
|
||||
name_h := ifx stacked then height - pad * 2 - Scale(48) else height
|
||||
if Button(shop.session, ButtonProps.{
|
||||
name_h := ifx stacked then main_height - pad * 2 - Scale(48) else main_height
|
||||
if Button.Draw(shop.session, Button.Props.{
|
||||
.id = 8500 + index,
|
||||
.bounds = Bounds(x, name_y, ifx stacked then width else price_x - x, name_h),
|
||||
.invisible = true, .label = reward.name,
|
||||
.disabled = shop.modal_active}) != 0 {
|
||||
FormEdit(reward)
|
||||
}
|
||||
SvgIcon(shop.session, SvgIconProps.{
|
||||
.bounds = Bounds(x + pad, name_y + (name_h - symbol) / 2, symbol, symbol),
|
||||
.shape = HabitIconShape(HabitRewardIconClamp(reward.icon)),
|
||||
.color = shop.text_color})
|
||||
Text(shop.session, TextProps.{
|
||||
RewardSymbol(HabitRewardIconClamp(reward.icon),
|
||||
Bounds(x + pad, name_y + (name_h - symbol) / 2, symbol, symbol))
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(name_x, name_y, name_w, name_h), .text = reward.name,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)(ifx stacked then TextWrapAuto else TextWrapEllipsis)})
|
||||
controls_y := ifx stacked then y + height - pad - Scale(40) else y + (height - Scale(40)) / 2
|
||||
.wrap = cast(Text.Wrap)(ifx stacked then TextWrapAuto else TextWrapEllipsis)})
|
||||
controls_y := ifx stacked then y + main_height - pad - Scale(40) else y + (main_height - Scale(40)) / 2
|
||||
CoinAmount(price, Bounds(price_x, controls_y, price_w, Scale(40)), shop.font)
|
||||
affordable := shop.halves + cast(s64)shop.borrow_limit * 2 >=
|
||||
cast(s64)reward.price * 2
|
||||
@@ -652,6 +701,7 @@ RewardRow :: (index: s32, x: s32, y: s32, width: s32) -> s32 {
|
||||
return height
|
||||
}
|
||||
|
||||
// The height of the open grid of symbols, one for each habit icon.
|
||||
IconColumns :: (width: s32) -> s32 {
|
||||
columns := width / Scale(SHOP_ICON_STEP_X)
|
||||
if columns < 1 {
|
||||
@@ -660,19 +710,19 @@ IconColumns :: (width: s32) -> s32 {
|
||||
return columns
|
||||
}
|
||||
|
||||
// The height of the open grid of symbols, one for each habit icon.
|
||||
IconGridHeight :: (width: s32) -> s32 {
|
||||
columns := IconColumns(width)
|
||||
rows := (HABIT_ICON_COUNT + columns - 1) / columns
|
||||
rows := (REWARD_ICON_COUNT + columns - 1) / columns
|
||||
return rows * Scale(SHOP_ICON_STEP_Y)
|
||||
}
|
||||
|
||||
// The reward's symbol before its name. A tap opens the grid of symbols
|
||||
// under the name, or closes it again.
|
||||
IconButton :: (bounds: Rectangle) {
|
||||
if Button(shop.session, ButtonProps.{
|
||||
if Button.Draw(shop.session, Button.Props.{
|
||||
.id = 8425, .bounds = bounds, .label = Locale("habit_icon_label"),
|
||||
.icon_shape = HabitIconShape(shop.icon), .icon_only = true,
|
||||
.icon_shape = ifx RewardIconAsset(shop.icon).count > 0 then "" else RewardIconShape(shop.icon),
|
||||
.image = RewardImage(shop.icon), .icon_only = true,
|
||||
.selected = shop.icon_open, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)(ifx shop.icon_open then
|
||||
ButtonEmphasisOutline else ButtonEmphasisSoft),
|
||||
@@ -688,16 +738,18 @@ IconButton :: (bounds: Rectangle) {
|
||||
IconGrid :: (x: s32, y: s32, width: s32) {
|
||||
columns := IconColumns(width)
|
||||
icon: s32 = 1
|
||||
while icon <= HABIT_ICON_COUNT {
|
||||
while icon <= REWARD_ICON_COUNT {
|
||||
index := icon - 1
|
||||
selected := shop.icon == icon
|
||||
if Button(shop.session, ButtonProps.{
|
||||
if Button.Draw(shop.session, Button.Props.{
|
||||
.id = 8700 + icon,
|
||||
.bounds = Bounds(x + (index % columns) * Scale(SHOP_ICON_STEP_X) + Scale(4),
|
||||
y + (index / columns) * Scale(SHOP_ICON_STEP_Y) + Scale(2),
|
||||
Scale(SHOP_ICON_SIZE), Scale(SHOP_ICON_SIZE)),
|
||||
.circle = true,
|
||||
.icon_shape = HabitIconShape(icon), .icon_only = true, .selected = selected,
|
||||
.label = Locale(RewardIconLabelKey(icon)),
|
||||
.icon_shape = ifx RewardIconAsset(icon).count > 0 then "" else RewardIconShape(icon),
|
||||
.image = RewardImage(icon), .icon_only = true, .selected = selected,
|
||||
.tone = cast(ButtonTone)(ifx selected then ButtonToneAccent else ButtonToneNeutral),
|
||||
.emphasis = cast(ButtonEmphasis)(ifx selected then
|
||||
ButtonEmphasisFilled else ButtonEmphasisSoft),
|
||||
@@ -754,12 +806,12 @@ Form :: (x: s32, y: s32, width: s32) {
|
||||
inner_w := width - pad * 2
|
||||
row_y := y + pad
|
||||
title_text := Locale(ifx editing then "habit_shop_edit_title" else "habit_shop_add_title")
|
||||
strong: [1]TextRange
|
||||
strong[0] = TextRange.{.start = 0, .end = cast(s32)title_text.count}
|
||||
Text(shop.session, TextProps.{
|
||||
strong: [1]Text.Range
|
||||
strong[0] = Text.Range.{.start = 0, .end = cast(s32)title_text.count}
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(inner_x, row_y, inner_w, Scale(26)), .text = title_text,
|
||||
.strong = strong[:], .vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
row_y += Scale(30)
|
||||
field_h := Scale(SHOP_FIELD_HEIGHT)
|
||||
// The symbol, then the name.
|
||||
@@ -775,10 +827,10 @@ Form :: (x: s32, y: s32, width: s32) {
|
||||
// Price − [n] + with a coin, then Add or Save at the row's end.
|
||||
label := Locale("habit_shop_price_label")
|
||||
label_w := Width(label, shop.font) + Scale(10)
|
||||
Text(shop.session, TextProps.{
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(inner_x, row_y, label_w, field_h), .text = label,
|
||||
.class_name = shop.muted_class, .vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapNone})
|
||||
.wrap = cast(Text.Wrap)TextWrapNone})
|
||||
step := Scale(44)
|
||||
control_x := inner_x + label_w
|
||||
if ShopButton(8420, "-", Bounds(control_x, row_y, step, field_h),
|
||||
@@ -834,6 +886,32 @@ Form :: (x: s32, y: s32, width: s32) {
|
||||
}
|
||||
}
|
||||
|
||||
// Statistics remains reachable before the first purchase.
|
||||
ActivityHeaderHeight :: (width: s32) -> s32 {
|
||||
height := SectionTitleHeight(Locale("profile_progress_title"), width - Scale(52))
|
||||
return ifx height > Scale(44) then height else Scale(44)
|
||||
}
|
||||
|
||||
ActivityHeader :: (x: s32, y: s32, width: s32) -> s32 {
|
||||
height := ActivityHeaderHeight(width)
|
||||
unused SectionTitle(Locale("profile_progress_title"), x, y + (height -
|
||||
SectionTitleHeight(Locale("profile_progress_title"), width - Scale(52))) / 2,
|
||||
width - Scale(52))
|
||||
if Button.Draw(shop.session, Button.Props.{.id = 8430,
|
||||
.bounds = Bounds(x + width - Scale(44), y, Scale(44), Scale(44)),
|
||||
.label = Locale("habit_shop_stats_title"),
|
||||
.icon_shape = "S1.8rr:M4 3V20H21M7 15L11 10L15 13L20 6",
|
||||
.icon_only = true, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft,
|
||||
.disabled = shop.modal_active}) != 0 {
|
||||
shop.name_focused = false
|
||||
shop.price_focused = false
|
||||
shop.borrow_focused = false
|
||||
shop.action = HABITS_SHOP_STATS_OPEN
|
||||
}
|
||||
return height
|
||||
}
|
||||
|
||||
// Draws the shop in the frame's bounds.
|
||||
ShopPage :: () {
|
||||
bounds := shop.bounds
|
||||
@@ -866,18 +944,21 @@ ShopPage :: () {
|
||||
list_h = ParagraphHeight(empty_text, content_width, shop.font) + row_gap
|
||||
}
|
||||
form_h := FormHeight(content_width)
|
||||
activity_title := Locale("profile_progress_title")
|
||||
content_h := Scale(SHOP_BALANCE_HEIGHT) + Scale(10) + BorrowRowHeight() + gap +
|
||||
title_h + Scale(10) + list_h + gap + form_h + gap
|
||||
// Today's daily reward, to claim or claimed.
|
||||
if shop.daily_day > 0 {
|
||||
content_h += DailyCardHeight() + Scale(10)
|
||||
}
|
||||
// The latest coins earned and spent, once there are any.
|
||||
content_h += ActivityHeaderHeight(content_width) + Scale(6) + gap
|
||||
if shop.activity_count > 0 {
|
||||
content_h += SectionTitleHeight(activity_title, content_width) + Scale(6) + gap
|
||||
for index: cast(s32)0..shop.activity_count - 1 {
|
||||
content_h += ActivityRowHeight(index, content_width)
|
||||
}
|
||||
}
|
||||
scrolled := Scroll(shop.session, ScrollProps.{
|
||||
.key = KeyHash("inbe/habits/shop"),
|
||||
scrolled := Scroll.Draw(shop.session, Scroll.Props.{
|
||||
.key = Layout.KeyHash("inbe/habits/shop"),
|
||||
.bounds = Rectangle.{cast(float32)x, cast(float32)top, cast(float32)width,
|
||||
bounds.y + bounds.height - cast(float32)top},
|
||||
.content_height = content_h, .scroll_offset = shop.scroll})
|
||||
@@ -887,12 +968,15 @@ ShopPage :: () {
|
||||
}
|
||||
y := cast(s32)scrolled.content.y
|
||||
y += BalanceCard(x, y, content_width) + Scale(10)
|
||||
if shop.daily_day > 0 {
|
||||
y += DailyCard(x, y, content_width) + Scale(10)
|
||||
}
|
||||
y += BorrowRow(x, y, content_width) + gap
|
||||
y += SectionTitle(rewards_title, x, y, content_width) + Scale(10)
|
||||
if shop.reward_count == 0 {
|
||||
Text(shop.session, TextProps.{
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(x, y, content_width, list_h - row_gap), .text = empty_text,
|
||||
.class_name = shop.muted_class, .wrap = cast(TextWrap)TextWrapAuto})
|
||||
.class_name = shop.muted_class, .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
}
|
||||
reward_y := y
|
||||
index: s32 = 0
|
||||
@@ -904,8 +988,8 @@ ShopPage :: () {
|
||||
Form(x, y, content_width)
|
||||
y += form_h + gap
|
||||
// Activity sits below the form that adds a reward.
|
||||
y += ActivityHeader(x, y, content_width) + Scale(6)
|
||||
if shop.activity_count > 0 {
|
||||
y += SectionTitle(activity_title, x, y, content_width) + Scale(6)
|
||||
for index: cast(s32)0..shop.activity_count - 1 {
|
||||
y += ActivityRow(index, x, y, content_width)
|
||||
}
|
||||
@@ -921,8 +1005,8 @@ BuyDialog :: () {
|
||||
if width > Scale(380) {
|
||||
width = Scale(380)
|
||||
}
|
||||
frame := ModalFrame(shop.session, ModalFrameProps.{
|
||||
.key = KeyHash("inbe/habits/shop/buy"),
|
||||
frame := Modal.Draw(shop.session, Modal.Props.{
|
||||
.key = Layout.KeyHash("inbe/habits/shop/buy"),
|
||||
.title = Locale("habit_shop_buy_title"),
|
||||
.width = width, .height = Scale(250), .scale = shop.scale})
|
||||
if frame.dismissed {
|
||||
@@ -937,33 +1021,31 @@ BuyDialog :: () {
|
||||
y := cast(s32)content.y
|
||||
inner_w := cast(s32)content.width
|
||||
symbol := Scale(30)
|
||||
SvgIcon(shop.session, SvgIconProps.{.bounds = Bounds(x, y, symbol, symbol),
|
||||
.shape = HabitIconShape(HabitRewardIconClamp(reward.icon)),
|
||||
.color = shop.text_color})
|
||||
strong: [1]TextRange
|
||||
strong[0] = TextRange.{.start = 0, .end = cast(s32)reward.name.count}
|
||||
Text(shop.session, TextProps.{
|
||||
RewardSymbol(HabitRewardIconClamp(reward.icon), Bounds(x, y, symbol, symbol))
|
||||
strong: [1]Text.Range
|
||||
strong[0] = Text.Range.{.start = 0, .end = cast(s32)reward.name.count}
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(x + symbol + Scale(10), y, inner_w - symbol - Scale(10), Scale(30)),
|
||||
.text = reward.name, .strong = strong[:],
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
y += Scale(34)
|
||||
CoinAmount(Number(cast(s64)reward.price), Bounds(x, y, inner_w, Scale(30)),
|
||||
shop.font + Scale(4))
|
||||
y += Scale(36)
|
||||
left := shop.halves - cast(s64)reward.price * 2
|
||||
Text(shop.session, TextProps.{
|
||||
Text.Draw(shop.session, Text.Props.{
|
||||
.bounds = Bounds(x, y, inner_w, Scale(24)),
|
||||
.text = Filled(Locale("habit_shop_buy_left"), Coins(left)),
|
||||
.font = shop.small_font, .class_name = shop.muted_class,
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.size = shop.small_font, .class_name = shop.muted_class,
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
button_y := cast(s32)(content.y + content.height) - Scale(44)
|
||||
half := (inner_w - Scale(10)) / 2
|
||||
cancelled := Button(shop.session, ButtonProps.{
|
||||
cancelled := Button.Draw(shop.session, Button.Props.{
|
||||
.id = 8430, .bounds = Bounds(x, button_y, half, Scale(42)),
|
||||
.label = Locale("cancel_button"), .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisOutline, .fit_content = true}) != 0
|
||||
bought := Button(shop.session, ButtonProps.{
|
||||
bought := Button.Draw(shop.session, Button.Props.{
|
||||
.id = 8431, .bounds = Bounds(x + half + Scale(10), button_y, half, Scale(42)),
|
||||
.label = Locale("habit_shop_buy_button"), .tone = cast(ButtonTone)ButtonToneAccent,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled, .fit_content = true,
|
||||
|
||||
@@ -1,5 +1,39 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Backspace and text corrections work again. Restore backups and add photos reliably.
|
||||
- Read Tao Te Ching art on its own page. Find Photos and Radio in Apps, with clearer feedback and appearance controls.
|
||||
- Desktop controls respond, translations keep clean line breaks, and account sync is called Mesh.
|
||||
- Start the Chromium extension when opened and reuse tabs for repeated opens of the same page.
|
||||
- Free the Chromium extension's WebAssembly memory when an idle Practices or Habits tab loses focus, and load it again on return.
|
||||
|
||||
- Use one modern appearance and a simpler About list with Core and app versions.
|
||||
|
||||
## [2.1.64] - 2026-11-05
|
||||
|
||||
- Bring Lumi 1.5.29, Habits 1.3.17, Practices 1.6.11, Lists 1.1.30, Diary 1.3.27 and Leaderboard 1.0.31 for Inner Breeze 2.1.63.
|
||||
|
||||
## [2.1.63] - 2026-11-02
|
||||
|
||||
- Bring Lumi 1.5.28, Habits 1.3.16, Practices 1.6.10, Lists 1.1.29, Diary 1.3.26 and Leaderboard 1.0.30 for Inner Breeze 2.1.62.
|
||||
|
||||
## [2.1.62] - 2026-10-29
|
||||
|
||||
- Bring Lumi 1.5.27, Habits 1.3.15, Practices 1.6.9, Lists 1.1.28, Diary 1.3.25 and Leaderboard 1.0.29 for Inner Breeze 2.1.61.
|
||||
|
||||
## [2.1.61] - 2026-10-29
|
||||
|
||||
- Bring Lumi 1.5.26, Habits 1.3.14, Practices 1.6.8, Lists 1.1.27, Diary 1.3.24 and Leaderboard 1.0.28 for Inner Breeze 2.1.60.
|
||||
|
||||
## [2.1.60] - 2026-10-28
|
||||
|
||||
- Bring Lumi 1.5.25, Habits 1.3.13, Practices 1.6.7, Lists 1.1.26, Diary 1.3.23 and Leaderboard 1.0.27 for Inner Breeze 2.1.59.
|
||||
|
||||
## [2.1.59] - 2026-10-28
|
||||
|
||||
- Bring Lumi 1.5.24, Habits 1.3.12, Practices 1.6.6, Lists 1.1.25, Diary 1.3.22 and Leaderboard 1.0.26 for Inner Breeze 2.1.58.
|
||||
|
||||
## [2.1.58] - 2026-10-28
|
||||
|
||||
- Bring Diary’s separate day gallery and attachment toolbar.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_self_active_1_title": "Profil diri · 1 hari",
|
||||
"achievement_self_active_1_description": "Lakukan ini pada 1 tanggal berbeda: aktivitas bermakna yang disimpan.",
|
||||
"achievement_self_active_3_title": "Profil diri · 3 hari",
|
||||
"achievement_self_active_3_description": "Lakukan ini pada 3 tanggal berbeda: aktivitas bermakna yang disimpan.",
|
||||
"achievement_self_active_7_title": "Profil diri · 7 hari",
|
||||
"achievement_self_active_7_description": "Lakukan ini pada 7 tanggal berbeda: aktivitas bermakna yang disimpan.",
|
||||
"achievement_self_active_14_title": "Profil diri · 14 hari",
|
||||
"achievement_self_active_14_description": "Lakukan ini pada 14 tanggal berbeda: aktivitas bermakna yang disimpan.",
|
||||
"achievement_self_active_30_title": "Profil diri · 30 hari",
|
||||
"achievement_self_active_30_description": "Lakukan ini pada 30 tanggal berbeda: aktivitas bermakna yang disimpan.",
|
||||
"achievement_self_active_60_title": "Profil diri · 60 hari",
|
||||
"achievement_self_active_60_description": "Lakukan ini pada 60 tanggal berbeda: aktivitas bermakna yang disimpan.",
|
||||
"achievement_self_active_100_title": "Profil diri · 100 hari",
|
||||
"achievement_self_active_100_description": "Lakukan ini pada 100 tanggal berbeda: aktivitas bermakna yang disimpan.",
|
||||
"achievement_self_active_180_title": "Profil diri · 180 hari",
|
||||
"achievement_self_active_180_description": "Lakukan ini pada 180 tanggal berbeda: aktivitas bermakna yang disimpan.",
|
||||
"achievement_self_active_365_title": "Profil diri · 365 hari",
|
||||
"achievement_self_active_365_description": "Lakukan ini pada 365 tanggal berbeda: aktivitas bermakna yang disimpan.",
|
||||
"achievement_self_return_14_title": "Profil diri · 14 hari jeda",
|
||||
"achievement_self_return_14_description": "Kembali setelah setidaknya 14 hari penuh tanpa aktivitas ini: aktivitas bermakna yang disimpan."
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_self_active_1_title": "Profilo personale · 1 giorni",
|
||||
"achievement_self_active_1_description": "Fallo in 1 date distinte: un’attività significativa salvata.",
|
||||
"achievement_self_active_3_title": "Profilo personale · 3 giorni",
|
||||
"achievement_self_active_3_description": "Fallo in 3 date distinte: un’attività significativa salvata.",
|
||||
"achievement_self_active_7_title": "Profilo personale · 7 giorni",
|
||||
"achievement_self_active_7_description": "Fallo in 7 date distinte: un’attività significativa salvata.",
|
||||
"achievement_self_active_14_title": "Profilo personale · 14 giorni",
|
||||
"achievement_self_active_14_description": "Fallo in 14 date distinte: un’attività significativa salvata.",
|
||||
"achievement_self_active_30_title": "Profilo personale · 30 giorni",
|
||||
"achievement_self_active_30_description": "Fallo in 30 date distinte: un’attività significativa salvata.",
|
||||
"achievement_self_active_60_title": "Profilo personale · 60 giorni",
|
||||
"achievement_self_active_60_description": "Fallo in 60 date distinte: un’attività significativa salvata.",
|
||||
"achievement_self_active_100_title": "Profilo personale · 100 giorni",
|
||||
"achievement_self_active_100_description": "Fallo in 100 date distinte: un’attività significativa salvata.",
|
||||
"achievement_self_active_180_title": "Profilo personale · 180 giorni",
|
||||
"achievement_self_active_180_description": "Fallo in 180 date distinte: un’attività significativa salvata.",
|
||||
"achievement_self_active_365_title": "Profilo personale · 365 giorni",
|
||||
"achievement_self_active_365_description": "Fallo in 365 date distinte: un’attività significativa salvata.",
|
||||
"achievement_self_return_14_title": "Profilo personale · 14 giorni di pausa",
|
||||
"achievement_self_return_14_description": "Ritorna dopo almeno 14 giorni interi senza questa attività: un’attività significativa salvata."
|
||||
}
|
||||
+24
-28
@@ -1,17 +1,13 @@
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "checkbox_props"
|
||||
#import "checkbox_widget"
|
||||
Button :: #import "kryon/button";
|
||||
Checkbox :: #import "kryon/checkbox";
|
||||
Layout :: #import "kryon/layout";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
Text :: #import "kryon/text";
|
||||
Toggle :: #import "kryon/toggle";
|
||||
#import "kryon/system_clipboard"
|
||||
#import "geometry"
|
||||
#import "layout"
|
||||
#import "text_props"
|
||||
#import "text_widget"
|
||||
#import "control_props"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "tree"
|
||||
#import "toggle_props"
|
||||
#import "toggle_widget"
|
||||
#import "kryon/tree"
|
||||
#import, file "../../src/apps/inbe_types.zi";
|
||||
#import, file "../../src/apps/inbe_ui_types.zi";
|
||||
using ButtonTone;
|
||||
@@ -49,7 +45,7 @@ FinishPicker :: () -> InbeMessage {
|
||||
InbePickerView :: (message: InbeMessage) -> InbeMessage {
|
||||
frame = ReadPickerUiHost()
|
||||
state = message
|
||||
column := CenteredColumnFor(frame.width, Scale(420), Scale(16))
|
||||
column := Layout.CenteredColumnFor(frame.width, Scale(420), Scale(16))
|
||||
top := Scale(20)
|
||||
compact := frame.height < Scale(480)
|
||||
scroll_top := ifx compact then Scale(104) else Scale(156)
|
||||
@@ -59,15 +55,15 @@ InbePickerView :: (message: InbeMessage) -> InbeMessage {
|
||||
content_height += Scale(16)
|
||||
}
|
||||
}
|
||||
Text(frame.session, TextProps.{
|
||||
Text.Draw(frame.session, Text.Props.{
|
||||
.bounds = Rectangle.{cast(float32)column.x, cast(float32)top,
|
||||
cast(float32)column.width, cast(float32)(ifx compact then Scale(28) else Scale(40))},
|
||||
.text = PickerLocaleHost("cells_picker_title"), .font = Scale(24)})
|
||||
Text(frame.session, TextProps.{
|
||||
.text = PickerLocaleHost("cells_picker_title"), .size = Scale(24)})
|
||||
Text.Draw(frame.session, Text.Props.{
|
||||
.bounds = Rectangle.{cast(float32)column.x, cast(float32)(top + (ifx compact then Scale(32) else Scale(48))),
|
||||
cast(float32)column.width, cast(float32)(ifx compact then Scale(44) else Scale(84))},
|
||||
.text = PickerLocaleHost("cells_picker_body"), .font = frame.font})
|
||||
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)27000,
|
||||
.text = PickerLocaleHost("cells_picker_body"), .size = frame.font})
|
||||
scroll := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)27000,
|
||||
.bounds = Rectangle.{cast(float32)column.x, cast(float32)scroll_top,
|
||||
cast(float32)column.width, cast(float32)(frame.height - scroll_top - Scale(80))},
|
||||
.content_height = content_height, .scroll_offset = frame.scroll})
|
||||
@@ -83,15 +79,15 @@ InbePickerView :: (message: InbeMessage) -> InbeMessage {
|
||||
index: s32 = 0
|
||||
while index < 5 {
|
||||
if index == 0 || index == 3 {
|
||||
Text(frame.session, TextProps.{.bounds = Rectangle.{cast(float32)column.x,
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Rectangle.{cast(float32)column.x,
|
||||
cast(float32)row_top, cast(float32)content_width, cast(float32)Scale(36)},
|
||||
.text = PickerLocaleHost(ifx index == 0 then "cells_recommended" else "cells_optional"),
|
||||
.font = frame.font})
|
||||
.size = frame.font})
|
||||
row_top += Scale(40)
|
||||
}
|
||||
package := packages[index]
|
||||
bit := Bit(package)
|
||||
checkbox := Checkbox(frame.session, CheckboxProps.{
|
||||
checkbox := Checkbox.Draw(frame.session, Checkbox.Props.{
|
||||
.id = ifx package == 5 then 278 else 270 + package - 1,
|
||||
.bounds = Rectangle.{cast(float32)column.x,
|
||||
cast(float32)row_top,
|
||||
@@ -117,19 +113,19 @@ InbePickerView :: (message: InbeMessage) -> InbeMessage {
|
||||
else if status == 4 {
|
||||
key = "cells_signing_setup"
|
||||
}
|
||||
Text(frame.session, TextProps.{.bounds = Rectangle.{cast(float32)(column.x + Scale(32)),
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Rectangle.{cast(float32)(column.x + Scale(32)),
|
||||
cast(float32)row_top, cast(float32)(content_width - Scale(32)),
|
||||
cast(float32)(ifx status >= 3 then Scale(44) else Scale(28))},
|
||||
.text = PickerLocaleHost(key), .font = Scale(14)})
|
||||
.text = PickerLocaleHost(key), .size = Scale(14)})
|
||||
row_top += ifx status >= 3 then Scale(44) else Scale(28)
|
||||
}
|
||||
index += 1
|
||||
}
|
||||
Text(frame.session, TextProps.{
|
||||
Text.Draw(frame.session, Text.Props.{
|
||||
.bounds = Rectangle.{cast(float32)column.x, cast(float32)(row_top + Scale(12)),
|
||||
cast(float32)(content_width - Scale(80)), cast(float32)Scale(44)},
|
||||
.text = PickerLocaleHost("cells_auto_update"), .font = frame.font})
|
||||
automatic := Toggle(frame.session, ToggleProps.{.id = 276,
|
||||
.text = PickerLocaleHost("cells_auto_update"), .size = frame.font})
|
||||
automatic := Toggle.Draw(frame.session, Toggle.Props.{.id = 276,
|
||||
.bounds = Rectangle.{cast(float32)(column.x + content_width - Scale(64)),
|
||||
cast(float32)(row_top + Scale(12)), cast(float32)Scale(64), cast(float32)Scale(44)},
|
||||
.label = PickerLocaleHost("cells_auto_update"), .value = frame.automatic})
|
||||
@@ -137,7 +133,7 @@ InbePickerView :: (message: InbeMessage) -> InbeMessage {
|
||||
frame.automatic = automatic.value
|
||||
}
|
||||
row_top += Scale(64)
|
||||
if Button(frame.session, ButtonProps.{.id = 277,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 277,
|
||||
.bounds = Rectangle.{cast(float32)column.x, cast(float32)row_top,
|
||||
cast(float32)content_width, cast(float32)Scale(44)},
|
||||
.label = PickerLocaleHost("cells_check_updates"),
|
||||
@@ -146,7 +142,7 @@ InbePickerView :: (message: InbeMessage) -> InbeMessage {
|
||||
frame.check_updates = true
|
||||
}
|
||||
End(frame.session)
|
||||
if Button(frame.session, ButtonProps.{.id = 274,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 274,
|
||||
.bounds = Rectangle.{cast(float32)column.x,
|
||||
cast(float32)(frame.height - Scale(64)), cast(float32)column.width,
|
||||
cast(float32)Scale(44)},
|
||||
|
||||
@@ -1,5 +1,29 @@
|
||||
# Changelog
|
||||
|
||||
## [1.0.31] - 2026-11-05
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.63.
|
||||
|
||||
## [1.0.30] - 2026-11-02
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.62.
|
||||
|
||||
## [1.0.29] - 2026-10-29
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.61.
|
||||
|
||||
## [1.0.28] - 2026-10-29
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.60.
|
||||
|
||||
## [1.0.27] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.59.
|
||||
|
||||
## [1.0.26] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.58.
|
||||
|
||||
## [1.0.25] - 2026-10-28
|
||||
|
||||
- Open the shared Profile leaderboard with practice, puzzle and Apfelwurm score and level rankings.
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"achievement_leaderboard_check_days_1_title": "Papan peringkat · 1 hari",
|
||||
"achievement_leaderboard_check_days_1_description": "Lakukan ini pada 1 tanggal berbeda: hasil Anda sendiri dilihat di papan peringkat.",
|
||||
"achievement_leaderboard_check_days_3_title": "Papan peringkat · 3 hari",
|
||||
"achievement_leaderboard_check_days_3_description": "Lakukan ini pada 3 tanggal berbeda: hasil Anda sendiri dilihat di papan peringkat.",
|
||||
"achievement_leaderboard_check_days_7_title": "Papan peringkat · 7 hari",
|
||||
"achievement_leaderboard_check_days_7_description": "Lakukan ini pada 7 tanggal berbeda: hasil Anda sendiri dilihat di papan peringkat.",
|
||||
"achievement_leaderboard_check_days_30_title": "Papan peringkat · 30 hari",
|
||||
"achievement_leaderboard_check_days_30_description": "Lakukan ini pada 30 tanggal berbeda: hasil Anda sendiri dilihat di papan peringkat.",
|
||||
"achievement_leaderboard_practices_2_title": "Papan peringkat · 2 item berbeda",
|
||||
"achievement_leaderboard_practices_2_description": "Capai 2 item berbeda melalui tindakan ini: hasil Anda sendiri dilihat di papan peringkat."
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"achievement_leaderboard_check_days_1_title": "Classifica · 1 giorni",
|
||||
"achievement_leaderboard_check_days_1_description": "Fallo in 1 date distinte: il tuo risultato consultato nella classifica.",
|
||||
"achievement_leaderboard_check_days_3_title": "Classifica · 3 giorni",
|
||||
"achievement_leaderboard_check_days_3_description": "Fallo in 3 date distinte: il tuo risultato consultato nella classifica.",
|
||||
"achievement_leaderboard_check_days_7_title": "Classifica · 7 giorni",
|
||||
"achievement_leaderboard_check_days_7_description": "Fallo in 7 date distinte: il tuo risultato consultato nella classifica.",
|
||||
"achievement_leaderboard_check_days_30_title": "Classifica · 30 giorni",
|
||||
"achievement_leaderboard_check_days_30_description": "Fallo in 30 date distinte: il tuo risultato consultato nella classifica.",
|
||||
"achievement_leaderboard_practices_2_title": "Classifica · 2 elementi distinti",
|
||||
"achievement_leaderboard_practices_2_description": "Raggiungi 2 elementi distinti tramite questa azione: il tuo risultato consultato nella classifica."
|
||||
}
|
||||
@@ -1,5 +1,22 @@
|
||||
# Library
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [1.0.7] - 2026-11-17
|
||||
|
||||
- Rebuilt on Apps with the Python 3.10 packaging fix; no user-visible change.
|
||||
|
||||
## [1.0.6] - 2026-11-16
|
||||
|
||||
- Reopen the exact picture or text page where you stopped reading.
|
||||
- Download and open on the current Inner Breeze.
|
||||
- Read all 81 Tao Te Ching chapters with artwork on by default; show or hide images from the top toolbar while keeping your reading position.
|
||||
- Show chapter titles without numbers; with images on, each chapter opens on a page of its own with the illustration and title centered.
|
||||
|
||||
## [1.0.5] - 2026-10-29
|
||||
|
||||
- Download on Inner Breeze 2.1.61, which runs apps in a smaller format.
|
||||
|
||||
## [1.0.4] - 2026-10-24
|
||||
|
||||
- Browse books on wooden shelves, with the title and author on the cover.
|
||||
|
||||
+24
-6
@@ -6,10 +6,13 @@ BOOK_COUNT :: 1
|
||||
LIBRARY_PAGE_LIMIT :: 4096
|
||||
LIBRARY_ANNOTATION_LIMIT :: 128
|
||||
|
||||
// A picture page holds only the chapter illustration and title; its text
|
||||
// range is empty, so annotations never land on it.
|
||||
LibraryPage :: struct {
|
||||
chapter: s32
|
||||
start: s32
|
||||
end: s32
|
||||
picture: bool
|
||||
}
|
||||
|
||||
LibraryAnnotation :: struct {
|
||||
@@ -45,6 +48,11 @@ BookPositionRecord :: (index: s32) -> string {
|
||||
return "tao-te-ching.position"
|
||||
}
|
||||
|
||||
BookModeRecord :: (index: s32) -> string {
|
||||
unused index
|
||||
return "tao-te-ching.mode"
|
||||
}
|
||||
|
||||
BookAnnotationsRecord :: (index: s32, chapter: s32) -> string {
|
||||
unused index
|
||||
value: Vec(u8)
|
||||
@@ -67,15 +75,20 @@ BookChapterTitle :: (index: s32, number: s32) -> string {
|
||||
return TaoTeChingChapterTitle(number)
|
||||
}
|
||||
|
||||
LibraryChapterLabel :: (number: s32, title: string) -> string {
|
||||
value: Vec(u8)
|
||||
BuilderPrint(*value, "%", number)
|
||||
if title != "" {
|
||||
BuilderPrint(*value, " · %", title)
|
||||
BookChapterArt :: (index: s32, number: s32) -> string {
|
||||
if !BookChapterArtApproved(index) || number < 1 || number > BookChapters(index) {
|
||||
return ""
|
||||
}
|
||||
value: Vec(u8)
|
||||
BuilderPrint(*value, "assets/library/tao-te-ching/chapter-%.avif", number)
|
||||
return BuilderFinish(value)
|
||||
}
|
||||
|
||||
BookChapterArtApproved :: (index: s32) -> bool {
|
||||
// The owner approved this complete 81-chapter selection.
|
||||
return index == 0
|
||||
}
|
||||
|
||||
// Decimal fields are bounded and separated by one non-digit byte.
|
||||
ReadLibraryNumber :: (text: string, at: *s32) -> s32 {
|
||||
value: s32
|
||||
@@ -91,10 +104,15 @@ ReadLibraryNumber :: (text: string, at: *s32) -> s32 {
|
||||
return value
|
||||
}
|
||||
|
||||
LibraryPageFor :: (pages: []LibraryPage, chapter: s32, offset: s32) -> s32 {
|
||||
// A chapter's picture page and its first text page both start at offset 0.
|
||||
// The picture page is chosen only when asked for; otherwise the text page wins.
|
||||
LibraryPageFor :: (pages: []LibraryPage, chapter: s32, offset: s32, picture: bool) -> s32 {
|
||||
found: s32
|
||||
for index: cast(s32)0..cast(s32)pages.count - 1 {
|
||||
page := pages[index]
|
||||
if picture && page.picture && page.chapter == chapter {
|
||||
return index
|
||||
}
|
||||
if page.chapter < chapter || (page.chapter == chapter && page.start <= offset) {
|
||||
found = index
|
||||
}
|
||||
|
||||
+190
-129
@@ -3,37 +3,29 @@
|
||||
#import "geometry"
|
||||
#import "vec"
|
||||
#import "text_buffer"
|
||||
#import "text_props"
|
||||
#import "text_widget"
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Dropdown :: #import "kryon/dropdown";
|
||||
Image :: #import "kryon/image";
|
||||
Press :: #import "kryon/press";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
Spinbox :: #import "kryon/spinbox";
|
||||
Text :: #import "kryon/text";
|
||||
TextArea :: #import "kryon/text_area";
|
||||
TextField :: #import "kryon/text_field";
|
||||
Toggle :: #import "kryon/toggle";
|
||||
#import "text_measure"
|
||||
#import "text_align"
|
||||
#import "image_props"
|
||||
#import "image_widget"
|
||||
#import "grid"
|
||||
#import "grid_props"
|
||||
#import "press_props"
|
||||
#import "press_widget"
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "tree"
|
||||
#import "kryon/tree"
|
||||
#import "pointer_input"
|
||||
#import "swipe"
|
||||
#import "swipe_props"
|
||||
#import "input_protocol"
|
||||
#import "drawing_props"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "spinbox_props"
|
||||
#import "spinbox_widget"
|
||||
#import "dropdown_props"
|
||||
#import "dropdown_widget"
|
||||
#import "toggle_props"
|
||||
#import "toggle_widget"
|
||||
#import "text_input_props"
|
||||
#import "text_area_widget"
|
||||
#import "kryon/transition"
|
||||
#import "widget_palette"
|
||||
#import "icon"
|
||||
#import "transition"
|
||||
@@ -51,11 +43,11 @@ AppLocaleHost :: (key: string) -> string #foreign host_api;
|
||||
AppRecordHost :: (record: string) -> string #foreign host_api;
|
||||
SaveAppRecordHost :: (record: string, value: string) -> bool #foreign host_api;
|
||||
AppKeyHost :: () -> s32 #foreign host_api;
|
||||
AppFieldInputHost :: () -> TextFieldInput #foreign host_api;
|
||||
AppFieldInputHost :: () -> TextField.Input #foreign host_api;
|
||||
CloseAppHost :: () -> bool #foreign host_api;
|
||||
SmoothFramesHost :: (frames: s32) -> bool #foreign host_api;
|
||||
|
||||
using TextWrap;
|
||||
using Text.Wrap;
|
||||
using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
using TextAlign;
|
||||
@@ -71,6 +63,7 @@ page_count: s32;
|
||||
page_index: s32;
|
||||
anchor_chapter: s32 = 1;
|
||||
anchor_offset: s32;
|
||||
anchor_picture: bool;
|
||||
layout_width: s32;
|
||||
layout_height: s32;
|
||||
layout_scale: float32;
|
||||
@@ -90,10 +83,11 @@ annotation_count: s32;
|
||||
annotation_index: s32 = -1;
|
||||
annotation_dirty: bool;
|
||||
note: [2049]u8;
|
||||
note_state: TextAreaResult;
|
||||
passage_state: TextAreaResult;
|
||||
note_state: TextArea.Result;
|
||||
passage_state: TextArea.Result;
|
||||
reader_swipe: SwipeGesture;
|
||||
book_dark: bool;
|
||||
picture_book: bool;
|
||||
opening_started: float64;
|
||||
opening: bool;
|
||||
opening_from: Rectangle;
|
||||
@@ -124,6 +118,7 @@ SaveSettings :: () -> bool {
|
||||
BuilderPrint(*value, "% % % %", font_size, font_face, margin, line_gap)
|
||||
if !SaveAppRecordHost("reader.settings", BuilderFinish(value)) { return false }
|
||||
if !SaveAppRecordHost("tao-te-ching.theme", ifx book_dark then "1" else "0") { return false }
|
||||
if !SaveAppRecordHost(BookModeRecord(book), ifx picture_book then "1" else "0") { return false }
|
||||
settings_dirty = false
|
||||
return true
|
||||
}
|
||||
@@ -131,7 +126,8 @@ SaveSettings :: () -> bool {
|
||||
SavePosition :: () -> bool {
|
||||
if !position_dirty { return true }
|
||||
value: Vec(u8)
|
||||
BuilderPrint(*value, "% %", anchor_chapter, anchor_offset)
|
||||
BuilderPrint(*value, "% % %", anchor_chapter, anchor_offset,
|
||||
ifx anchor_picture then 1 else 0)
|
||||
if !SaveAppRecordHost(BookPositionRecord(book), BuilderFinish(value)) { return false }
|
||||
position_dirty = false
|
||||
return true
|
||||
@@ -164,6 +160,7 @@ LoadSettings :: () {
|
||||
margin = 24
|
||||
line_gap = 8
|
||||
book_dark = RecordNumber("tao-te-ching.theme", ifx frame.dark then 1 else 0, 0, 1) == 1
|
||||
picture_book = RecordNumber(BookModeRecord(0), 1, 0, 1) == 1
|
||||
text := AppRecordHost("reader.settings")
|
||||
at: s32
|
||||
size := ReadLibraryNumber(text, *at)
|
||||
@@ -176,7 +173,7 @@ LoadSettings :: () {
|
||||
if gap >= 2 && gap <= 20 { line_gap = gap }
|
||||
}
|
||||
|
||||
ReadingBounds :: () -> Rectangle {
|
||||
ReaderAreaBounds :: () -> Rectangle {
|
||||
width := frame.width - Scale(margin * 2)
|
||||
if width > Scale(680) { width = Scale(680) }
|
||||
top := frame.top + Scale(16)
|
||||
@@ -184,29 +181,58 @@ ReadingBounds :: () -> Rectangle {
|
||||
return Bounds((frame.width - width) / 2, top, width, height)
|
||||
}
|
||||
|
||||
ChapterHeadingProps :: (chapter: s32) -> TextProps {
|
||||
props := TextProps.{.key = 27501,
|
||||
.text = LibraryChapterLabel(chapter, BookChapterTitle(book, chapter)),
|
||||
.bounds = ReadingBounds(), .font = Scale(font_size),
|
||||
.typeface = ifx font_face == 1 then "assets/library/noto-sans.ttf" else "ui",
|
||||
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapAuto}
|
||||
ReaderTypeface :: () -> string {
|
||||
return ifx font_face == 1 then "assets/library/noto-sans.ttf" else "ui"
|
||||
}
|
||||
|
||||
ChapterHeadingProps :: (chapter: s32) -> Text.Props {
|
||||
props := Text.Props.{.key = 27501,
|
||||
.text = BookChapterTitle(book, chapter),
|
||||
.bounds = ReaderAreaBounds(), .size = Scale(font_size), .typeface = ReaderTypeface(),
|
||||
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(Text.Wrap)TextWrapAuto}
|
||||
props.bounds.height = cast(float32)TextHeight(frame.session, props)
|
||||
return props
|
||||
}
|
||||
|
||||
ReadingProps :: (chapter: s32) -> TextProps {
|
||||
bounds := ReadingBounds()
|
||||
ReadingProps :: (chapter: s32) -> Text.Props {
|
||||
bounds := ReaderAreaBounds()
|
||||
heading := ChapterHeadingProps(chapter)
|
||||
inset := heading.bounds.height + cast(float32)Scale(16)
|
||||
bounds.y += inset
|
||||
bounds.height -= inset
|
||||
return TextProps.{.bounds = bounds, .font = Scale(font_size),
|
||||
.typeface = ifx font_face == 1 then "assets/library/noto-sans.ttf" else "ui",
|
||||
.line_gap = Scale(line_gap), .wrap = cast(TextWrap)TextWrapAuto}
|
||||
return Text.Props.{.bounds = bounds, .size = Scale(font_size), .typeface = ReaderTypeface(),
|
||||
.line_gap = Scale(line_gap), .wrap = cast(Text.Wrap)TextWrapAuto}
|
||||
}
|
||||
|
||||
HasPicturePages :: () -> bool {
|
||||
return picture_book && BookChapterArtApproved(book)
|
||||
}
|
||||
|
||||
// The illustration and the title below it are centered together, as one
|
||||
// group, in the reading area of their own page.
|
||||
PicturePageView :: (chapter: s32) {
|
||||
area := ReaderAreaBounds()
|
||||
title := Text.Props.{.key = 27501,
|
||||
.text = BookChapterTitle(book, chapter),
|
||||
.bounds = area, .size = Scale(font_size + 4), .typeface = ReaderTypeface(),
|
||||
.align = cast(TextAlign)TextAlignCenter, .wrap = cast(Text.Wrap)TextWrapAuto}
|
||||
title_height := TextHeight(frame.session, title)
|
||||
gap := Scale(24)
|
||||
side := cast(s32)area.height - title_height - gap
|
||||
if side > cast(s32)area.width { side = cast(s32)area.width }
|
||||
if side < 0 { side = 0 }
|
||||
top := cast(s32)area.y + (cast(s32)area.height - side - gap - title_height) / 2
|
||||
left := cast(s32)area.x + (cast(s32)area.width - side) / 2
|
||||
Image.Draw(frame.session, Image.Props.{.key = 27503,
|
||||
.asset_path = BookChapterArt(book, chapter), .alt_text = title.text,
|
||||
.bounds = Bounds(left, top, side, side), .fit = Image.ImageFit.ImageFitContain, .smooth = true})
|
||||
title.bounds = Bounds(cast(s32)area.x, top + side + gap, cast(s32)area.width, title_height)
|
||||
Text.Draw(frame.session, title)
|
||||
}
|
||||
|
||||
Reflow :: () {
|
||||
bounds := ReadingBounds()
|
||||
// Cache the viewport, independent of whichever page is currently visible.
|
||||
bounds := ReaderAreaBounds()
|
||||
if page_count > 0 && layout_width == cast(s32)bounds.width &&
|
||||
layout_height == cast(s32)bounds.height && layout_scale == frame.scale { return }
|
||||
// During a transient resize (for example a phone keyboard), keep the
|
||||
@@ -214,19 +240,23 @@ Reflow :: () {
|
||||
if bounds.width < cast(float32)Scale(60) || bounds.height < cast(float32)Scale(font_size + line_gap) { return }
|
||||
count: s32
|
||||
for chapter: cast(s32)1..BookChapters(book) {
|
||||
if HasPicturePages() && count < LIBRARY_PAGE_LIMIT {
|
||||
pages[count] = LibraryPage.{.chapter = chapter, .picture = true}
|
||||
count += 1
|
||||
}
|
||||
props := ReadingProps(chapter)
|
||||
props.text = BookChapter(book, chapter)
|
||||
at: s32
|
||||
while at < props.text.count && count < LIBRARY_PAGE_LIMIT {
|
||||
part := TextPage(frame.session, props, at)
|
||||
if part.next <= at { return }
|
||||
pages[count] = LibraryPage.{chapter, part.start, part.end}
|
||||
pages[count] = LibraryPage.{chapter, part.start, part.end, false}
|
||||
count += 1
|
||||
at = part.next
|
||||
}
|
||||
}
|
||||
page_count = count
|
||||
page_index = LibraryPageFor(pages[:page_count], anchor_chapter, anchor_offset)
|
||||
page_index = LibraryPageFor(pages[:page_count], anchor_chapter, anchor_offset, anchor_picture)
|
||||
layout_width = cast(s32)bounds.width
|
||||
layout_height = cast(s32)bounds.height
|
||||
layout_scale = frame.scale
|
||||
@@ -244,8 +274,8 @@ LoadPageAnnotations :: () {
|
||||
}
|
||||
note[0] = 0
|
||||
if annotation_index >= 0 { unused AppCopyText(annotations[annotation_index].note, note[:]) }
|
||||
note_state = TextAreaResult.{}
|
||||
passage_state = TextAreaResult.{}
|
||||
note_state = TextArea.Result.{}
|
||||
passage_state = TextArea.Result.{}
|
||||
if annotation_index >= 0 {
|
||||
saved := annotations[annotation_index]
|
||||
// Keep older page-wide notes, without selecting the entire page.
|
||||
@@ -262,11 +292,18 @@ OpenBook :: (index: s32) {
|
||||
at: s32
|
||||
anchor_chapter = ReadLibraryNumber(text, *at)
|
||||
anchor_offset = ReadLibraryNumber(text, *at)
|
||||
saved_picture := ReadLibraryNumber(text, *at)
|
||||
if anchor_chapter < 1 || anchor_chapter > BookChapters(book) {
|
||||
anchor_chapter = RecordNumber(BookRecord(book), 1, 1, BookChapters(book))
|
||||
anchor_offset = 0
|
||||
}
|
||||
if anchor_offset < 0 || anchor_offset >= BookChapter(book, anchor_chapter).count { anchor_offset = 0 }
|
||||
// Older two-number positions open a chapter at its picture. New positions
|
||||
// distinguish that picture from the first text page, also at byte zero.
|
||||
anchor_picture = anchor_offset == 0
|
||||
if saved_picture == 0 || saved_picture == 1 {
|
||||
anchor_picture = saved_picture == 1
|
||||
}
|
||||
page_count = 0
|
||||
annotation_chapter = 0
|
||||
panel_open = false
|
||||
@@ -279,11 +316,22 @@ OpenBook :: (index: s32) {
|
||||
if page_count > 0 { LoadPageAnnotations() }
|
||||
}
|
||||
|
||||
SetPictureMode :: (pictures: bool) {
|
||||
if !SaveReader() { return }
|
||||
picture_book = pictures
|
||||
layout_width = 0
|
||||
settings_dirty = true
|
||||
reader_swipe = SwipeGesture.{}
|
||||
unused SmoothFramesHost(2)
|
||||
unused SaveReader()
|
||||
}
|
||||
|
||||
TurnPage :: (index: s32) {
|
||||
if index < 0 || index >= page_count || !SaveReader() { return }
|
||||
page_index = index
|
||||
anchor_chapter = pages[index].chapter
|
||||
anchor_offset = pages[index].start
|
||||
anchor_picture = pages[index].picture
|
||||
position_dirty = true
|
||||
unused SaveReader()
|
||||
LoadPageAnnotations()
|
||||
@@ -298,12 +346,12 @@ LibraryBack :: () -> bool {
|
||||
}
|
||||
|
||||
BookJacket :: (index: s32, cover: Rectangle, key: u64) {
|
||||
Image(frame.session, ImageProps.{.key = key, .asset_path = BookCover(index),
|
||||
Image.Draw(frame.session, Image.Props.{.key = key, .asset_path = BookCover(index),
|
||||
.alt_text = BookTitle(index), .bounds = cover,
|
||||
.fit = ImageFit.ImageFitStretch, .smooth = true})
|
||||
.fit = Image.ImageFit.ImageFitStretch, .smooth = true})
|
||||
if cover.width < cast(float32)Scale(80) { return }
|
||||
label_height := cast(s32)(cover.height * 0.30)
|
||||
unused Box(frame.session, BoxProps.{.key = key + 1,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = key + 1,
|
||||
.bounds = Bounds(cast(s32)cover.x + Scale(4), cast(s32)cover.y + Scale(4),
|
||||
cast(s32)cover.width - Scale(8), label_height),
|
||||
.fill = Color.{244, 233, 204, 245}, .fill_bottom = Color.{244, 233, 204, 0},
|
||||
@@ -313,11 +361,11 @@ BookJacket :: (index: s32, cover: Rectangle, key: u64) {
|
||||
unused WidgetPaletteUse(frame.session, palette)
|
||||
title_font := cast(s32)(cover.width * 0.105)
|
||||
author_font := cast(s32)(cover.width * 0.075)
|
||||
Text(frame.session, TextProps.{.key = key + 2, .text = BookTitle(index), .font = title_font,
|
||||
Text.Draw(frame.session, Text.Props.{.key = key + 2, .text = BookTitle(index), .size = title_font,
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.bounds = Bounds(cast(s32)cover.x + Scale(8), cast(s32)cover.y + Scale(12),
|
||||
cast(s32)cover.width - Scale(16), title_font + Scale(4))})
|
||||
Text(frame.session, TextProps.{.key = key + 3, .text = BookAuthor(index), .font = author_font,
|
||||
Text.Draw(frame.session, Text.Props.{.key = key + 3, .text = BookAuthor(index), .size = author_font,
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.bounds = Bounds(cast(s32)cover.x + Scale(8), cast(s32)cover.y + Scale(18) + title_font,
|
||||
cast(s32)cover.width - Scale(16), author_font + Scale(4))})
|
||||
@@ -331,7 +379,7 @@ OpeningView :: () {
|
||||
return
|
||||
}
|
||||
unused SmoothFramesHost(2)
|
||||
width := ReadingBounds().width
|
||||
width := ReaderAreaBounds().width
|
||||
if width > cast(float32)Scale(260) { width = cast(float32)Scale(260) }
|
||||
target := Rectangle.{(cast(float32)frame.width - width) / 2.0,
|
||||
cast(float32)frame.top + cast(float32)Scale(24), width, width * 1.5}
|
||||
@@ -358,10 +406,10 @@ ShelfView :: () {
|
||||
visible_rows := (cast(s32)area.height + row_height - 1) / row_height
|
||||
if rows < visible_rows { rows = visible_rows }
|
||||
content_height := rows * row_height + Scale(20)
|
||||
unused Box(frame.session, BoxProps.{.key = 27900, .bounds = area,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = 27900, .bounds = area,
|
||||
.fill = Color.{73, 43, 28, 255}, .fill_bottom = Color.{111, 71, 44, 255},
|
||||
.has_fill_bottom = true})
|
||||
scroll := Scroll(frame.session, ScrollProps.{.key = 27000, .bounds = area,
|
||||
scroll := Scroll.Draw(frame.session, Scroll.Props.{.key = 27000, .bounds = area,
|
||||
.content_height = content_height,
|
||||
.scroll_offset = shelf_scroll, .scale = frame.scale})
|
||||
shelf_scroll = scroll.scroll_offset
|
||||
@@ -376,26 +424,26 @@ ShelfView :: () {
|
||||
width := cast(s32)scroll.content.width
|
||||
board := y + height + Scale(20)
|
||||
key := cast(u64)(28000 + row * 32)
|
||||
unused Box(frame.session, BoxProps.{.key = key,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = key,
|
||||
.bounds = Bounds(x + Scale(10), y, width - Scale(20), row_height),
|
||||
.fill = Color.{57, 35, 25, 255}, .fill_bottom = Color.{126, 87, 55, 255},
|
||||
.has_fill_bottom = true})
|
||||
unused Box(frame.session, BoxProps.{.key = key + 1,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = key + 1,
|
||||
.bounds = Bounds(x + Scale(10), board - Scale(14), width - Scale(20), Scale(14)),
|
||||
.fill = Color.{158, 110, 65, 255}, .fill_bottom = Color.{193, 143, 85, 255},
|
||||
.has_fill_bottom = true})
|
||||
unused Box(frame.session, BoxProps.{.key = key + 2,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = key + 2,
|
||||
.bounds = Bounds(x, board, width, Scale(22)),
|
||||
.fill = Color.{163, 111, 63, 255}, .fill_bottom = Color.{108, 65, 36, 255},
|
||||
.has_fill_bottom = true})
|
||||
unused Box(frame.session, BoxProps.{.key = key + 3,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = key + 3,
|
||||
.bounds = Bounds(x, board, width, Scale(2)), .fill = Color.{217, 167, 104, 255}})
|
||||
unused Box(frame.session, BoxProps.{.key = key + 4,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = key + 4,
|
||||
.bounds = Bounds(x + Scale(10), board + Scale(22), width - Scale(20), Scale(18)),
|
||||
.fill = Color.{25, 15, 10, 120}, .fill_bottom = Color.{25, 15, 10, 0},
|
||||
.has_fill_bottom = true})
|
||||
for grain: cast(s32)0..3 {
|
||||
unused Box(frame.session, BoxProps.{.key = key + cast(u64)(5 + grain),
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = key + cast(u64)(5 + grain),
|
||||
.bounds = Bounds(x + Scale(8 + grain * 13), board + Scale(5 + grain * 4),
|
||||
width - Scale(40 + grain * 14), Scale(1)),
|
||||
.fill = Color.{75, 43, 24, 65}})
|
||||
@@ -408,18 +456,18 @@ ShelfView :: () {
|
||||
x := cast(s32)cover.x
|
||||
y := cast(s32)cover.y
|
||||
key := cast(u64)(29000 + index * 16)
|
||||
unused Box(frame.session, BoxProps.{.key = key,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = key,
|
||||
.bounds = Bounds(x + Scale(6), y + Scale(8), cover_width + Scale(8), height),
|
||||
.fill = Color.{20, 12, 8, 105}, .radius = cast(float32)Scale(3)})
|
||||
unused Box(frame.session, BoxProps.{.key = key + 1,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = key + 1,
|
||||
.bounds = Bounds(x + Scale(5), y + Scale(3), cover_width, height - Scale(3)),
|
||||
.fill = Color.{221, 208, 171, 255}, .border = Color.{121, 101, 66, 255}})
|
||||
press := Press(frame.session, PressProps.{.key = cast(u64)(27010 + index),
|
||||
press := Press.Draw(frame.session, Press.Props.{.key = cast(u64)(27010 + index),
|
||||
.bounds = cover, .label = BookTitle(index), .now = frame.now})
|
||||
BookJacket(index, cover, key + 4)
|
||||
unused Box(frame.session, BoxProps.{.key = key + 2,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = key + 2,
|
||||
.bounds = Bounds(x, y, Scale(5), height), .fill = Color.{18, 24, 17, 85}})
|
||||
unused Box(frame.session, BoxProps.{.key = key + 3,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = key + 3,
|
||||
.bounds = Bounds(x + Scale(6), y, Scale(1), height), .fill = Color.{255, 243, 192, 75}})
|
||||
if press.clicked {
|
||||
opening_from = cover
|
||||
@@ -446,19 +494,19 @@ AnnotationPanel :: (bounds: Rectangle) {
|
||||
width := cast(s32)bounds.width
|
||||
current := pages[page_index]
|
||||
input := AppFieldInputHost()
|
||||
Text(frame.session, TextProps.{.text = AppLocaleHost("library_select_passage"), .font = frame.font,
|
||||
Text.Draw(frame.session, Text.Props.{.text = AppLocaleHost("library_select_passage"), .size = frame.font,
|
||||
.bounds = Bounds(cast(s32)bounds.x, y, width, Scale(32))})
|
||||
y += Scale(40)
|
||||
previous_start := ifx passage_state.anchor < passage_state.cursor then passage_state.anchor else passage_state.cursor
|
||||
previous_end := ifx passage_state.anchor > passage_state.cursor then passage_state.anchor else passage_state.cursor
|
||||
passage_state = TextArea(frame.session, TextAreaProps.{.key = 27619, .focus_id = 27619,
|
||||
passage_state = TextArea.Draw(frame.session, TextArea.Props.{.key = 27619, .focus_id = 27619,
|
||||
.bounds = Bounds(cast(s32)bounds.x, y, width, Scale(168)),
|
||||
.value = BookChapter(book, current.chapter)[current.start:current.end],
|
||||
.label = AppLocaleHost("library_select_passage"), .read_only = true, .wrap = true,
|
||||
.cursor = passage_state.cursor, .anchor = passage_state.anchor,
|
||||
.focused = passage_state.focused, .scroll_y = passage_state.scroll_y,
|
||||
.selecting = passage_state.selecting, .scale = frame.scale,
|
||||
.input = TextAreaInput.{.left = input.left, .right = input.right,
|
||||
.input = TextArea.Input.{.left = input.left, .right = input.right,
|
||||
.home = input.home, .end = input.end, .shift = input.shift,
|
||||
.select_all = input.select_all, .copy = input.copy, .now_seconds = frame.now}})
|
||||
start := ifx passage_state.anchor < passage_state.cursor then passage_state.anchor else passage_state.cursor
|
||||
@@ -472,14 +520,14 @@ AnnotationPanel :: (bounds: Rectangle) {
|
||||
}
|
||||
note[0] = 0
|
||||
if annotation_index >= 0 { unused AppCopyText(annotations[annotation_index].note, note[:]) }
|
||||
note_state = TextAreaResult.{}
|
||||
note_state = TextArea.Result.{}
|
||||
}
|
||||
y += Scale(184)
|
||||
selected := end > start || annotation_index >= 0
|
||||
highlighted := annotation_index >= 0 && annotations[annotation_index].highlighted
|
||||
Text(frame.session, TextProps.{.text = AppLocaleHost("library_highlight"), .font = frame.font,
|
||||
Text.Draw(frame.session, Text.Props.{.text = AppLocaleHost("library_highlight"), .size = frame.font,
|
||||
.bounds = Bounds(cast(s32)bounds.x, y, width - Scale(72), Scale(48))})
|
||||
toggle := Toggle(frame.session, ToggleProps.{.key = 27620,
|
||||
toggle := Toggle.Draw(frame.session, Toggle.Props.{.key = 27620,
|
||||
.bounds = Bounds(cast(s32)bounds.x + width - Scale(64), y, Scale(64), Scale(48)),
|
||||
.label = AppLocaleHost("library_highlight"), .value = highlighted, .disabled = !selected})
|
||||
if toggle.changed && EnsureAnnotation() {
|
||||
@@ -488,14 +536,14 @@ AnnotationPanel :: (bounds: Rectangle) {
|
||||
unused SaveReader()
|
||||
}
|
||||
y += Scale(64)
|
||||
edit := TextArea(frame.session, TextAreaProps.{.key = 27621, .focus_id = 27621,
|
||||
edit := TextArea.Draw(frame.session, TextArea.Props.{.key = 27621, .focus_id = 27621,
|
||||
.bounds = Bounds(cast(s32)bounds.x, y, width, Scale(160)),
|
||||
.value = TextUntilNul(note[:]), .label = AppLocaleHost("library_note"),
|
||||
.placeholder = AppLocaleHost("library_note"), .max_bytes = 2048, .max_codepoints = 2048,
|
||||
.cursor = note_state.cursor, .anchor = note_state.anchor,
|
||||
.scroll_y = note_state.scroll_y, .focused = note_state.focused,
|
||||
.composition = note_state.composition, .wrap = true, .scale = frame.scale, .disabled = !selected,
|
||||
.input = TextAreaInput.{.text = input.text, .paste_text = input.paste_text,
|
||||
.input = TextArea.Input.{.text = input.text, .paste_text = input.paste_text,
|
||||
.composition_event = input.composition_event, .left = input.left, .right = input.right,
|
||||
.home = input.home, .end = input.end, .shift = input.shift,
|
||||
.backspace = input.backspace, .delete_forward = input.delete_forward,
|
||||
@@ -513,7 +561,7 @@ AnnotationPanel :: (bounds: Rectangle) {
|
||||
// their notes visible as well as the editable first annotation.
|
||||
for index: cast(s32)0..annotation_count - 1 {
|
||||
if index != annotation_index && LibraryOverlaps(current, annotations[index]) && annotations[index].note != "" {
|
||||
Text(frame.session, TextProps.{.text = annotations[index].note, .font = frame.font,
|
||||
Text.Draw(frame.session, Text.Props.{.text = annotations[index].note, .size = frame.font,
|
||||
.bounds = Bounds(cast(s32)bounds.x, y, width, Scale(100))})
|
||||
y += Scale(112)
|
||||
}
|
||||
@@ -524,9 +572,9 @@ FontPanel :: (bounds: Rectangle) {
|
||||
x := cast(s32)bounds.x
|
||||
y := cast(s32)bounds.y
|
||||
width := cast(s32)bounds.width
|
||||
Text(frame.session, TextProps.{.text = AppLocaleHost("library_font_size"), .font = frame.font,
|
||||
Text.Draw(frame.session, Text.Props.{.text = AppLocaleHost("library_font_size"), .size = frame.font,
|
||||
.bounds = Bounds(x, y, width, Scale(28))})
|
||||
size := Spinbox(frame.session, SpinboxProps.{.key = 27630,
|
||||
size := Spinbox.Draw(frame.session, Spinbox.Props.{.key = 27630,
|
||||
.bounds = Bounds(x, y + Scale(32), width, Scale(56)), .label = AppLocaleHost("library_font_size"),
|
||||
.min = 14, .max = 36, .step = 1, .value = font_size, .value_text = NumberText(font_size)})
|
||||
if size.changed {
|
||||
@@ -534,12 +582,12 @@ FontPanel :: (bounds: Rectangle) {
|
||||
layout_width = 0
|
||||
settings_dirty = true
|
||||
}
|
||||
options: [2]DropdownOption
|
||||
options: [2]Dropdown.Option
|
||||
options[0].label = AppLocaleHost("library_font_system")
|
||||
options[1].label = "Noto Sans"
|
||||
Text(frame.session, TextProps.{.text = AppLocaleHost("library_typeface"), .font = frame.font,
|
||||
Text.Draw(frame.session, Text.Props.{.text = AppLocaleHost("library_typeface"), .size = frame.font,
|
||||
.bounds = Bounds(x, y + Scale(112), width, Scale(28))})
|
||||
face := Dropdown(frame.session, DropdownProps.{.key = 27631,
|
||||
face := Dropdown.Draw(frame.session, Dropdown.Props.{.key = 27631,
|
||||
.bounds = Bounds(x, y + Scale(144), width, Scale(48)),
|
||||
.placeholder = AppLocaleHost("library_typeface"), .selected_index = font_face,
|
||||
.scale = frame.scale}, options[:])
|
||||
@@ -555,14 +603,14 @@ LayoutPanel :: (bounds: Rectangle) {
|
||||
x := cast(s32)bounds.x
|
||||
y := cast(s32)bounds.y
|
||||
width := cast(s32)bounds.width
|
||||
Text(frame.session, TextProps.{.text = AppLocaleHost("library_margins"), .font = frame.font,
|
||||
Text.Draw(frame.session, Text.Props.{.text = AppLocaleHost("library_margins"), .size = frame.font,
|
||||
.bounds = Bounds(x, y, width, Scale(28))})
|
||||
Text(frame.session, TextProps.{.text = AppLocaleHost("library_line_spacing"), .font = frame.font,
|
||||
Text.Draw(frame.session, Text.Props.{.text = AppLocaleHost("library_line_spacing"), .size = frame.font,
|
||||
.bounds = Bounds(x, y + Scale(112), width, Scale(28))})
|
||||
inset := Spinbox(frame.session, SpinboxProps.{.key = 27640,
|
||||
inset := Spinbox.Draw(frame.session, Spinbox.Props.{.key = 27640,
|
||||
.bounds = Bounds(x, y + Scale(32), width, Scale(56)), .label = AppLocaleHost("library_margins"),
|
||||
.min = 12, .max = 56, .step = 4, .value = margin, .value_text = NumberText(margin)})
|
||||
gap := Spinbox(frame.session, SpinboxProps.{.key = 27641,
|
||||
gap := Spinbox.Draw(frame.session, Spinbox.Props.{.key = 27641,
|
||||
.bounds = Bounds(x, y + Scale(144), width, Scale(56)), .label = AppLocaleHost("library_line_spacing"),
|
||||
.min = 2, .max = 20, .step = 2, .value = line_gap, .value_text = NumberText(line_gap)})
|
||||
if inset.changed || gap.changed {
|
||||
@@ -576,16 +624,16 @@ LayoutPanel :: (bounds: Rectangle) {
|
||||
|
||||
ContentsPanel :: (bounds: Rectangle) {
|
||||
for chapter: cast(s32)1..BookChapters(book) {
|
||||
if Button(frame.session, ButtonProps.{.id = 27200 + chapter,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 27200 + chapter,
|
||||
.bounds = Bounds(cast(s32)bounds.x, cast(s32)bounds.y + (chapter - 1) * Scale(56),
|
||||
cast(s32)bounds.width, Scale(48)),
|
||||
.label = LibraryChapterLabel(chapter, BookChapterTitle(book, chapter)),
|
||||
.label = BookChapterTitle(book, chapter),
|
||||
.content_alignment = ContentAlignment.ContentAlignmentStart, .fit_content = true,
|
||||
.size = ControlSize.ControlSizeLarge,
|
||||
.selected = chapter == pages[page_index].chapter,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
TurnPage(LibraryPageFor(pages[:page_count], chapter, 0))
|
||||
TurnPage(LibraryPageFor(pages[:page_count], chapter, 0, true))
|
||||
if !save_failed { panel_open = false }
|
||||
}
|
||||
}
|
||||
@@ -607,11 +655,11 @@ ReaderToolbar :: () {
|
||||
icons: [4]s32 = .[cast(s32)IconType.IconPencil, cast(s32)IconType.IconText,
|
||||
cast(s32)IconType.IconGear, cast(s32)IconType.IconManual]
|
||||
labels: [4]string = .["library_annotations", "library_font", "library_layout", "library_contents"]
|
||||
size := Scale(44)
|
||||
gap := Scale(4)
|
||||
left := frame.width - Scale(12) - size * 5 - gap * 4
|
||||
size := ifx frame.width < Scale(360) then Scale(40) else Scale(44)
|
||||
gap := Scale(2)
|
||||
left := frame.width - Scale(12) - size * 6 - gap * 5
|
||||
for index: cast(s32)0..3 {
|
||||
if Button(frame.session, ButtonProps.{.id = 27700 + index,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 27700 + index,
|
||||
.bounds = Bounds(left + index * (size + gap), Scale(6), size, size),
|
||||
.label = AppLocaleHost(labels[index]), .icon_type = icons[index], .icon_only = true,
|
||||
.size = cast(ControlSize)ControlSize.ControlSizeLarge,
|
||||
@@ -625,7 +673,7 @@ ReaderToolbar :: () {
|
||||
LoadPageAnnotations()
|
||||
}
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 27704,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 27704,
|
||||
.bounds = Bounds(left + 4 * (size + gap), Scale(6), size, size),
|
||||
.label = AppLocaleHost(ifx book_dark then "theme_light" else "theme_dark"),
|
||||
.icon_type = cast(s32)(ifx book_dark then IconType.IconSun else IconType.IconMoon),
|
||||
@@ -636,17 +684,26 @@ ReaderToolbar :: () {
|
||||
settings_dirty = true
|
||||
unused SaveReader()
|
||||
}
|
||||
if BookChapterArtApproved(book) && Button.Draw(frame.session, Button.Props.{.id = 27705,
|
||||
.bounds = Bounds(left + 5 * (size + gap), Scale(6), size, size),
|
||||
.label = AppLocaleHost(ifx picture_book then "library_hide_images" else "library_show_images"),
|
||||
.icon_type = cast(s32)IconType.IconStack, .icon_only = true,
|
||||
.selected = picture_book, .size = cast(ControlSize)ControlSize.ControlSizeLarge,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
SetPictureMode(!picture_book)
|
||||
}
|
||||
}
|
||||
|
||||
ReaderPanel :: () {
|
||||
bounds := ReadingBounds()
|
||||
bounds := ReaderAreaBounds()
|
||||
bounds.y = cast(float32)(frame.top + Scale(16))
|
||||
bounds.height = cast(float32)(frame.height - frame.bottom - cast(s32)bounds.y - Scale(48))
|
||||
Text(frame.session, TextProps.{.key = 27600, .text = AppLocaleHost(
|
||||
Text.Draw(frame.session, Text.Props.{.key = 27600, .text = AppLocaleHost(
|
||||
ifx panel_tab == 0 then "library_annotations" else ifx panel_tab == 1 then "library_font"
|
||||
else ifx panel_tab == 2 then "library_layout" else "library_contents"),
|
||||
.font = frame.font, .bounds = bounds})
|
||||
if Button(frame.session, ButtonProps.{.id = 27601,
|
||||
.size = frame.font, .bounds = bounds})
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 27601,
|
||||
.bounds = Bounds(cast(s32)(bounds.x + bounds.width) - Scale(44), cast(s32)bounds.y - Scale(8), Scale(44), Scale(44)),
|
||||
.label = AppLocaleHost("close_button"), .icon_type = cast(s32)IconType.IconCheck,
|
||||
.icon_only = true, .size = cast(ControlSize)ControlSize.ControlSizeLarge,
|
||||
@@ -664,7 +721,7 @@ ReaderPanel :: () {
|
||||
if panel_tab == 3 {
|
||||
content_height = BookChapters(book) * Scale(56) - Scale(8)
|
||||
}
|
||||
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)(27602 + panel_tab), .bounds = bounds,
|
||||
scroll := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)(27602 + panel_tab), .bounds = bounds,
|
||||
.content_height = content_height, .scroll_offset = panel_scroll, .scale = frame.scale})
|
||||
panel_scroll = scroll.scroll_offset
|
||||
if !scroll.opened { return }
|
||||
@@ -675,10 +732,43 @@ ReaderPanel :: () {
|
||||
else { ContentsPanel(scroll.content) }
|
||||
}
|
||||
|
||||
ChapterTextView :: (current: LibraryPage) {
|
||||
props: Text.Props = ReadingProps(current.chapter)
|
||||
props.text = BookChapter(book, current.chapter)[current.start:current.end]
|
||||
props.key = 27502
|
||||
// Emphasize only marked words; never paint a rectangle over the page.
|
||||
marks: [LIBRARY_ANNOTATION_LIMIT]Text.Range
|
||||
mark_count: s32
|
||||
for annotation: annotations[:annotation_count] {
|
||||
if !annotation.highlighted || !LibraryOverlaps(current, annotation) { continue }
|
||||
start := ifx annotation.start > current.start then annotation.start - current.start else 0
|
||||
end := ifx annotation.end < current.end then annotation.end - current.start else current.end - current.start
|
||||
place := mark_count
|
||||
while place > 0 && marks[place - 1].start > start {
|
||||
marks[place] = marks[place - 1]
|
||||
place -= 1
|
||||
}
|
||||
marks[place] = Text.Range.{start, end}
|
||||
mark_count += 1
|
||||
}
|
||||
merged: s32
|
||||
for index: cast(s32)0..mark_count - 1 {
|
||||
if merged > 0 && marks[index].start <= marks[merged - 1].end {
|
||||
if marks[index].end > marks[merged - 1].end { marks[merged - 1].end = marks[index].end }
|
||||
} else {
|
||||
marks[merged] = marks[index]
|
||||
merged += 1
|
||||
}
|
||||
}
|
||||
props.strong = marks[:merged]
|
||||
Text.Draw(frame.session, ChapterHeadingProps(current.chapter))
|
||||
Text.Draw(frame.session, props)
|
||||
}
|
||||
|
||||
ReaderView :: () {
|
||||
unused WidgetPaletteUse(frame.session, ReaderPalette())
|
||||
paper := ifx book_dark then Color.{40, 35, 29, 255} else Color.{248, 241, 224, 255}
|
||||
unused Box(frame.session, BoxProps.{.key = 27500,
|
||||
unused Box.Draw(frame.session, Box.Props.{.key = 27500,
|
||||
.bounds = Bounds(0, 0, frame.width, frame.height), .fill = paper})
|
||||
if opening {
|
||||
OpeningView()
|
||||
@@ -697,7 +787,7 @@ ReaderView :: () {
|
||||
if page_count <= 0 { return }
|
||||
if !panel_open && !opening {
|
||||
pointer := SamplePointer()
|
||||
swipe := Swipe(SwipeSpec.{.bounds = ReadingBounds(),
|
||||
swipe := Swipe(SwipeSpec.{.bounds = ReaderAreaBounds(),
|
||||
.directions = cast(u32)SwipeDirection.SwipeHorizontal,
|
||||
.min_distance = cast(float32)Scale(48), .axis_bias = 1.5},
|
||||
reader_swipe, SwipeFrame.{.pointer = Vector2.{pointer.x, pointer.y},
|
||||
@@ -709,49 +799,20 @@ ReaderView :: () {
|
||||
else if swipe.direction == SwipeDirection.SwipeRight || key == KeyLeft { TurnPage(page_index - 1) }
|
||||
}
|
||||
current := pages[page_index]
|
||||
heading: TextProps = ChapterHeadingProps(current.chapter)
|
||||
props: TextProps = ReadingProps(current.chapter)
|
||||
props.text = BookChapter(book, current.chapter)[current.start:current.end]
|
||||
props.key = 27502
|
||||
// Emphasize only marked words; never paint a rectangle over the page.
|
||||
marks: [LIBRARY_ANNOTATION_LIMIT]TextRange
|
||||
mark_count: s32
|
||||
for annotation: annotations[:annotation_count] {
|
||||
if !annotation.highlighted || !LibraryOverlaps(current, annotation) { continue }
|
||||
start := ifx annotation.start > current.start then annotation.start - current.start else 0
|
||||
end := ifx annotation.end < current.end then annotation.end - current.start else current.end - current.start
|
||||
place := mark_count
|
||||
while place > 0 && marks[place - 1].start > start {
|
||||
marks[place] = marks[place - 1]
|
||||
place -= 1
|
||||
}
|
||||
marks[place] = TextRange.{start, end}
|
||||
mark_count += 1
|
||||
}
|
||||
merged: s32
|
||||
for index: cast(s32)0..mark_count - 1 {
|
||||
if merged > 0 && marks[index].start <= marks[merged - 1].end {
|
||||
if marks[index].end > marks[merged - 1].end { marks[merged - 1].end = marks[index].end }
|
||||
} else {
|
||||
marks[merged] = marks[index]
|
||||
merged += 1
|
||||
}
|
||||
}
|
||||
props.strong = marks[:merged]
|
||||
if !panel_open {
|
||||
Text(frame.session, heading)
|
||||
Text(frame.session, props)
|
||||
if current.picture { PicturePageView(current.chapter) }
|
||||
else { ChapterTextView(current) }
|
||||
}
|
||||
ReaderToolbar()
|
||||
label: Vec(u8)
|
||||
BuilderPrint(*label, "% / %", page_index + 1, page_count)
|
||||
Text(frame.session, TextProps.{.key = 27511, .text = BuilderFinish(label), .font = frame.font - Scale(2),
|
||||
Text.Draw(frame.session, Text.Props.{.key = 27511, .text = BuilderFinish(label), .size = frame.font - Scale(2),
|
||||
.align = cast(TextAlign)TextAlignCenter,
|
||||
.bounds = Bounds(0, frame.height - frame.bottom - Scale(40), frame.width, Scale(32))})
|
||||
if panel_open { ReaderPanel() }
|
||||
unused WidgetPaletteUse(frame.session, ReaderPalette())
|
||||
if save_failed {
|
||||
Text(frame.session, TextProps.{.text = AppLocaleHost("library_save_failed"), .font = frame.font,
|
||||
Text.Draw(frame.session, Text.Props.{.text = AppLocaleHost("library_save_failed"), .size = frame.font,
|
||||
.bounds = Bounds(Scale(16), frame.top + Scale(8), frame.width - Scale(216), Scale(48))})
|
||||
}
|
||||
}
|
||||
@@ -772,7 +833,7 @@ LibraryView :: (message: AppMessage) -> AppMessage {
|
||||
}
|
||||
if reading { ReaderView() }
|
||||
else { ShelfView() }
|
||||
if Button(frame.session, ButtonProps.{.id = 27710,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 27710,
|
||||
.bounds = Bounds(Scale(8), Scale(6), Scale(44), Scale(44)),
|
||||
.label = AppLocaleHost("back_button"), .icon_type = cast(s32)IconType.IconLeft,
|
||||
.icon_only = true, .size = cast(ControlSize)ControlSize.ControlSizeLarge,
|
||||
|
||||
@@ -1,5 +1,36 @@
|
||||
# Changelog
|
||||
|
||||
## [1.1.30] - 2026-11-05
|
||||
|
||||
- Retain the cursor while correcting text in lists.
|
||||
|
||||
## [1.1.29] - 2026-11-02
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.62.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Write longer todos; open a custom task for a description and todo.txt priority, with shorter fixed-width complete and edit swipes.
|
||||
|
||||
- Close List settings after a successful save and keep edits open if saving fails.
|
||||
- Show the profile pictures friends chose in any app, abstract pictures included.
|
||||
|
||||
## [1.1.28] - 2026-10-29
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.61.
|
||||
|
||||
## [1.1.27] - 2026-10-29
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.60.
|
||||
|
||||
## [1.1.26] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.59.
|
||||
|
||||
## [1.1.25] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.58.
|
||||
|
||||
## [1.1.24] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.56.
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"achievement_lists_created_1_title": "Daftar · 1 hasil",
|
||||
"achievement_lists_created_1_description": "Catat 1 hasil berbeda: daftar yang disimpan.",
|
||||
"achievement_lists_items_1_title": "Daftar · 1 hasil",
|
||||
"achievement_lists_items_1_description": "Catat 1 hasil berbeda: tugas berbeda yang Anda selesaikan.",
|
||||
"achievement_lists_items_5_title": "Daftar · 5 hasil",
|
||||
"achievement_lists_items_5_description": "Catat 5 hasil berbeda: tugas berbeda yang Anda selesaikan.",
|
||||
"achievement_lists_items_10_title": "Daftar · 10 hasil",
|
||||
"achievement_lists_items_10_description": "Catat 10 hasil berbeda: tugas berbeda yang Anda selesaikan.",
|
||||
"achievement_lists_items_25_title": "Daftar · 25 hasil",
|
||||
"achievement_lists_items_25_description": "Catat 25 hasil berbeda: tugas berbeda yang Anda selesaikan.",
|
||||
"achievement_lists_items_50_title": "Daftar · 50 hasil",
|
||||
"achievement_lists_items_50_description": "Catat 50 hasil berbeda: tugas berbeda yang Anda selesaikan.",
|
||||
"achievement_lists_items_100_title": "Daftar · 100 hasil",
|
||||
"achievement_lists_items_100_description": "Catat 100 hasil berbeda: tugas berbeda yang Anda selesaikan.",
|
||||
"achievement_lists_items_250_title": "Daftar · 250 hasil",
|
||||
"achievement_lists_items_250_description": "Catat 250 hasil berbeda: tugas berbeda yang Anda selesaikan.",
|
||||
"achievement_lists_days_3_title": "Daftar · 3 hari",
|
||||
"achievement_lists_days_3_description": "Lakukan ini pada 3 tanggal berbeda: tugas berbeda yang Anda selesaikan.",
|
||||
"achievement_lists_days_7_title": "Daftar · 7 hari",
|
||||
"achievement_lists_days_7_description": "Lakukan ini pada 7 tanggal berbeda: tugas berbeda yang Anda selesaikan.",
|
||||
"achievement_lists_days_30_title": "Daftar · 30 hari",
|
||||
"achievement_lists_days_30_description": "Lakukan ini pada 30 tanggal berbeda: tugas berbeda yang Anda selesaikan.",
|
||||
"achievement_lists_days_100_title": "Daftar · 100 hari",
|
||||
"achievement_lists_days_100_description": "Lakukan ini pada 100 tanggal berbeda: tugas berbeda yang Anda selesaikan.",
|
||||
"achievement_lists_cleared_1_title": "Daftar · 1 hasil",
|
||||
"achievement_lists_cleared_1_description": "Catat 1 hasil berbeda: tugas terbuka terakhir diselesaikan dalam daftar berisi setidaknya tiga tugas.",
|
||||
"achievement_lists_cleared_5_title": "Daftar · 5 hasil",
|
||||
"achievement_lists_cleared_5_description": "Catat 5 hasil berbeda: tugas terbuka terakhir diselesaikan dalam daftar berisi setidaknya tiga tugas.",
|
||||
"achievement_lists_commented_completion_1_title": "Daftar · 1 hasil",
|
||||
"achievement_lists_commented_completion_1_description": "Catat 1 hasil berbeda: tugas diselesaikan dengan komentar tersimpan yang tidak kosong."
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"achievement_lists_created_1_title": "Liste · 1 risultati",
|
||||
"achievement_lists_created_1_description": "Registra 1 risultati distinti: una lista salvata.",
|
||||
"achievement_lists_items_1_title": "Liste · 1 risultati",
|
||||
"achievement_lists_items_1_description": "Registra 1 risultati distinti: un’attività distinta completata da te.",
|
||||
"achievement_lists_items_5_title": "Liste · 5 risultati",
|
||||
"achievement_lists_items_5_description": "Registra 5 risultati distinti: un’attività distinta completata da te.",
|
||||
"achievement_lists_items_10_title": "Liste · 10 risultati",
|
||||
"achievement_lists_items_10_description": "Registra 10 risultati distinti: un’attività distinta completata da te.",
|
||||
"achievement_lists_items_25_title": "Liste · 25 risultati",
|
||||
"achievement_lists_items_25_description": "Registra 25 risultati distinti: un’attività distinta completata da te.",
|
||||
"achievement_lists_items_50_title": "Liste · 50 risultati",
|
||||
"achievement_lists_items_50_description": "Registra 50 risultati distinti: un’attività distinta completata da te.",
|
||||
"achievement_lists_items_100_title": "Liste · 100 risultati",
|
||||
"achievement_lists_items_100_description": "Registra 100 risultati distinti: un’attività distinta completata da te.",
|
||||
"achievement_lists_items_250_title": "Liste · 250 risultati",
|
||||
"achievement_lists_items_250_description": "Registra 250 risultati distinti: un’attività distinta completata da te.",
|
||||
"achievement_lists_days_3_title": "Liste · 3 giorni",
|
||||
"achievement_lists_days_3_description": "Fallo in 3 date distinte: un’attività distinta completata da te.",
|
||||
"achievement_lists_days_7_title": "Liste · 7 giorni",
|
||||
"achievement_lists_days_7_description": "Fallo in 7 date distinte: un’attività distinta completata da te.",
|
||||
"achievement_lists_days_30_title": "Liste · 30 giorni",
|
||||
"achievement_lists_days_30_description": "Fallo in 30 date distinte: un’attività distinta completata da te.",
|
||||
"achievement_lists_days_100_title": "Liste · 100 giorni",
|
||||
"achievement_lists_days_100_description": "Fallo in 100 date distinte: un’attività distinta completata da te.",
|
||||
"achievement_lists_cleared_1_title": "Liste · 1 risultati",
|
||||
"achievement_lists_cleared_1_description": "Registra 1 risultati distinti: l’ultima attività aperta completata in una lista di almeno tre attività.",
|
||||
"achievement_lists_cleared_5_title": "Liste · 5 risultati",
|
||||
"achievement_lists_cleared_5_description": "Registra 5 risultati distinti: l’ultima attività aperta completata in una lista di almeno tre attività.",
|
||||
"achievement_lists_commented_completion_1_title": "Liste · 1 risultati",
|
||||
"achievement_lists_commented_completion_1_description": "Registra 1 risultati distinti: un’attività completata con un commento salvato non vuoto."
|
||||
}
|
||||
@@ -75,7 +75,6 @@ ListsApply :: (message: ListsMessage) -> ListsMessage {
|
||||
} else if message.selected_list >= 0 && message.selected_list < message.list_count {
|
||||
mutation.kind = LISTS_CREATE_ITEM
|
||||
mutation.parent_id = message.selected_id
|
||||
mutation.comment = ""
|
||||
} else {
|
||||
message.input_error = 1
|
||||
message.succeeded = false
|
||||
|
||||
+386
-125
@@ -1,50 +1,47 @@
|
||||
// Lists owns its complete screen composition; the host supplies saved rows,
|
||||
// device input and ordinary Kryon widget effects.
|
||||
#import "session"
|
||||
#import "entity/model"
|
||||
#import "entity/picture_image"
|
||||
#import "geometry"
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "vec"
|
||||
#import "c_string"
|
||||
#import "text_buffer"
|
||||
#import "layout"
|
||||
#import "dropdown_props"
|
||||
#import "dropdown_widget"
|
||||
#import "context_menu_widget"
|
||||
#import "text_props"
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
ContextMenu :: #import "kryon/context_menu";
|
||||
Dropdown :: #import "kryon/dropdown";
|
||||
Image :: #import "kryon/image";
|
||||
Layout :: #import "kryon/layout";
|
||||
Modal :: #import "kryon/modal";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
SwipeRow :: #import "kryon/swipe_row";
|
||||
Text :: #import "kryon/text";
|
||||
TextArea :: #import "kryon/text_area";
|
||||
TextField :: #import "kryon/text_field";
|
||||
#import "kryon/swipe_row"
|
||||
#import "text_align"
|
||||
#import "text_widget"
|
||||
#import "text_input_props"
|
||||
#import "text_field_widget"
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "swipe_row_props"
|
||||
#import "swipe_row"
|
||||
#import "text_measure"
|
||||
#import "pointer_input"
|
||||
#import "swipe"
|
||||
#import "swipe_props"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "modal_props"
|
||||
#import "modal_frame_widget"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "drawing_props"
|
||||
#import "tree"
|
||||
#import "kryon/tree"
|
||||
#import "icon"
|
||||
#import "image_props"
|
||||
#import "image_widget"
|
||||
CompleteIcon :: #import "mingcute/mingcute_regular_check";
|
||||
EditIcon :: #import "mingcute/mingcute_regular_edit_2";
|
||||
SettingsIcon :: #import "mingcute/mingcute_regular_settings_3";
|
||||
BackIcon :: #import "mingcute/mingcute_regular_arrow_left";
|
||||
#import, file "../../src/apps/lists_ui_types.zi";
|
||||
#import, file "../../src/apps/lists_types.zi";
|
||||
#import, file "task_title.zi";
|
||||
|
||||
using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
using TextAlign;
|
||||
using TextWrap;
|
||||
using Text.Wrap;
|
||||
using IconType;
|
||||
using IconPlacement;
|
||||
using ContentAlignment;
|
||||
@@ -91,17 +88,30 @@ settings_menu_open: bool;
|
||||
invite_role: s32 = 1;
|
||||
// The same trash can as Photos and Lumi.
|
||||
TRASH_ICON :: "S1.6rr:M3 6H21M9 6V3H15V6M5 6L6 21H18L19 6M10 10V17M14 10V17"
|
||||
// As in 1List, a tap on an item finishes it, a swipe right edits it and a
|
||||
// swipe left deletes it; Undo brings a deleted item back.
|
||||
row_swipe: SwipeRowState;
|
||||
// A short swipe right completes or reopens an item; a long one edits it.
|
||||
// Swiping left deletes it; Undo brings a deleted item back.
|
||||
row_swipe: SwipeRow.SwipeRowState;
|
||||
// A task row's context menu, opened where the pointer was released.
|
||||
LISTS_ROW_MENU_CHECK :: 1
|
||||
LISTS_ROW_MENU_EDIT :: 2
|
||||
row_menu_open: bool;
|
||||
row_menu_index: s32;
|
||||
row_menu_x: float32;
|
||||
row_menu_y: float32;
|
||||
custom_task_scroll: s32;
|
||||
|
||||
EditSwipe :: () -> SwipeRowAction {
|
||||
return SwipeRowAction.{.fill = Color.{58, 110, 165, 255},
|
||||
CompleteSwipe :: () -> SwipeRow.SwipeRowAction {
|
||||
return SwipeRow.SwipeRowAction.{.fill = Color.{46, 139, 120, 255},
|
||||
.icon_shape = CompleteIcon.Shape, .icon_color = Color.{255, 255, 255, 255}}
|
||||
}
|
||||
|
||||
EditSwipe :: () -> SwipeRow.SwipeRowAction {
|
||||
return SwipeRow.SwipeRowAction.{.fill = Color.{58, 110, 165, 255},
|
||||
.icon_shape = EditIcon.Shape, .icon_color = Color.{255, 255, 255, 255}}
|
||||
}
|
||||
|
||||
DeleteSwipe :: () -> SwipeRowAction {
|
||||
return SwipeRowAction.{.fill = Color.{198, 52, 52, 255},
|
||||
DeleteSwipe :: () -> SwipeRow.SwipeRowAction {
|
||||
return SwipeRow.SwipeRowAction.{.fill = Color.{198, 52, 52, 255},
|
||||
.icon_shape = TRASH_ICON, .icon_color = Color.{255, 255, 255, 255}, .removes = true}
|
||||
}
|
||||
|
||||
@@ -122,20 +132,21 @@ AvatarFill :: (place: s32) -> Color {
|
||||
// A person's profile picture, or a round avatar with the first letter of
|
||||
// their name when they have not chosen one.
|
||||
Avatar :: (key: u64, name: string, place: s32, x: s32, y: s32, size: s32, icon: s32) {
|
||||
if (icon >= 41 && icon <= 65) || (icon >= 124 && icon <= 126) {
|
||||
picture := ImageForIcon(icon, Bounds(x, y, size, size), name)
|
||||
// Pictures chosen in any app, Entity's abstract ones included.
|
||||
if EntityPublicIconChosen(icon) {
|
||||
picture := EntityIconImage(icon, Bounds(x, y, size, size), name)
|
||||
picture.key = key
|
||||
Image(frame.session, picture)
|
||||
Image.Draw(frame.session, picture)
|
||||
return
|
||||
}
|
||||
Box(frame.session, BoxProps.{.key = key, .bounds = Bounds(x, y, size, size),
|
||||
Box.Draw(frame.session, Box.Props.{.key = key, .bounds = Bounds(x, y, size, size),
|
||||
.fill = AvatarFill(place), .radius = cast(float32)size / 2.0})
|
||||
letter_end: s64 = 1
|
||||
while letter_end < name.count && (name[letter_end] & cast(u8)192) == cast(u8)128 {
|
||||
letter_end += 1
|
||||
}
|
||||
letter := ifx name.count > 0 then name[:letter_end] else "?"
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, y, size, size), .text = letter,
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y, size, size), .text = letter,
|
||||
.align = cast(TextAlign)TextAlignCenter, .vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
}
|
||||
|
||||
@@ -158,6 +169,43 @@ BeginInput :: (item: s32, value: string) {
|
||||
frame.focused = true
|
||||
}
|
||||
|
||||
BeginCustomTask :: (item: s32, title: string, comment: string) {
|
||||
row_menu_open = false
|
||||
BeginInput(item, ListsTitleWithoutPriority(title))
|
||||
frame.comment_value = comment
|
||||
frame.comment_cursor = cast(s32)comment.count
|
||||
frame.comment_anchor = frame.comment_cursor
|
||||
frame.comment_scroll_y = 0
|
||||
frame.comment_focused = false
|
||||
frame.task_priority = ListsPriorityForTitle(title)
|
||||
frame.panel = 3
|
||||
custom_task_scroll = 0
|
||||
field_focus_request = true
|
||||
}
|
||||
|
||||
CloseCustomTask :: () {
|
||||
frame.panel = 0
|
||||
frame.value = ""
|
||||
frame.comment_value = ""
|
||||
frame.task_priority = 0
|
||||
frame.focused = false
|
||||
frame.comment_focused = false
|
||||
state.editing_item = -1
|
||||
state.reset_input = true
|
||||
custom_task_scroll = 0
|
||||
}
|
||||
|
||||
SaveCustomTask :: () {
|
||||
if ListsTitleWithoutPriority(frame.value).count == 0 { return }
|
||||
if !ListsTitlePriorityFits(frame.value, frame.task_priority, LISTS_TEXT_LIMIT) {
|
||||
return
|
||||
}
|
||||
Mutation(LISTS_COMMIT, -1)
|
||||
if state.remote && state.request_body.count > 0 {
|
||||
CloseCustomTask()
|
||||
}
|
||||
}
|
||||
|
||||
// Remembers a deleted item's name for a few seconds so Undo can restore it.
|
||||
RememberDeleted :: (row: ListsUiRow) {
|
||||
undo_item = row
|
||||
@@ -206,6 +254,12 @@ Mutation :: (action: s32, index: s32) {
|
||||
}
|
||||
if action == LISTS_COMMIT {
|
||||
state.title = frame.value
|
||||
if frame.panel == 3 {
|
||||
state.title = ListsTitleForPriority(frame.value, frame.task_priority)
|
||||
state.comment = frame.comment_value
|
||||
} else {
|
||||
state.comment = ""
|
||||
}
|
||||
}
|
||||
if state.selected_list >= 0 && state.selected_list < state.list_count &&
|
||||
state.editing_item != -2 && ReadListsRowHost(state.selected_list, false).shared {
|
||||
@@ -225,11 +279,12 @@ Field :: (bounds: Rectangle, placeholder: string, read_only: bool = false) -> bo
|
||||
input.focus = true
|
||||
field_focus_request = false
|
||||
}
|
||||
edited := TextField(frame.session, TextFieldProps.{.key = cast(u64)6501,
|
||||
edited := TextField.Draw(frame.session, TextField.Props.{.key = cast(u64)6501,
|
||||
.bounds = bounds, .value = frame.value, .placeholder = placeholder, .cursor = frame.cursor,
|
||||
.anchor = frame.anchor, .scroll_x = frame.scroll_x,
|
||||
.focused = frame.focused, .focus_id = 6501,
|
||||
.max_bytes = 127, .max_codepoints = 127, .input = input,
|
||||
.max_bytes = LISTS_TEXT_LIMIT, .max_codepoints = LISTS_TEXT_LIMIT,
|
||||
.input = input,
|
||||
.disabled = frame.sharing_busy || frame.sharing_pending || read_only})
|
||||
if edited.edit.changed {
|
||||
start := edited.edit.start
|
||||
@@ -240,7 +295,7 @@ Field :: (bounds: Rectangle, placeholder: string, read_only: bool = false) -> bo
|
||||
BuilderPrint(*value, "%", edited.edit.replacement)
|
||||
BuilderPrint(*value, "%", frame.value[end:])
|
||||
replacement := BuilderFinish(value)
|
||||
if replacement.count <= 127 {
|
||||
if replacement.count <= LISTS_TEXT_LIMIT {
|
||||
frame.value = replacement
|
||||
}
|
||||
}
|
||||
@@ -249,12 +304,54 @@ Field :: (bounds: Rectangle, placeholder: string, read_only: bool = false) -> bo
|
||||
frame.anchor = edited.anchor
|
||||
frame.scroll_x = edited.scroll_x
|
||||
frame.focused = edited.focused
|
||||
if edited.focused {
|
||||
frame.comment_focused = false
|
||||
frame.comment_input.blur = true
|
||||
}
|
||||
frame.clipboard_write = edited.clipboard_write
|
||||
frame.clipboard_text = edited.clipboard_text
|
||||
field_escaped = edited.escaped
|
||||
return edited.committed
|
||||
}
|
||||
|
||||
DescriptionField :: (bounds: Rectangle, placeholder: string, read_only: bool = false) -> bool {
|
||||
input := frame.comment_input
|
||||
edited := TextArea.Draw(frame.session, TextArea.Props.{.key = cast(u64)6552,
|
||||
.bounds = bounds, .value = frame.comment_value, .placeholder = placeholder,
|
||||
.cursor = frame.comment_cursor, .anchor = frame.comment_anchor,
|
||||
.scroll_y = frame.comment_scroll_y, .focused = frame.comment_focused,
|
||||
.focus_id = 6552, .max_bytes = LISTS_TEXT_LIMIT,
|
||||
.max_codepoints = LISTS_TEXT_LIMIT, .wrap = true, .input = input,
|
||||
.disabled = frame.sharing_busy || frame.sharing_pending || read_only})
|
||||
if edited.edit.changed {
|
||||
start := edited.edit.start
|
||||
end := edited.edit.end
|
||||
if start >= 0 && end >= start && end <= frame.comment_value.count {
|
||||
value: Vec(u8)
|
||||
BuilderPrint(*value, "%", frame.comment_value[:start])
|
||||
BuilderPrint(*value, "%", edited.edit.replacement)
|
||||
BuilderPrint(*value, "%", frame.comment_value[end:])
|
||||
replacement := BuilderFinish(value)
|
||||
if replacement.count <= LISTS_TEXT_LIMIT {
|
||||
frame.comment_value = replacement
|
||||
}
|
||||
}
|
||||
}
|
||||
frame.comment_cursor = edited.cursor
|
||||
frame.comment_anchor = edited.anchor
|
||||
frame.comment_scroll_y = edited.scroll_y
|
||||
frame.comment_focused = edited.focused
|
||||
if edited.focused {
|
||||
frame.focused = false
|
||||
frame.input.blur = true
|
||||
}
|
||||
if edited.clipboard_write {
|
||||
frame.clipboard_write = true
|
||||
frame.clipboard_text = edited.clipboard_text
|
||||
}
|
||||
return edited.escaped
|
||||
}
|
||||
|
||||
Remote :: (action: s32, target: string = "", invitation: string = "",
|
||||
invitation_list: string = "", access: string = "") {
|
||||
state.action = action
|
||||
@@ -270,7 +367,8 @@ Remote :: (action: s32, target: string = "", invitation: string = "",
|
||||
state.request_body = PrepareListsCommandHost(ListsUiRequest.{
|
||||
.action = action, .index = state.index, .editing_item = state.editing_item,
|
||||
.selected_list = state.selected_list, .done = state.done,
|
||||
.value = ifx action == LISTS_RESTORE_ITEM then state.title else frame.value,
|
||||
.value = ifx action == LISTS_COMMIT || action == LISTS_RESTORE_ITEM
|
||||
then state.title else frame.value,
|
||||
.next_id = frame.next_id, .item_id = state.id, .comment = state.comment,
|
||||
.target = target, .invitation = invitation, .list_id = list.id, .access = access})
|
||||
}
|
||||
@@ -346,7 +444,7 @@ InviteField :: (x: s32, y: s32, width: s32, disabled: bool) -> bool {
|
||||
previous_bytes: [128]u8
|
||||
unused CopyCString(invite_text, previous_bytes[:])
|
||||
previous := TextUntilNul(previous_bytes[:])
|
||||
edited := TextField(frame.session, TextFieldProps.{.key = cast(u64)6540,
|
||||
edited := TextField.Draw(frame.session, TextField.Props.{.key = cast(u64)6540,
|
||||
.bounds = Bounds(x, y, field_width, Scale(44)),
|
||||
.value = previous, .placeholder = ListsLocaleHost("elist_invite_by_name"),
|
||||
.cursor = invite_cursor, .anchor = invite_anchor, .scroll_x = invite_scroll,
|
||||
@@ -380,7 +478,7 @@ InviteField :: (x: s32, y: s32, width: s32, disabled: bool) -> bool {
|
||||
if edited.escaped {
|
||||
invite_suggestions = false
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6541,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6541,
|
||||
.bounds = Bounds(x + width - button_width, row_y, button_width, Scale(44)),
|
||||
.label = ListsLocaleHost("elist_invite"),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent,
|
||||
@@ -401,11 +499,11 @@ InviteRole :: (disabled: bool) {
|
||||
return
|
||||
}
|
||||
labels: [3]string = .[ListsLocaleHost("elist_owner"), ListsLocaleHost("elist_can_edit"), ListsLocaleHost("elist_read_only")]
|
||||
options: [3]DropdownOption
|
||||
options: [3]Dropdown.Option
|
||||
for index: cast(s32)0..2 {
|
||||
options[index] = DropdownOption.{.key = cast(u64)(index + 1), .label = labels[index]}
|
||||
options[index] = Dropdown.Option.{.key = cast(u64)(index + 1), .label = labels[index]}
|
||||
}
|
||||
chosen := Dropdown(frame.session, DropdownProps.{.key = cast(u64)6543,
|
||||
chosen := Dropdown.Draw(frame.session, Dropdown.Props.{.key = cast(u64)6543,
|
||||
.bounds = invite_role_bounds, .selected_index = invite_role,
|
||||
.disabled = disabled, .scale = frame.scale}, options[:3])
|
||||
if chosen.open {
|
||||
@@ -421,7 +519,7 @@ InviteSuggestions :: (x: s32, y: s32, list_id: string, owner: string) {
|
||||
if !invite_suggestions || invite_text.count == 0 {
|
||||
return
|
||||
}
|
||||
options: [8]ContextMenuItem
|
||||
options: [8]ContextMenu.ContextMenuItem
|
||||
names: [8][128]u8
|
||||
targets: [8][65]u8
|
||||
count: s32 = 0
|
||||
@@ -437,17 +535,17 @@ InviteSuggestions :: (x: s32, y: s32, list_id: string, owner: string) {
|
||||
}
|
||||
names[count] = alias
|
||||
targets[count] = id
|
||||
options[count] = ContextMenuItem.{.id = count + 1, .label = TextUntilNul(names[count][:])}
|
||||
options[count] = ContextMenu.ContextMenuItem.{.id = count + 1, .label = TextUntilNul(names[count][:])}
|
||||
count += 1
|
||||
if count == 8 {
|
||||
break
|
||||
}
|
||||
}
|
||||
if count == 0 {
|
||||
options[0] = ContextMenuItem.{.id = 1, .label = ListsLocaleHost("elist_no_matches"), .disabled = true}
|
||||
options[0] = ContextMenu.ContextMenuItem.{.id = 1, .label = ListsLocaleHost("elist_no_matches"), .disabled = true}
|
||||
count = 1
|
||||
}
|
||||
result := ContextMenu(frame.session, ContextMenuProps.{.key = cast(u64)6542,
|
||||
result := ContextMenu.Draw(frame.session, ContextMenu.Props.{.key = cast(u64)6542,
|
||||
.open = true, .x = cast(float32)x, .y = cast(float32)y,
|
||||
.escape = frame.input.escape, .scale = frame.scale}, options[:count])
|
||||
if result.activated_id > 0 && result.activated_id <= count && !options[result.activated_id - 1].disabled {
|
||||
@@ -488,8 +586,8 @@ MemberRow :: (row: ListsUiPerson, place: s32, x: s32, y: s32, width: s32, manage
|
||||
Avatar(cast(u64)(7900 + place), shown, place, x, y + (Scale(MEMBER_ROW) - avatar) / 2, avatar, icon)
|
||||
role_width := Scale(140)
|
||||
name_x := x + avatar + Scale(12)
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(name_x, y, x + width - role_width - Scale(8) - name_x, Scale(MEMBER_ROW)),
|
||||
.text = shown, .vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(name_x, y, x + width - role_width - Scale(8) - name_x, Scale(MEMBER_ROW)),
|
||||
.text = shown, .vertical_align = cast(TextAlign)TextAlignCenter, .wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
role: s32 = ifx original_owner || row.access == "owner" then 0 else ifx row.access == "viewer" then 2 else 1
|
||||
labels: [3]string = .[ListsLocaleHost("elist_owner"), ListsLocaleHost("elist_can_edit"), ListsLocaleHost("elist_read_only")]
|
||||
bounds := Bounds(x + width - role_width, y + (Scale(MEMBER_ROW) - Scale(40)) / 2, role_width, Scale(40))
|
||||
@@ -499,7 +597,7 @@ MemberRow :: (row: ListsUiPerson, place: s32, x: s32, y: s32, width: s32, manage
|
||||
unused VecPush(sharing_controls, SharingAccessControl.{.target = target,
|
||||
.bounds = bounds, .role = role, .disabled = disabled})
|
||||
} else {
|
||||
Text(frame.session, TextProps.{.bounds = bounds, .text = labels[role],
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = bounds, .text = labels[role],
|
||||
.align = cast(TextAlign)TextAlignEnd, .vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.disabled = true})
|
||||
}
|
||||
@@ -507,14 +605,14 @@ MemberRow :: (row: ListsUiPerson, place: s32, x: s32, y: s32, width: s32, manage
|
||||
|
||||
SharingAccessControls :: () -> bool {
|
||||
labels: [3]string = .[ListsLocaleHost("elist_owner"), ListsLocaleHost("elist_can_edit"), ListsLocaleHost("elist_read_only")]
|
||||
options: [4]DropdownOption
|
||||
options: [4]Dropdown.Option
|
||||
for index: cast(s32)0..2 {
|
||||
options[index] = DropdownOption.{.key = cast(u64)(index + 1), .label = labels[index]}
|
||||
options[index] = Dropdown.Option.{.key = cast(u64)(index + 1), .label = labels[index]}
|
||||
}
|
||||
options[3] = DropdownOption.{.key = cast(u64)4, .label = ListsLocaleHost("elist_remove_access"), .separator_before = true}
|
||||
options[3] = Dropdown.Option.{.key = cast(u64)4, .label = ListsLocaleHost("elist_remove_access"), .separator_before = true}
|
||||
for control: sharing_controls {
|
||||
target := TextUntilNul(control.target[:])
|
||||
changed := Dropdown(frame.session, DropdownProps.{.key = KeyHash(target),
|
||||
changed := Dropdown.Draw(frame.session, Dropdown.Props.{.key = Layout.KeyHash(target),
|
||||
.bounds = control.bounds, .selected_index = control.role,
|
||||
.disabled = control.disabled, .scale = frame.scale}, options[:4])
|
||||
if changed.open {
|
||||
@@ -553,11 +651,14 @@ InvitationsDialog :: () {
|
||||
if height > frame.height - frame.bottom - Scale(32) {
|
||||
height = frame.height - frame.bottom - Scale(32)
|
||||
}
|
||||
dialog := ModalFrame(frame.session, ModalFrameProps.{.key = cast(u64)6520,
|
||||
dialog := Modal.Draw(frame.session, Modal.Props.{.key = cast(u64)6520,
|
||||
.title = ListsLocaleHost("elist_invitations"),
|
||||
.width = width, .height = height, .scale = frame.scale,
|
||||
.has_right_action = true, .right_label = ListsLocaleHost("close_button")})
|
||||
if dialog.dismissed || dialog.right_clicked {
|
||||
if dialog.opened {
|
||||
End(frame.session)
|
||||
}
|
||||
frame.panel = 0
|
||||
frame.focused = false
|
||||
sharing_scroll = 0
|
||||
@@ -571,20 +672,20 @@ InvitationsDialog :: () {
|
||||
content_width := cast(s32)dialog.layout.content.width
|
||||
bottom := cast(s32)(dialog.layout.content.y + dialog.layout.content.height)
|
||||
disabled := frame.sharing_busy || frame.sharing_pending
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, y, content_width, Scale(32)),
|
||||
.text = detail, .wrap = cast(TextWrap)TextWrapAuto})
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y, content_width, Scale(32)),
|
||||
.text = detail, .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
y += Scale(40)
|
||||
if !frame.connected {
|
||||
End(frame.session)
|
||||
return
|
||||
}
|
||||
if count == 0 {
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, y, content_width, Scale(44)),
|
||||
.text = ListsLocaleHost("elist_no_invitations"), .wrap = cast(TextWrap)TextWrapAuto})
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y, content_width, Scale(44)),
|
||||
.text = ListsLocaleHost("elist_no_invitations"), .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
End(frame.session)
|
||||
return
|
||||
}
|
||||
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)6512,
|
||||
scroll := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)6512,
|
||||
.bounds = Bounds(x, y, content_width, bottom - y),
|
||||
.content_height = count * row_height, .scroll_offset = sharing_scroll})
|
||||
sharing_scroll = scroll.scroll_offset
|
||||
@@ -609,6 +710,97 @@ InvitationsDialog :: () {
|
||||
End(frame.session)
|
||||
}
|
||||
|
||||
CustomTaskDialog :: () {
|
||||
width := frame.width - Scale(32)
|
||||
if width > Scale(440) {
|
||||
width = Scale(440)
|
||||
}
|
||||
height := Scale(404)
|
||||
available := frame.height - frame.bottom - Scale(32)
|
||||
if available < height { height = available }
|
||||
dialog := Modal.Draw(frame.session, Modal.Props.{.key = cast(u64)6550,
|
||||
.title = ListsLocaleHost("elist_custom_task"), .width = width,
|
||||
.height = height, .scale = frame.scale})
|
||||
if dialog.dismissed {
|
||||
CloseCustomTask()
|
||||
return
|
||||
}
|
||||
if !dialog.opened {
|
||||
return
|
||||
}
|
||||
current: ListsUiRow
|
||||
blocked := frame.sharing_busy || frame.sharing_pending
|
||||
if state.selected_list >= 0 && state.selected_list < state.list_count {
|
||||
current = ReadListsRowHost(state.selected_list, false)
|
||||
blocked = blocked || current.read_only || current.incomplete
|
||||
} else {
|
||||
blocked = true
|
||||
}
|
||||
x := cast(s32)dialog.layout.content.x
|
||||
y := cast(s32)dialog.layout.content.y
|
||||
content_width := cast(s32)dialog.layout.content.width
|
||||
scroll := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)6555,
|
||||
.bounds = Bounds(x, y, content_width, cast(s32)dialog.layout.content.height),
|
||||
.content_height = Scale(350), .scroll_offset = custom_task_scroll,
|
||||
.scale = frame.scale})
|
||||
custom_task_scroll = scroll.scroll_offset
|
||||
if !scroll.opened {
|
||||
End(frame.session)
|
||||
return
|
||||
}
|
||||
x = cast(s32)scroll.content.x
|
||||
y = cast(s32)scroll.content.y
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y, content_width, Scale(20)),
|
||||
.text = ListsLocaleHost("elist_task_label")})
|
||||
task_committed := Field(Bounds(x, y + Scale(24), content_width, Scale(44)),
|
||||
ListsLocaleHost("elist_item_name_placeholder"), blocked)
|
||||
task_escaped := field_escaped
|
||||
y += Scale(76)
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y, content_width, Scale(20)),
|
||||
.text = ListsLocaleHost("habit_description_label")})
|
||||
description_escaped := DescriptionField(Bounds(x, y + Scale(24), content_width, Scale(112)),
|
||||
ListsLocaleHost("habit_description_label"), blocked)
|
||||
y += Scale(144)
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y, content_width - Scale(132), Scale(44)),
|
||||
.text = ListsLocaleHost("elist_priority_label"),
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
options: [27]Dropdown.Option
|
||||
options[0].label = ListsLocaleHost("profile_none_label")
|
||||
alphabet := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
for index: cast(s32)1..26 {
|
||||
options[index].label = alphabet[index - 1:index]
|
||||
}
|
||||
chosen := Dropdown.Draw(frame.session, Dropdown.Props.{.key = cast(u64)6551,
|
||||
.bounds = Bounds(x + content_width - Scale(124), y, Scale(124), Scale(44)),
|
||||
.selected_index = frame.task_priority, .disabled = blocked,
|
||||
.scale = frame.scale}, options[:27])
|
||||
if chosen.changed {
|
||||
frame.task_priority = chosen.selected_index
|
||||
}
|
||||
y += Scale(54)
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y, content_width, Scale(24)),
|
||||
.text = "+project @context due:YYYY-MM-DD", .disabled = true})
|
||||
y += Scale(32)
|
||||
button_width := (content_width - Scale(8)) / 2
|
||||
save := Button.Draw(frame.session, Button.Props.{.key = cast(u64)6553,
|
||||
.bounds = Bounds(x, y, button_width, Scale(44)),
|
||||
.label = ListsLocaleHost("save_button"),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled,
|
||||
.disabled = ListsTitleWithoutPriority(frame.value).count == 0 || blocked ||
|
||||
!ListsTitlePriorityFits(frame.value, frame.task_priority, LISTS_TEXT_LIMIT)}) != 0
|
||||
cancel := Button.Draw(frame.session, Button.Props.{.key = cast(u64)6554,
|
||||
.bounds = Bounds(x + button_width + Scale(8), y, button_width, Scale(44)),
|
||||
.label = ListsLocaleHost("cancel_button")}) != 0
|
||||
if task_escaped || description_escaped || cancel {
|
||||
CloseCustomTask()
|
||||
} else if save || task_committed {
|
||||
SaveCustomTask()
|
||||
}
|
||||
End(frame.session)
|
||||
End(frame.session)
|
||||
}
|
||||
|
||||
// An invitation to a list, who sent it, and Accept and Decline. True once
|
||||
// one is chosen.
|
||||
InvitationRow :: (row: ListsUiPerson, index: s32, x: s32, y: s32, width: s32, disabled: bool) -> bool {
|
||||
@@ -616,24 +808,24 @@ InvitationRow :: (row: ListsUiPerson, index: s32, x: s32, y: s32, width: s32, di
|
||||
if alias.count == 0 {
|
||||
alias = row.owner
|
||||
}
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)(7800 + index),
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)(7800 + index),
|
||||
.bounds = Bounds(x, y + Scale(4), width, Scale(144)),
|
||||
.border = Color.{128, 128, 128, 64}, .radius = cast(float32)Scale(12)})
|
||||
x += Scale(16)
|
||||
width -= Scale(32)
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, y + Scale(14), width, Scale(44)),
|
||||
.text = row.title, .font = Scale(18), .wrap = cast(TextWrap)TextWrapAuto})
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y + Scale(14), width, Scale(44)),
|
||||
.text = row.title, .size = Scale(18), .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
sender: Vec(u8)
|
||||
BuilderPrint(*sender, "%: %", ListsLocaleHost("elist_invitation_from"), alias)
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, y + Scale(60), width, Scale(24)),
|
||||
.text = BuilderFinish(sender), .font = Scale(13), .wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y + Scale(60), width, Scale(24)),
|
||||
.text = BuilderFinish(sender), .size = Scale(13), .wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
button_width := (width - Scale(12)) / 2
|
||||
accept := Button(frame.session, ButtonProps.{.key = cast(u64)(7600 + index * 2),
|
||||
accept := Button.Draw(frame.session, Button.Props.{.key = cast(u64)(7600 + index * 2),
|
||||
.bounds = Bounds(x, y + Scale(92), button_width, Scale(44)),
|
||||
.label = ListsLocaleHost("profile_friend_accept_button"),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent, .emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled,
|
||||
.disabled = disabled || state.list_count >= 32}) != 0
|
||||
decline := Button(frame.session, ButtonProps.{.key = cast(u64)(7601 + index * 2),
|
||||
decline := Button.Draw(frame.session, Button.Props.{.key = cast(u64)(7601 + index * 2),
|
||||
.bounds = Bounds(x + button_width + Scale(12), y + Scale(92), button_width, Scale(44)),
|
||||
.label = ListsLocaleHost("profile_friend_decline_button"), .disabled = disabled,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
@@ -658,9 +850,14 @@ ListsView :: (message: ListsMessage) -> ListsMessage {
|
||||
if settings_open && (state.selected_list < 0 || state.selected_list >= state.list_count) {
|
||||
CloseSettings()
|
||||
}
|
||||
// A successful list save resets editing in the applied message. The next
|
||||
// frame therefore leaves settings, while a failed save keeps editing_item.
|
||||
if settings_open && state.editing_item != -3 {
|
||||
CloseSettings()
|
||||
}
|
||||
input := frame.input
|
||||
if frame.panel != 0 {
|
||||
frame.input = TextFieldInput.{}
|
||||
if frame.panel == 2 {
|
||||
frame.input = TextField.Input.{}
|
||||
frame.focused = false
|
||||
}
|
||||
if settings_open {
|
||||
@@ -672,12 +869,16 @@ ListsView :: (message: ListsMessage) -> ListsMessage {
|
||||
if frame.panel == 2 {
|
||||
InvitationsDialog()
|
||||
}
|
||||
if frame.panel == 3 {
|
||||
CustomTaskDialog()
|
||||
}
|
||||
return Finish()
|
||||
}
|
||||
|
||||
// List settings opens with its name ready to change but no keyboard.
|
||||
OpenSettings :: (title: string) {
|
||||
settings_open = true
|
||||
row_menu_open = false
|
||||
settings_scroll = 0
|
||||
delete_confirm = false
|
||||
invite_role = 1
|
||||
@@ -718,7 +919,7 @@ ListChips :: (x: s32, y: s32, width: s32, blocked: bool) -> ListChipsResult {
|
||||
chip_width[index] = chip_height
|
||||
if index < state.list_count {
|
||||
label := ReadListsRowHost(index, false).title
|
||||
chip_width[index] = TextWidth(frame.session, TextProps.{.text = label}) + padding * 2
|
||||
chip_width[index] = TextWidth(frame.session, Text.Props.{.text = label}) + padding * 2
|
||||
// The selected chip carries the gear that opens List settings.
|
||||
if index == state.selected_list {
|
||||
chip_width[index] += Scale(26)
|
||||
@@ -738,7 +939,7 @@ ListChips :: (x: s32, y: s32, width: s32, blocked: bool) -> ListChipsResult {
|
||||
rows := row + 1
|
||||
shown_rows := ifx rows > 3 then 3 else rows
|
||||
result.height = shown_rows * chip_height + (shown_rows - 1) * gap
|
||||
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)6500,
|
||||
scroll := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)6500,
|
||||
.bounds = Bounds(x, y, width, result.height),
|
||||
.content_height = rows * chip_height + (rows - 1) * gap,
|
||||
.scroll_offset = frame.tab_scroll})
|
||||
@@ -750,7 +951,7 @@ ListChips :: (x: s32, y: s32, width: s32, blocked: bool) -> ListChipsResult {
|
||||
bounds := Bounds(x + chip_x[index], cast(s32)scroll.content.y + chip_row[index] * (chip_height + gap),
|
||||
chip_width[index], chip_height)
|
||||
if index == state.list_count {
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6505, .bounds = bounds,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6505, .bounds = bounds,
|
||||
.label = ListsLocaleHost("elist_new_list"), .icon_type = cast(s32)IconPlus,
|
||||
.icon_only = true, .pill = true,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisOutline,
|
||||
@@ -763,7 +964,7 @@ ListChips :: (x: s32, y: s32, width: s32, blocked: bool) -> ListChipsResult {
|
||||
}
|
||||
chosen := index == state.selected_list
|
||||
title := ReadListsRowHost(index, false).title
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)(6800 + index), .bounds = bounds,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)(6800 + index), .bounds = bounds,
|
||||
.label = title, .pill = true, .selected = chosen,
|
||||
.icon_shape = ifx chosen then SettingsIcon.Shape else "",
|
||||
.icon_placement = cast(IconPlacement)IconPlacementTrailing,
|
||||
@@ -813,18 +1014,19 @@ ListSettingsPage :: () {
|
||||
CloseSettings()
|
||||
return
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6550,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6550,
|
||||
.bounds = Bounds(x, y, Scale(44), Scale(44)),
|
||||
.label = ListsLocaleHost("back_button"), .icon_shape = BackIcon.Shape, .icon_only = true,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
CloseSettings()
|
||||
return
|
||||
}
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x + Scale(56), y, width - Scale(56), Scale(44)),
|
||||
.text = ListsLocaleHost("elist_settings"), .font = Scale(20),
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x + Scale(56), y, width - Scale(56), Scale(44)),
|
||||
.text = ListsLocaleHost("elist_settings"), .size = Scale(20),
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
y += Scale(60)
|
||||
// After Save the host clears the field; it opens again with the new name.
|
||||
// Save reports through the applied message before the next frame closes
|
||||
// settings, so a failed write can keep the edited name.
|
||||
if state.editing_item != -3 {
|
||||
BeginInput(-3, title)
|
||||
frame.focused = false
|
||||
@@ -845,7 +1047,7 @@ ListSettingsPage :: () {
|
||||
if owns {
|
||||
content += ifx delete_confirm then Scale(170) else Scale(52)
|
||||
}
|
||||
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)6560,
|
||||
scroll := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)6560,
|
||||
.bounds = Bounds(x, y, width, frame.height - frame.bottom - y - Scale(12)),
|
||||
.content_height = content, .scroll_offset = settings_scroll})
|
||||
settings_scroll = scroll.scroll_offset
|
||||
@@ -854,7 +1056,7 @@ ListSettingsPage :: () {
|
||||
return
|
||||
}
|
||||
cy := cast(s32)scroll.content.y
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, cy, inner, Scale(24)),
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, cy, inner, Scale(24)),
|
||||
.text = ListsLocaleHost("elist_list_name_placeholder"), .disabled = true})
|
||||
cy += Scale(28)
|
||||
if invite_focused {
|
||||
@@ -863,7 +1065,7 @@ ListSettingsPage :: () {
|
||||
committed := Field(Bounds(x, cy, inner - Scale(96), Scale(44)),
|
||||
ListsLocaleHost("elist_list_name_placeholder"), read_only || blocked)
|
||||
renamed := frame.value.count > 0 && frame.value != title && !read_only && !blocked
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6551,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6551,
|
||||
.bounds = Bounds(x + inner - Scale(88), cy, Scale(88), Scale(44)),
|
||||
.label = ListsLocaleHost("save_button"),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent, .emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled,
|
||||
@@ -874,12 +1076,12 @@ ListSettingsPage :: () {
|
||||
return
|
||||
}
|
||||
cy += Scale(72)
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, cy, inner, Scale(24)),
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, cy, inner, Scale(24)),
|
||||
.text = ListsLocaleHost("elist_people_with_access"), .disabled = true})
|
||||
cy += Scale(32)
|
||||
if !frame.connected {
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, cy, inner, Scale(64)),
|
||||
.text = ListsLocaleHost("elist_connect"), .wrap = cast(TextWrap)TextWrapAuto})
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, cy, inner, Scale(64)),
|
||||
.text = ListsLocaleHost("elist_connect"), .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
cy += Scale(64)
|
||||
} else {
|
||||
owner_name := ifx owner_alias.count > 0 then owner_alias else owner_id
|
||||
@@ -911,7 +1113,7 @@ ListSettingsPage :: () {
|
||||
}
|
||||
// Only the owner deletes, and only after a second, explicit answer.
|
||||
if owns && !delete_confirm {
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6515,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6515,
|
||||
.bounds = Bounds(x, cy, inner, Scale(44)),
|
||||
.label = ListsLocaleHost("elist_delete_list"), .icon_shape = TRASH_ICON,
|
||||
.tone = cast(ButtonTone)ButtonToneDanger,
|
||||
@@ -919,20 +1121,20 @@ ListSettingsPage :: () {
|
||||
delete_confirm = true
|
||||
}
|
||||
} else if owns {
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)6518, .bounds = Bounds(x, cy, inner, Scale(160)),
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)6518, .bounds = Bounds(x, cy, inner, Scale(160)),
|
||||
.border = Color.{198, 52, 52, 160}, .radius = cast(float32)Scale(12)})
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x + Scale(16), cy + Scale(12), inner - Scale(32), Scale(30)),
|
||||
.text = ListsLocaleHost("elist_delete_question"), .font = Scale(18)})
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x + Scale(16), cy + Scale(44), inner - Scale(32), Scale(48)),
|
||||
.text = ListsLocaleHost("elist_delete_detail"), .wrap = cast(TextWrap)TextWrapAuto,
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x + Scale(16), cy + Scale(12), inner - Scale(32), Scale(30)),
|
||||
.text = ListsLocaleHost("elist_delete_question"), .size = Scale(18)})
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x + Scale(16), cy + Scale(44), inner - Scale(32), Scale(48)),
|
||||
.text = ListsLocaleHost("elist_delete_detail"), .wrap = cast(Text.Wrap)TextWrapAuto,
|
||||
.disabled = true})
|
||||
button_width := (inner - Scale(44)) / 2
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6514,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6514,
|
||||
.bounds = Bounds(x + Scale(16), cy + Scale(100), button_width, Scale(44)),
|
||||
.label = ListsLocaleHost("cancel_button")}) != 0 {
|
||||
delete_confirm = false
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6516,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6516,
|
||||
.bounds = Bounds(x + Scale(28) + button_width, cy + Scale(100), button_width, Scale(44)),
|
||||
.label = ListsLocaleHost("elist_delete_list"),
|
||||
.tone = cast(ButtonTone)ButtonToneDanger,
|
||||
@@ -1026,7 +1228,7 @@ SharedLine :: (current: ListsUiRow, x: s32, y: s32, width: s32) -> bool {
|
||||
Avatar(cast(u64)(7950 + place), names[place], place, x + place * step, y + Scale(4), size, icons[place])
|
||||
}
|
||||
text_x := x + (shown - 1) * step + size + Scale(10)
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6508,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6508,
|
||||
.bounds = Bounds(text_x, y, x + width - text_x, Scale(40)),
|
||||
.label = BuilderFinish(text),
|
||||
.content_alignment = cast(ContentAlignment)ContentAlignmentStart,
|
||||
@@ -1075,10 +1277,10 @@ ListsPage :: () {
|
||||
key = "elist_unavailable"
|
||||
}
|
||||
notice_width := ifx frame.sharing_pending && !frame.sharing_busy then width - Scale(104) else width
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, y, notice_width, Scale(64)),
|
||||
.text = ListsLocaleHost(key), .wrap = cast(TextWrap)TextWrapAuto})
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y, notice_width, Scale(64)),
|
||||
.text = ListsLocaleHost(key), .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
if frame.sharing_pending && !frame.sharing_busy {
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6513,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6513,
|
||||
.bounds = Bounds(x + width - Scale(96), y, Scale(96), Scale(44)),
|
||||
.label = ListsLocaleHost("retry_button")}) != 0 {
|
||||
state.action = LISTS_RETRY
|
||||
@@ -1090,8 +1292,8 @@ ListsPage :: () {
|
||||
}
|
||||
if current.shared && current.incomplete {
|
||||
blocked = true
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, y, width, Scale(64)),
|
||||
.text = ListsLocaleHost("elist_capacity"), .wrap = cast(TextWrap)TextWrapAuto})
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y, width, Scale(64)),
|
||||
.text = ListsLocaleHost("elist_capacity"), .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
y += Scale(72)
|
||||
}
|
||||
if current.read_only && state.editing_item != -2 {
|
||||
@@ -1103,7 +1305,7 @@ ListsPage :: () {
|
||||
if frame.pending_count_text != "0" && frame.pending_count_text != "" {
|
||||
label: Vec(u8)
|
||||
BuilderPrint(*label, "% (%)", ListsLocaleHost("elist_invitations"), frame.pending_count_text)
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6509,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6509,
|
||||
.bounds = Bounds(x, y, width, Scale(44)),
|
||||
.label = BuilderFinish(label),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent}) != 0 {
|
||||
@@ -1115,22 +1317,22 @@ ListsPage :: () {
|
||||
}
|
||||
}
|
||||
if state.input_error != 0 {
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, y, width, Scale(48)),
|
||||
.text = ListsLocaleHost("results_write_failed"), .wrap = cast(TextWrap)TextWrapAuto})
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y, width, Scale(48)),
|
||||
.text = ListsLocaleHost("results_write_failed"), .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
y += Scale(56)
|
||||
}
|
||||
if editing_list {
|
||||
committed := Field(Bounds(x, y, width, Scale(44)),
|
||||
ListsLocaleHost("elist_new_list_placeholder"), blocked)
|
||||
button_width := (width - Scale(8)) / 2
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6506,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6506,
|
||||
.label = ListsLocaleHost("elist_create_list"),
|
||||
.bounds = Bounds(x, y + Scale(56), button_width, Scale(44)),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent, .emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled,
|
||||
.disabled = frame.value.count == 0 || blocked}) != 0 || (committed && !blocked) {
|
||||
Mutation(LISTS_COMMIT, -1)
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6514,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6514,
|
||||
.label = ListsLocaleHost("cancel_button"),
|
||||
.bounds = Bounds(x + button_width + Scale(8), y + Scale(56), button_width, Scale(44)),
|
||||
.disabled = blocked}) != 0 {
|
||||
@@ -1140,39 +1342,46 @@ ListsPage :: () {
|
||||
return
|
||||
}
|
||||
if state.list_count == 0 {
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, y + Scale(32), width, Scale(30)),
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y + Scale(32), width, Scale(30)),
|
||||
.text = ListsLocaleHost("elist_empty_title"), .align = cast(TextAlign)TextAlignCenter})
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, y + Scale(72), width, Scale(64)),
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y + Scale(72), width, Scale(64)),
|
||||
.text = ListsLocaleHost("elist_empty_detail"), .align = cast(TextAlign)TextAlignCenter,
|
||||
.wrap = cast(TextWrap)TextWrapAuto})
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
return
|
||||
}
|
||||
if state.editing_item >= 0 {
|
||||
if frame.panel == 3 {
|
||||
y += Scale(56)
|
||||
} else if state.editing_item >= 0 {
|
||||
// The item's own row holds its field; Escape or Back leaves it.
|
||||
if frame.input.escape {
|
||||
state.editing_item = -1
|
||||
state.reset_input = true
|
||||
frame.focused = false
|
||||
}
|
||||
unused TextField(frame.session, TextFieldProps.{.key = cast(u64)6502,
|
||||
unused TextField.Draw(frame.session, TextField.Props.{.key = cast(u64)6502,
|
||||
.bounds = Bounds(x, y, width - Scale(96), Scale(44)),
|
||||
.placeholder = ListsLocaleHost("elist_add_item_placeholder"), .disabled = true})
|
||||
unused Button(frame.session, ButtonProps.{.key = cast(u64)6510,
|
||||
unused Button.Draw(frame.session, Button.Props.{.key = cast(u64)6510,
|
||||
.label = ListsLocaleHost("elist_add_item"),
|
||||
.bounds = Bounds(x + width - Scale(88), y, Scale(88), Scale(44)),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent, .emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled,
|
||||
.disabled = true})
|
||||
} else {
|
||||
committed := Field(Bounds(x, y, width - Scale(96), Scale(44)),
|
||||
committed := Field(Bounds(x, y, width - Scale(180), Scale(44)),
|
||||
ListsLocaleHost("elist_add_item_placeholder"), blocked)
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6507,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6507,
|
||||
.label = ListsLocaleHost("elist_add_item"),
|
||||
.bounds = Bounds(x + width - Scale(88), y, Scale(88), Scale(44)),
|
||||
.bounds = Bounds(x + width - Scale(176), y, Scale(84), Scale(44)),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent, .emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled,
|
||||
.disabled = frame.value.count == 0 || blocked}) != 0 || (committed && !blocked) {
|
||||
Mutation(LISTS_COMMIT, -1)
|
||||
return
|
||||
}
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6515,
|
||||
.label = ListsLocaleHost("elist_custom_button"),
|
||||
.bounds = Bounds(x + width - Scale(84), y, Scale(84), Scale(44))}) != 0 {
|
||||
BeginCustomTask(-1, "", "")
|
||||
}
|
||||
}
|
||||
y += Scale(56)
|
||||
// Finished items stay out of the way, as in 1List: a pull down on the
|
||||
@@ -1209,7 +1418,7 @@ ListsPage :: () {
|
||||
list_height = Scale(72)
|
||||
}
|
||||
if undo_shown {
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6517,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6517,
|
||||
.label = ListsLocaleHost("elist_undo"),
|
||||
.bounds = Bounds(x, y + list_height + Scale(8), width, Scale(44)),
|
||||
.tone = cast(ButtonTone)ButtonToneAccent,
|
||||
@@ -1258,12 +1467,12 @@ ListsPage :: () {
|
||||
if pull.progress >= 1.0 {
|
||||
key = ifx state.show_completed != 0 then "elist_release_hide" else "elist_release_show"
|
||||
}
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(x, y, width, pull_offset),
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(x, y, width, pull_offset),
|
||||
.text = ListsLocaleHost(key), .align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter, .disabled = true})
|
||||
}
|
||||
shown_finished := ifx state.show_completed != 0 then finished_count else 0
|
||||
scroll := Scroll(frame.session, ScrollProps.{.key = cast(u64)6600,
|
||||
scroll := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)6600,
|
||||
.bounds = Bounds(x, y + pull_offset, width, list_height - pull_offset),
|
||||
.content_height = (shown_finished + open_count) * Scale(72),
|
||||
.scroll_offset = frame.scroll})
|
||||
@@ -1278,7 +1487,7 @@ ListsPage :: () {
|
||||
row_y < cast(s32)(scroll.viewport.y + scroll.viewport.height)
|
||||
// An item being edited becomes a field in its own row, with a
|
||||
// check that saves it.
|
||||
if visible_row && index == state.editing_item {
|
||||
if visible_row && index == state.editing_item && frame.panel != 3 {
|
||||
check_x := row_right - Scale(44)
|
||||
committed := Field(Bounds(x, row_y + Scale(10), check_x - Scale(8) - x, Scale(44)),
|
||||
ListsLocaleHost("elist_item_name_placeholder"), blocked)
|
||||
@@ -1289,7 +1498,7 @@ ListsPage :: () {
|
||||
End(frame.session)
|
||||
return
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)6511,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)6511,
|
||||
.bounds = Bounds(check_x, row_y + Scale(10), Scale(44), Scale(44)),
|
||||
.label = ListsLocaleHost("save_button"), .icon_type = cast(s32)IconCheck,
|
||||
.icon_only = true, .tone = cast(ButtonTone)ButtonToneAccent,
|
||||
@@ -1301,31 +1510,55 @@ ListsPage :: () {
|
||||
}
|
||||
} else if visible_row {
|
||||
row := ReadListsRowHost(index, true)
|
||||
swiped := SwipeRow(frame.session, SwipeRowProps.{.key = cast(u64)(7000 + index * 4),
|
||||
swiped := SwipeRow.Draw(frame.session, SwipeRow.Props.{.key = cast(u64)(7000 + index * 4),
|
||||
.bounds = Bounds(x, row_y, row_right - x, Scale(64)),
|
||||
.label = row.title, .now = state.now, .scale = frame.scale,
|
||||
.start = EditSwipe(), .end = DeleteSwipe(), .disabled = blocked},
|
||||
.start = CompleteSwipe(), .end = DeleteSwipe(),
|
||||
.threshold = 0.5, .end_threshold = 0.35, .long_threshold = 1.0,
|
||||
.start_width = cast(float32)Scale(176), .long_start = EditSwipe(),
|
||||
.disabled = blocked},
|
||||
row_swipe)
|
||||
row_swipe = swiped.state
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)(8200 + index),
|
||||
.bounds = Bounds(row_right - Scale(44), row_y + Scale(10), Scale(44), Scale(44)),
|
||||
.label = ListsLocaleHost("elist_edit_task"), .icon_type = cast(s32)IconEdit,
|
||||
.icon_only = true, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost,
|
||||
.disabled = blocked}) != 0 {
|
||||
BeginCustomTask(index, row.title, row.comment)
|
||||
End(frame.session)
|
||||
return
|
||||
}
|
||||
text_x := x + Scale(12) + cast(s32)swiped.offset
|
||||
text_width := row_right - x - Scale(24)
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(text_x, row_y,
|
||||
text_width := row_right - x - Scale(68)
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(text_x, row_y,
|
||||
text_width, ifx row.comment.count > 0 then Scale(30) else Scale(64)),
|
||||
.text = row.title, .vertical_align = cast(TextAlign)TextAlignCenter,
|
||||
.strikethrough = row.done != 0})
|
||||
if row.comment.count > 0 {
|
||||
Text(frame.session, TextProps.{.bounds = Bounds(text_x, row_y + Scale(34),
|
||||
Text.Draw(frame.session, Text.Props.{.bounds = Bounds(text_x, row_y + Scale(34),
|
||||
text_width, Scale(24)), .text = row.comment})
|
||||
}
|
||||
if swiped.swiped_start {
|
||||
state.done = ifx row.done != 0 then 0 else 1
|
||||
Mutation(LISTS_SET_DONE, index)
|
||||
End(frame.session)
|
||||
return
|
||||
}
|
||||
if swiped.clicked {
|
||||
state.done = ifx row.done != 0 then 0 else 1
|
||||
Mutation(LISTS_SET_DONE, index)
|
||||
End(frame.session)
|
||||
return
|
||||
}
|
||||
if swiped.swiped_start {
|
||||
BeginInput(index, row.title)
|
||||
field_focus_request = true
|
||||
if swiped.right_clicked {
|
||||
row_menu_open = true
|
||||
row_menu_index = index
|
||||
row_menu_x = swiped.pointer_x
|
||||
row_menu_y = swiped.pointer_y
|
||||
}
|
||||
if swiped.swiped_long_start {
|
||||
BeginCustomTask(index, row.title, row.comment)
|
||||
}
|
||||
if swiped.swiped_end {
|
||||
// Deleting leaves Edit, since the items after it move up.
|
||||
@@ -1343,4 +1576,32 @@ ListsPage :: () {
|
||||
}
|
||||
End(frame.session)
|
||||
}
|
||||
RowContextMenu(blocked)
|
||||
}
|
||||
|
||||
// A row's alternative commands. Check is the row's own activation; Edit opens
|
||||
// the same modal as the long swipe.
|
||||
RowContextMenu :: (blocked: bool) {
|
||||
if !row_menu_open || row_menu_index < 0 || row_menu_index >= state.item_count {
|
||||
return
|
||||
}
|
||||
row := ReadListsRowHost(row_menu_index, true)
|
||||
items: [2]ContextMenu.ContextMenuItem = .[
|
||||
ContextMenu.ContextMenuItem.{.id = LISTS_ROW_MENU_CHECK, .label = ListsLocaleHost("elist_check_task"), .disabled = blocked},
|
||||
ContextMenu.ContextMenuItem.{.id = LISTS_ROW_MENU_EDIT, .label = ListsLocaleHost("elist_edit_task"), .disabled = blocked}
|
||||
]
|
||||
menu := ContextMenu.Draw(frame.session, ContextMenu.Props.{.key = cast(u64)8500,
|
||||
.open = true, .x = row_menu_x, .y = row_menu_y,
|
||||
.escape = frame.input.escape, .scale = frame.scale}, items[:])
|
||||
if !menu.open {
|
||||
row_menu_open = false
|
||||
}
|
||||
if menu.activated_id == LISTS_ROW_MENU_CHECK && !blocked {
|
||||
state.done = ifx row.done != 0 then 0 else 1
|
||||
Mutation(LISTS_SET_DONE, row_menu_index)
|
||||
row_menu_open = false
|
||||
} else if menu.activated_id == LISTS_ROW_MENU_EDIT && !blocked {
|
||||
BeginCustomTask(row_menu_index, row.title, row.comment)
|
||||
row_menu_open = false
|
||||
}
|
||||
}
|
||||
+8
-10
@@ -1,6 +1,6 @@
|
||||
// Lists owns the collaboration document and the meaning of each edit. The
|
||||
// wrapper provides authenticated transport and account-scoped cached bytes.
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "vec"
|
||||
#import, file "../../src/apps/lists_types.zi";
|
||||
#import, file "../../src/apps/lists_ui_types.zi";
|
||||
@@ -71,11 +71,7 @@ ListsBuildCommand :: (message: ListsMessage, frame: ListsUiFrame,
|
||||
return BuilderFinish(out)
|
||||
}
|
||||
BuilderPrint(*out, ",\"title\":")
|
||||
title := list.title
|
||||
if message.action == LISTS_COMMIT && message.editing_item == -3 {
|
||||
title = frame.value
|
||||
}
|
||||
ListsJsonString(*out, title)
|
||||
ListsJsonString(*out, ifx message.action == LISTS_COMMIT && message.editing_item == -3 then message.title else list.title)
|
||||
BuilderPrint(*out, ",\"revision\":%,\"items\":[", list.revision)
|
||||
restoring := message.action == LISTS_RESTORE_ITEM
|
||||
for row: rows {
|
||||
@@ -91,7 +87,8 @@ ListsBuildCommand :: (message: ListsMessage, frame: ListsUiFrame,
|
||||
continue
|
||||
}
|
||||
if message.action == LISTS_COMMIT && index == message.editing_item {
|
||||
row.title = frame.value
|
||||
row.title = message.title
|
||||
row.comment = message.comment
|
||||
}
|
||||
if message.action == LISTS_SET_DONE && index == message.index {
|
||||
row.done = message.done
|
||||
@@ -100,7 +97,7 @@ ListsBuildCommand :: (message: ListsMessage, frame: ListsUiFrame,
|
||||
if count > 0 {
|
||||
BuilderPrint(*out, ",")
|
||||
}
|
||||
ListsWriteItem(*out, ListsUiRow.{.id = message.id, .title = frame.value,
|
||||
ListsWriteItem(*out, ListsUiRow.{.id = message.id, .title = message.title,
|
||||
.comment = message.comment, .done = message.done})
|
||||
count += 1
|
||||
restoring = false
|
||||
@@ -115,13 +112,14 @@ ListsBuildCommand :: (message: ListsMessage, frame: ListsUiFrame,
|
||||
if count > 0 {
|
||||
BuilderPrint(*out, ",")
|
||||
}
|
||||
ListsWriteItem(*out, ListsUiRow.{.id = frame.next_id, .title = frame.value})
|
||||
ListsWriteItem(*out, ListsUiRow.{.id = frame.next_id, .title = message.title,
|
||||
.comment = message.comment})
|
||||
}
|
||||
if restoring {
|
||||
if count > 0 {
|
||||
BuilderPrint(*out, ",")
|
||||
}
|
||||
ListsWriteItem(*out, ListsUiRow.{.id = message.id, .title = frame.value,
|
||||
ListsWriteItem(*out, ListsUiRow.{.id = message.id, .title = message.title,
|
||||
.comment = message.comment, .done = message.done})
|
||||
}
|
||||
BuilderPrint(*out, "]}}")
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
// todo.txt stores priority as a leading `(A)` through `(Z)` in the task text.
|
||||
#import "vec"
|
||||
#import "text_buffer"
|
||||
|
||||
ListsPriorityForTitle :: (title: string) -> s32 {
|
||||
if title.count < 4 || title[0] != #char "(" || title[2] != #char ")" ||
|
||||
title[3] != #char " " {
|
||||
return 0
|
||||
}
|
||||
letter := title[1]
|
||||
if letter < #char "A" || letter > #char "Z" { return 0 }
|
||||
return cast(s32)(letter - #char "A") + 1
|
||||
}
|
||||
|
||||
ListsTitleWithoutPriority :: (title: string) -> string {
|
||||
if ListsPriorityForTitle(title) > 0 { return title[4:] }
|
||||
return title
|
||||
}
|
||||
|
||||
ListsTitleForPriority :: (title: string, priority: s32) -> string {
|
||||
task := ListsTitleWithoutPriority(title)
|
||||
if priority <= 0 || task.count == 0 { return ListsCopiedTitle(task) }
|
||||
alphabet := "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
value: Vec(u8)
|
||||
BuilderPrint(*value, "(%) %", alphabet[priority - 1:priority], task)
|
||||
return BuilderFinish(value)
|
||||
}
|
||||
|
||||
ListsTitlePriorityFits :: (title: string, priority: s32, limit: s32) -> bool {
|
||||
length := ListsTitleWithoutPriority(title).count
|
||||
if priority > 0 { return length + 4 <= limit }
|
||||
return length <= limit
|
||||
}
|
||||
|
||||
ListsCopiedTitle :: (value: string) -> string {
|
||||
copy: Vec(u8)
|
||||
BuilderPrint(*copy, "%", value)
|
||||
return BuilderFinish(copy)
|
||||
}
|
||||
@@ -1,5 +1,39 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Answer simple conversation locally without spending AI tokens; notify about replies you have not seen.
|
||||
|
||||
- Return Lumi's answer to the private Telegram message that requested it.
|
||||
|
||||
- Send private developer turns from the owner's Android debug build.
|
||||
- Lumi faces the conversation.
|
||||
- Review complete feedback from the referenced list before one Send or Cancel choice; retries keep the same proposal.
|
||||
|
||||
## [1.5.29] - 2026-11-05
|
||||
|
||||
- Keep chat ready while replies arrive, show Send and Cancel for developer reports, and retain the cursor when correcting text.
|
||||
|
||||
## [1.5.28] - 2026-11-02
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.62.
|
||||
|
||||
## [1.5.27] - 2026-10-29
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.61.
|
||||
|
||||
## [1.5.26] - 2026-10-29
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.60.
|
||||
|
||||
## [1.5.25] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.59.
|
||||
|
||||
## [1.5.24] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.58.
|
||||
|
||||
## [1.5.23] - 2026-10-28
|
||||
|
||||
- Maintenance release for Inner Breeze 2.1.56.
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_lumi_offline_action_1_title": "Lumi · 1 hasil",
|
||||
"achievement_lumi_offline_action_1_description": "Catat 1 hasil berbeda: tindakan berguna Lumi yang dikonfirmasi dalam mode luring.",
|
||||
"achievement_lumi_actions_5_title": "Lumi · 5 hasil",
|
||||
"achievement_lumi_actions_5_description": "Catat 5 hasil berbeda: tindakan berguna Lumi yang dikonfirmasi.",
|
||||
"achievement_lumi_actions_25_title": "Lumi · 25 hasil",
|
||||
"achievement_lumi_actions_25_description": "Catat 25 hasil berbeda: tindakan berguna Lumi yang dikonfirmasi.",
|
||||
"achievement_lumi_actions_100_title": "Lumi · 100 hasil",
|
||||
"achievement_lumi_actions_100_description": "Catat 100 hasil berbeda: tindakan berguna Lumi yang dikonfirmasi.",
|
||||
"achievement_lumi_days_3_title": "Lumi · 3 hari",
|
||||
"achievement_lumi_days_3_description": "Lakukan ini pada 3 tanggal berbeda: tindakan berguna Lumi yang dikonfirmasi.",
|
||||
"achievement_lumi_days_7_title": "Lumi · 7 hari",
|
||||
"achievement_lumi_days_7_description": "Lakukan ini pada 7 tanggal berbeda: tindakan berguna Lumi yang dikonfirmasi.",
|
||||
"achievement_lumi_days_30_title": "Lumi · 30 hari",
|
||||
"achievement_lumi_days_30_description": "Lakukan ini pada 30 tanggal berbeda: tindakan berguna Lumi yang dikonfirmasi.",
|
||||
"achievement_lumi_progress_chart_1_title": "Lumi · 1 hasil",
|
||||
"achievement_lumi_progress_chart_1_description": "Catat 1 hasil berbeda: grafik dibuat melalui Lumi dari aktivitas tersimpan.",
|
||||
"achievement_lumi_practice_1_title": "Lumi · 1 hasil",
|
||||
"achievement_lumi_practice_1_description": "Catat 1 hasil berbeda: latihan sah tersimpan yang dimulai melalui Lumi.",
|
||||
"achievement_lumi_diary_1_title": "Lumi · 1 hasil",
|
||||
"achievement_lumi_diary_1_description": "Catat 1 hasil berbeda: tambahan berisi konten disimpan ke catatan harian melalui Lumi."
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_lumi_offline_action_1_title": "Lumi · 1 risultati",
|
||||
"achievement_lumi_offline_action_1_description": "Registra 1 risultati distinti: un’azione utile confermata di Lumi senza connessione.",
|
||||
"achievement_lumi_actions_5_title": "Lumi · 5 risultati",
|
||||
"achievement_lumi_actions_5_description": "Registra 5 risultati distinti: un’azione utile confermata di Lumi.",
|
||||
"achievement_lumi_actions_25_title": "Lumi · 25 risultati",
|
||||
"achievement_lumi_actions_25_description": "Registra 25 risultati distinti: un’azione utile confermata di Lumi.",
|
||||
"achievement_lumi_actions_100_title": "Lumi · 100 risultati",
|
||||
"achievement_lumi_actions_100_description": "Registra 100 risultati distinti: un’azione utile confermata di Lumi.",
|
||||
"achievement_lumi_days_3_title": "Lumi · 3 giorni",
|
||||
"achievement_lumi_days_3_description": "Fallo in 3 date distinte: un’azione utile confermata di Lumi.",
|
||||
"achievement_lumi_days_7_title": "Lumi · 7 giorni",
|
||||
"achievement_lumi_days_7_description": "Fallo in 7 date distinte: un’azione utile confermata di Lumi.",
|
||||
"achievement_lumi_days_30_title": "Lumi · 30 giorni",
|
||||
"achievement_lumi_days_30_description": "Fallo in 30 date distinte: un’azione utile confermata di Lumi.",
|
||||
"achievement_lumi_progress_chart_1_title": "Lumi · 1 risultati",
|
||||
"achievement_lumi_progress_chart_1_description": "Registra 1 risultati distinti: un grafico creato da Lumi con attività salvata.",
|
||||
"achievement_lumi_practice_1_title": "Lumi · 1 risultati",
|
||||
"achievement_lumi_practice_1_description": "Registra 1 risultati distinti: una pratica valida salvata e avviata tramite Lumi.",
|
||||
"achievement_lumi_diary_1_title": "Lumi · 1 risultati",
|
||||
"achievement_lumi_diary_1_description": "Registra 1 risultati distinti: un’aggiunta con contenuto salvata nel diario tramite Lumi."
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "vec"
|
||||
#import "utf8"
|
||||
|
||||
|
||||
+3
-2
@@ -128,10 +128,11 @@ LumiIntentWith :: (input: string, commands: LumiCommands, shorthand: bool) -> Lu
|
||||
return progress
|
||||
}
|
||||
// Explicit reports remain usable without a network or a model allowance.
|
||||
feedback_prefixes: [19]string = .["/feedback ", "feedback:", "feedback ", "fix ", "please fix ",
|
||||
feedback_prefixes: [24]string = .["/feedback ", "feedback:", "feedback ", "fix ", "please fix ",
|
||||
"/suggest ", "suggestion:", "suggestion ", "feature request:", "feature request ",
|
||||
"app idea:", "improve the app ", "the app should ", "this app should ", "inbe should ",
|
||||
"inner breeze should ", "lumi should ", "i wish the app ", "i suggest "]
|
||||
"inner breeze should ", "lumi should ", "i wish the app ", "i suggest ",
|
||||
"bug:", "bug report:", "there is a bug ", "there's a bug ", "i found a bug "]
|
||||
for prefix: feedback_prefixes {
|
||||
if LumiStarts(input, prefix) && input.count > prefix.count {
|
||||
return LumiAction.{.kind = LUMI_REPORT_FEEDBACK, .title = input}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// the same validated tools the online model calls. Nothing here calls the
|
||||
// host, so the phrase tests run it as it is.
|
||||
#import "vec"
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "json_scan"
|
||||
#import "byte_text_linux"
|
||||
#import, file "habit_intent.zi";
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// makes (assets/mcp/tools.json). Anything it cannot read whole is left to
|
||||
// the model, or, offline, answered with what Lumi can do.
|
||||
#import "vec"
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "utf8"
|
||||
#import "json_scan"
|
||||
#import "byte_text_linux"
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
// need no spaces. Matching is bounded; it never runs code from a template.
|
||||
#import "utf8"
|
||||
#import "vec"
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import, file "command_text.zi";
|
||||
|
||||
LUMI_TOKEN_WORDS :: 0
|
||||
|
||||
+16
-1
@@ -1,5 +1,5 @@
|
||||
// Lumi owns conversation decisions. The host supplies only explicit app tools.
|
||||
#import "text"
|
||||
#import "std/text"
|
||||
#import "vec"
|
||||
#import, file "../../src/apps/lumi_types.zi";
|
||||
#import, file "../../src/apps/module_types.zi";
|
||||
@@ -7,6 +7,7 @@
|
||||
#import, file "../../src/apps/lumi_ui_types.zi";
|
||||
#import, file "../../src/core/types.zi";
|
||||
#import, file "engine.zi";
|
||||
#import, file "small_talk.zi";
|
||||
#import, file "lumi_view.zi";
|
||||
#import, file "habit_patterns.zi";
|
||||
#import, file "habit_intent.zi";
|
||||
@@ -237,6 +238,11 @@ LumiRespond :: (input: string) {
|
||||
}
|
||||
AppendLumiChatHost(input, true)
|
||||
tools := ReadLumiToolsHost()
|
||||
prefix := LUMI_DEVELOPER_PREFIX
|
||||
if (tools.available_apps & LUMI_DEVELOPER_CHAT) != 0 &&
|
||||
input.count > prefix.count && input[:prefix.count] == prefix && StartLumiOnlineHost(input) {
|
||||
return
|
||||
}
|
||||
if offered_practice >= 0 {
|
||||
// Lumi asked whether to download or unlock a practice: yes opens
|
||||
// Manage practices at it, no drops it, and anything else is a new request.
|
||||
@@ -276,6 +282,15 @@ LumiRespond :: (input: string) {
|
||||
AppendLumiChatHost(LumiLocaleHost("lumi_cancelled"), false)
|
||||
return
|
||||
}
|
||||
if !tools.choosing_diary && !tools.choosing_habit {
|
||||
local_reply := LumiSmallTalk(input, LumiLocaleHost("lumi_small_greeting_phrases"),
|
||||
LumiLocaleHost("lumi_small_thanks_phrases"), LumiLocaleHost("lumi_small_wellbeing_phrases"),
|
||||
LumiLocaleHost("lumi_small_affection_phrases"), LumiLocaleHost("lumi_small_goodbye_phrases"))
|
||||
if local_reply.count > 0 {
|
||||
AppendLumiChatHost(LumiLocaleHost(local_reply), false)
|
||||
return
|
||||
}
|
||||
}
|
||||
action := LumiIntentWith(input, LumiCommandSet(), false)
|
||||
if tools.choosing_diary && !help_requested {
|
||||
action = LumiAction.{.kind = LUMI_WRITE_DIARY, .title = input}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
#import "geometry"
|
||||
ImageSchema :: #import "image_props";
|
||||
|
||||
// Lumi's picture faces right. Beside her messages she faces the chat, so she
|
||||
// is drawn mirrored: as a warped image whose corners swap sides, which every
|
||||
// host draws. The desktop host draws no image with a negative source width,
|
||||
// and a frame with an image it cannot draw closes the app.
|
||||
LUMI_MASCOT_PATH :: "assets/lumi/mascot.webp"
|
||||
|
||||
// The mascot over bounds facing left. corners, four points, keeps the mesh
|
||||
// until the image is drawn.
|
||||
LumiMascotFacingLeft :: (key: u64, bounds: Rectangle, corners: []Vector2) -> ImageSchema.Props {
|
||||
picture: ImageSchema.Props
|
||||
picture.key = key
|
||||
picture.asset_path = LUMI_MASCOT_PATH
|
||||
picture.alt_text = "Lumi"
|
||||
picture.bounds = bounds
|
||||
// A detailed picture drawn far smaller than its pixels.
|
||||
picture.smooth = true
|
||||
if corners.count < 4 { return picture }
|
||||
right := bounds.x + bounds.width
|
||||
bottom := bounds.y + bounds.height
|
||||
corners[0] = Vector2.{right, bounds.y}
|
||||
corners[1] = Vector2.{bounds.x, bounds.y}
|
||||
corners[2] = Vector2.{right, bottom}
|
||||
corners[3] = Vector2.{bounds.x, bottom}
|
||||
picture.mesh.columns = 2
|
||||
picture.mesh.rows = 2
|
||||
picture.mesh.points = corners[:4]
|
||||
return picture
|
||||
}
|
||||
+127
-128
@@ -1,31 +1,23 @@
|
||||
#import "geometry"
|
||||
#import "drawing_props"
|
||||
#import "layout"
|
||||
#import "image_props"
|
||||
#import "image_widget"
|
||||
#import "text_props"
|
||||
#import "text_widget"
|
||||
Box :: #import "kryon/box";
|
||||
Button :: #import "kryon/button";
|
||||
Checkbox :: #import "kryon/checkbox";
|
||||
ContextMenu :: #import "kryon/context_menu";
|
||||
Dropdown :: #import "kryon/dropdown";
|
||||
Image :: #import "kryon/image";
|
||||
Layout :: #import "kryon/layout";
|
||||
Press :: #import "kryon/press";
|
||||
Scroll :: #import "kryon/scroll";
|
||||
Text :: #import "kryon/text";
|
||||
TextArea :: #import "kryon/text_area";
|
||||
TitleBar :: #import "kryon/title_bar";
|
||||
#import "kryon/system_clipboard"
|
||||
#import "text_align"
|
||||
#import "text_input_props"
|
||||
#import "text_area_widget"
|
||||
#import "button_props"
|
||||
#import "button_widget"
|
||||
#import "control_props"
|
||||
#import "box_props"
|
||||
#import "box_widget"
|
||||
#import "loading_indicator"
|
||||
#import "checkbox_props"
|
||||
#import "checkbox_widget"
|
||||
#import "context_menu_widget"
|
||||
#import "press_props"
|
||||
#import "press_widget"
|
||||
#import "scroll_props"
|
||||
#import "scroll_widget"
|
||||
#import "title_bar_props"
|
||||
#import "title_bar_widget"
|
||||
#import "dropdown_props"
|
||||
#import "tree"
|
||||
#import "text"
|
||||
#import "kryon/loading_indicator"
|
||||
#import "kryon/tree"
|
||||
#import "std/text"
|
||||
#import "byte_text_linux"
|
||||
#import "c_string"
|
||||
#import "vec"
|
||||
@@ -36,12 +28,14 @@
|
||||
#import, file "command_text.zi";
|
||||
#import, file "engine.zi";
|
||||
#import, file "message_text.zi";
|
||||
#import, file "lumi_mascot.zi";
|
||||
ConnectedIcon :: #import "mingcute/mingcute_regular_wifi";
|
||||
DisconnectedIcon :: #import "mingcute/mingcute_regular_wifi_off";
|
||||
ConfigureIcon :: #import "mingcute/mingcute_regular_tool";
|
||||
LoadingIndicator :: #import "kryon/loading_indicator";
|
||||
|
||||
using ImageFit;
|
||||
using TextWrap;
|
||||
using Image.ImageFit;
|
||||
using Text.Wrap;
|
||||
using TextAlign;
|
||||
using ButtonTone;
|
||||
using ButtonEmphasis;
|
||||
@@ -66,7 +60,7 @@ frame: LumiUiFrame;
|
||||
// The terms panel's scroll and its formatted text.
|
||||
agreement_scroll: s32;
|
||||
agreement_bytes: [8192]u8;
|
||||
agreement_strong: [32]TextRange;
|
||||
agreement_strong: [32]Text.Range;
|
||||
chart_selected_key: u64;
|
||||
chart_selected_point: s32;
|
||||
|
||||
@@ -254,21 +248,21 @@ SelectedText :: () -> string {
|
||||
// the count, then copy and delete, with delete asking first.
|
||||
SelectionBar :: (x: s32, top: s32, width: s32) {
|
||||
control := Scale(44)
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)300369,
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)300369,
|
||||
.bounds = Bounds(0, 0, frame.width, top + control + Scale(8)),
|
||||
.fill = frame.background})
|
||||
if confirm_delete {
|
||||
Text(frame.session, TextProps.{.key = cast(u64)300370,
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)300370,
|
||||
.bounds = Bounds(x, top, width - Scale(216), control),
|
||||
.text = LumiViewLocaleHost("lumi_delete_confirm"), .font = frame.font,
|
||||
.wrap = cast(TextWrap)TextWrapAuto, .vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
if Button(frame.session, ButtonProps.{.id = 30020,
|
||||
.text = LumiViewLocaleHost("lumi_delete_confirm"), .size = frame.font,
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto, .vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 30020,
|
||||
.bounds = Bounds(x + width - Scale(208), top, Scale(100), control),
|
||||
.label = LumiViewLocaleHost("cancel_button"), .fit_content = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
confirm_delete = false
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 30021,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 30021,
|
||||
.bounds = Bounds(x + width - Scale(100), top, Scale(100), control),
|
||||
.label = LumiViewLocaleHost("delete_button"), .fit_content = true,
|
||||
.tone = cast(ButtonTone)ButtonToneDanger, .emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled}) != 0 {
|
||||
@@ -284,21 +278,21 @@ SelectionBar :: (x: s32, top: s32, width: s32) {
|
||||
}
|
||||
return
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 30022, .bounds = Bounds(x, top, control, control),
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 30022, .bounds = Bounds(x, top, control, control),
|
||||
.label = LumiViewLocaleHost("lumi_cancel_selection"), .icon_shape = LUMI_CLOSE_ICON, .icon_only = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
SelectionClear()
|
||||
return
|
||||
}
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)300371,
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)300371,
|
||||
.bounds = Bounds(x + control + Scale(8), top + Scale(6), Scale(150), control - Scale(12)),
|
||||
.fill = Color.{156, 188, 143, 48}, .radius = cast(float32)(control - Scale(12)) / 2.0})
|
||||
Text(frame.session, TextProps.{.key = cast(u64)300372,
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)300372,
|
||||
.bounds = Bounds(x + control + Scale(8), top, Scale(150), control),
|
||||
.text = CountText(LumiViewLocaleHost("lumi_selected_count"), selected_count), .font = frame.font,
|
||||
.wrap = cast(TextWrap)TextWrapNone, .align = cast(TextAlign)TextAlignCenter,
|
||||
.text = CountText(LumiViewLocaleHost("lumi_selected_count"), selected_count), .size = frame.font,
|
||||
.wrap = cast(Text.Wrap)TextWrapNone, .align = cast(TextAlign)TextAlignCenter,
|
||||
.vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
if Button(frame.session, ButtonProps.{.id = 30023,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 30023,
|
||||
.bounds = Bounds(x + width - 2 * control - Scale(4), top, control, control),
|
||||
.label = LumiViewLocaleHost("lumi_copy"), .icon_shape = LUMI_COPY_ICON, .icon_only = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
@@ -307,7 +301,7 @@ SelectionBar :: (x: s32, top: s32, width: s32) {
|
||||
SelectionClear()
|
||||
return
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 30024,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 30024,
|
||||
.bounds = Bounds(x + width - control, top, control, control),
|
||||
.label = LumiViewLocaleHost("delete_button"), .icon_shape = LUMI_DELETE_ICON, .icon_only = true,
|
||||
.tone = cast(ButtonTone)ButtonToneDanger, .emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
@@ -437,7 +431,7 @@ Bounds :: (x: s32, y: s32, width: s32, height: s32) -> Rectangle {
|
||||
}
|
||||
|
||||
Suggestion :: (id: s32, text: string, bounds: Rectangle, label: string = "") -> bool {
|
||||
if Button(frame.session, ButtonProps.{.id = id, .bounds = bounds,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = id, .bounds = bounds,
|
||||
.label = ifx label.count > 0 then label else text, .pill = true, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
FillDraft(text)
|
||||
@@ -466,7 +460,7 @@ ProgressCard :: (row: LumiChatRow, index: s32, x: s32, y: s32, width: s32) {
|
||||
return
|
||||
}
|
||||
key := 330000 + index * 64
|
||||
selection_key := KeyHash(row.payload)
|
||||
selection_key := Layout.KeyHash(row.payload)
|
||||
selected := ifx chart_selected_key == selection_key then chart_selected_point else 0
|
||||
if selected < 0 || selected >= chart.count {
|
||||
selected = 0
|
||||
@@ -484,34 +478,34 @@ ProgressCard :: (row: LumiChatRow, index: s32, x: s32, y: s32, width: s32) {
|
||||
if chart.maximum > 0 {
|
||||
bar_height = cast(s32)(cast(float64)chart.values[point] / cast(float64)chart.maximum * cast(float64)plot_height)
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 310000 + index * 32 + point,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 310000 + index * 32 + point,
|
||||
.bounds = Bounds(left, plot_y, cast(s32)step, plot_height), .invisible = true}) != 0 {
|
||||
selected = point
|
||||
chart_selected_key = selection_key
|
||||
chart_selected_point = point
|
||||
}
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)(key + point),
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)(key + point),
|
||||
.bounds = Bounds(left, plot_y + plot_height - bar_height, bar_width, bar_height),
|
||||
.fill = ifx selected == point then Color.{93, 148, 110, 255} else Color.{156, 188, 143, 200},
|
||||
.radius = cast(float32)Scale(2)})
|
||||
}
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)(key + 31),
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)(key + 31),
|
||||
.bounds = Bounds(x, plot_y + plot_height, width, Scale(1)), .fill = Color.{156, 156, 156, 120}})
|
||||
summary: Vec(u8)
|
||||
BuilderPrint(*summary, "% · %", ChartDate(chart.dates[selected]), chart.values[selected])
|
||||
Text(frame.session, TextProps.{.key = cast(u64)(key + 32),
|
||||
.bounds = Bounds(x, y, width, Scale(24)), .text = BuilderFinish(summary), .font = Scale(14)})
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)(key + 32),
|
||||
.bounds = Bounds(x, y, width, Scale(24)), .text = BuilderFinish(summary), .size = Scale(14)})
|
||||
half := width / 2
|
||||
Text(frame.session, TextProps.{.key = cast(u64)(key + 33),
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)(key + 33),
|
||||
.bounds = Bounds(x, plot_y + plot_height + Scale(6), half, Scale(22)),
|
||||
.text = ChartDate(chart.dates[0]), .font = Scale(12)})
|
||||
Text(frame.session, TextProps.{.key = cast(u64)(key + 34),
|
||||
.text = ChartDate(chart.dates[0]), .size = Scale(12)})
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)(key + 34),
|
||||
.bounds = Bounds(x + half, plot_y + plot_height + Scale(6), width - half, Scale(22)),
|
||||
.text = ChartDate(chart.dates[chart.count - 1]), .font = Scale(12)})
|
||||
.text = ChartDate(chart.dates[chart.count - 1]), .size = Scale(12)})
|
||||
if chart.maximum == 0 {
|
||||
Text(frame.session, TextProps.{.key = cast(u64)(key + 35),
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)(key + 35),
|
||||
.bounds = Bounds(x, y + Scale(196), width, Scale(40)),
|
||||
.text = LumiViewLocaleHost("lumi_chart_empty"), .font = Scale(14)})
|
||||
.text = LumiViewLocaleHost("lumi_chart_empty"), .size = Scale(14)})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,39 +514,37 @@ ProgressCard :: (row: LumiChatRow, index: s32, x: s32, y: s32, width: s32) {
|
||||
FeedbackQuote :: (row: LumiChatRow, index: s32, x: s32, y: s32, width: s32) {
|
||||
key := 440000 + index * 4
|
||||
quote_height := Scale(LUMI_QUOTE_HEIGHT - 8)
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)key,
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)key,
|
||||
.bounds = Bounds(x + Scale(12), y, width - Scale(24), quote_height),
|
||||
.fill = Color.{93, 148, 110, 40}, .radius = cast(float32)Scale(6)})
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)(key + 1),
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)(key + 1),
|
||||
.bounds = Bounds(x + Scale(12), y, Scale(3), quote_height),
|
||||
.fill = Color.{93, 148, 110, 255}, .radius = cast(float32)Scale(2)})
|
||||
Text(frame.session, TextProps.{.key = cast(u64)(key + 2),
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)(key + 2),
|
||||
.bounds = Bounds(x + Scale(24), y + Scale(3), width - Scale(40), Scale(16)),
|
||||
.text = LumiViewLocaleHost("lumi_your_feedback"), .font = Scale(12),
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
Text(frame.session, TextProps.{.key = cast(u64)(key + 3),
|
||||
.text = LumiViewLocaleHost("lumi_your_feedback"), .size = Scale(12),
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)(key + 3),
|
||||
.bounds = Bounds(x + Scale(24), y + Scale(20), width - Scale(40), Scale(18)),
|
||||
.text = row.quote, .font = Scale(13),
|
||||
.wrap = cast(TextWrap)TextWrapEllipsis})
|
||||
.text = row.quote, .size = Scale(13),
|
||||
.wrap = cast(Text.Wrap)TextWrapEllipsis})
|
||||
}
|
||||
|
||||
// Lumi's bubble with three dots that brighten and rise in turn, where its
|
||||
// answer will appear.
|
||||
TypingDots :: (x: s32, top: s32) {
|
||||
left := x + Scale(48)
|
||||
Image(frame.session, ImageProps.{.key = cast(u64)300380,
|
||||
.asset_path = "assets/lumi/mascot.png", .alt_text = "Lumi",
|
||||
.bounds = Bounds(x, top + Scale(16), Scale(40), Scale(40)),
|
||||
.source = Rectangle.{0.0, 0.0, -1254.0, 1254.0},
|
||||
.fit = cast(ImageFit)ImageFitContain})
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)300381,
|
||||
corners: [4]Vector2
|
||||
Image.Draw(frame.session, LumiMascotFacingLeft(cast(u64)300380,
|
||||
Bounds(x, top + Scale(16), Scale(40), Scale(40)), corners[:]))
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)300381,
|
||||
.bounds = Bounds(left, top, Scale(96), Scale(60)),
|
||||
.fill = Color.{156, 156, 156, 24}, .radius = cast(float32)Scale(16)})
|
||||
Text(frame.session, TextProps.{.key = cast(u64)300382,
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)300382,
|
||||
.bounds = Bounds(left + Scale(14), top + Scale(8), Scale(68), Scale(20)),
|
||||
.text = "Lumi", .font = Scale(12)})
|
||||
.text = "Lumi", .size = Scale(12)})
|
||||
// Kryon's loading dots, the same animation every app shows.
|
||||
LoadingIndicator(frame.session, LoadingIndicatorProps.{.key = cast(u64)300383,
|
||||
LoadingIndicator.Draw(frame.session, LoadingIndicator.Props.{.key = cast(u64)300383,
|
||||
.bounds = Bounds(left + Scale(16), top + Scale(34), Scale(36), Scale(12)),
|
||||
.now = frame.now, .scale = frame.scale})
|
||||
}
|
||||
@@ -577,11 +569,10 @@ LumiAvatar :: (index: s32, x: s32, y: s32) {
|
||||
bounds.y -= radius - radius * CosineDegrees(angle)
|
||||
}
|
||||
}
|
||||
Image(frame.session, ImageProps.{.key = cast(u64)(300400 + index * 4),
|
||||
.asset_path = "assets/lumi/mascot.png", .alt_text = "Lumi",
|
||||
.bounds = bounds, .source = Rectangle.{0.0, 0.0, -1254.0, 1254.0},
|
||||
.fit = cast(ImageFit)ImageFitContain})
|
||||
press := Press(frame.session, PressProps.{.key = cast(u64)(430000 + RowSlot(index) + 1),
|
||||
corners: [4]Vector2
|
||||
Image.Draw(frame.session, LumiMascotFacingLeft(cast(u64)(300400 + index * 4),
|
||||
bounds, corners[:]))
|
||||
press := Press.Draw(frame.session, Press.Props.{.key = cast(u64)(430000 + RowSlot(index) + 1),
|
||||
.bounds = Bounds(x, y, Scale(40), Scale(40)), .label = "Lumi", .now = frame.now})
|
||||
if press.clicked {
|
||||
swirl_row = index
|
||||
@@ -592,9 +583,9 @@ LumiAvatar :: (index: s32, x: s32, y: s32) {
|
||||
|
||||
// A row's press: a hold starts selecting, and while selecting a press starts
|
||||
// a sweep that follows the pointer, even off the row and past the chat.
|
||||
RowPress :: (index: s32, bounds: Rectangle, content_y: float32) -> PressResult {
|
||||
RowPress :: (index: s32, bounds: Rectangle, content_y: float32) -> Press.PressResult {
|
||||
key := ifx index == 0 then 0 else RowSlot(index) + 1
|
||||
press := Press(frame.session, PressProps.{.key = cast(u64)(410000 + key), .bounds = bounds,
|
||||
press := Press.Draw(frame.session, Press.Props.{.key = cast(u64)(410000 + key), .bounds = bounds,
|
||||
.label = LumiViewLocaleHost("lumi_message"), .now = frame.now, .capture = selecting})
|
||||
if !selecting && press.held {
|
||||
selecting = true
|
||||
@@ -631,8 +622,8 @@ RowMenu :: () -> s32 {
|
||||
row_menu_open = false
|
||||
return -1
|
||||
}
|
||||
items: [1]ContextMenuItem = .[ContextMenuItem.{.id = LUMI_MENU_COPY, .label = LumiViewLocaleHost("lumi_copy")}]
|
||||
menu := ContextMenu(frame.session, ContextMenuProps.{.key = cast(u64)380000, .open = true,
|
||||
items: [1]ContextMenu.ContextMenuItem = .[ContextMenu.ContextMenuItem.{.id = LUMI_MENU_COPY, .label = LumiViewLocaleHost("lumi_copy")}]
|
||||
menu := ContextMenu.Draw(frame.session, ContextMenu.Props.{.key = cast(u64)380000, .open = true,
|
||||
.x = row_menu_x, .y = row_menu_y, .scale = frame.scale}, items[:])
|
||||
if !menu.open {
|
||||
row_menu_open = false
|
||||
@@ -648,8 +639,8 @@ LumiTitleBar :: () -> s32 {
|
||||
button := Scale(40)
|
||||
gap := Scale(4)
|
||||
trailing := ifx frame.connection then 2 * button + gap else 0
|
||||
options: [1]DropdownOption
|
||||
bar := TitleBar(frame.session, TitleBarProps.{.key = cast(u64)300400, .title = "Lumi",
|
||||
options: [1]Dropdown.Option
|
||||
bar := TitleBar.Draw(frame.session, TitleBar.Props.{.key = cast(u64)300400, .title = "Lumi",
|
||||
.bounds = Bounds(0, 0, frame.width, height), .height = height, .scale = frame.scale,
|
||||
.trailing_width = trailing}, options[0:0])
|
||||
if !frame.connection || bar.trailing_bounds.width <= 0.0 {
|
||||
@@ -660,7 +651,7 @@ LumiTitleBar :: () -> s32 {
|
||||
size := cast(float32)button
|
||||
// Its label says whether Lumi is online now.
|
||||
state := ifx frame.online then "lumi_toggle_online" else "lumi_toggle_offline"
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)300401, .id = 30040,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)300401, .id = 30040,
|
||||
.bounds = Rectangle.{area.x + area.width - 2.0 * size - cast(float32)gap, top, size, size},
|
||||
.label = LumiViewLocaleHost(state), .selected = frame.online,
|
||||
.icon_shape = ifx frame.online then ConnectedIcon.Shape else DisconnectedIcon.Shape,
|
||||
@@ -669,7 +660,7 @@ LumiTitleBar :: () -> s32 {
|
||||
// Going online without the agreement opens the terms instead.
|
||||
unused SetLumiOnlineHost(!frame.online)
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.key = cast(u64)300390, .id = 30043,
|
||||
if Button.Draw(frame.session, Button.Props.{.key = cast(u64)300390, .id = 30043,
|
||||
.bounds = Rectangle.{area.x + area.width - size, top, size, size},
|
||||
.label = LumiViewLocaleHost("settings_title"), .icon_shape = ConfigureIcon.Shape,
|
||||
.icon_only = true, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
@@ -682,32 +673,32 @@ LumiTitleBar :: () -> s32 {
|
||||
// The terms Lumi asks to agree to before going online, or shows again from
|
||||
// Settings with a way to withdraw.
|
||||
LumiAgreementView :: (top: s32) {
|
||||
column := CenteredColumnFor(frame.width, Scale(720), Scale(16))
|
||||
column := Layout.CenteredColumnFor(frame.width, Scale(720), Scale(16))
|
||||
buttons_top := frame.height - frame.bottom - Scale(16) - Scale(48)
|
||||
area_height := buttons_top - Scale(12) - top
|
||||
if area_height < Scale(60) {
|
||||
area_height = Scale(60)
|
||||
}
|
||||
counts := LumiFormatInto(frame.agreement_text, true, agreement_bytes[:], agreement_strong[:])
|
||||
panel := Scroll(frame.session, ScrollProps.{.key = cast(u64)300410,
|
||||
panel := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)300410,
|
||||
.bounds = Bounds(column.x, top, column.width, area_height),
|
||||
.content_height = frame.agreement_height, .scroll_offset = agreement_scroll,
|
||||
.scale = frame.scale})
|
||||
agreement_scroll = panel.scroll_offset
|
||||
if panel.opened {
|
||||
// The host measured the terms at this width, clear of the scroll bar.
|
||||
Text(frame.session, TextProps.{.key = cast(u64)300411,
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)300411,
|
||||
.bounds = Rectangle.{panel.content.x, panel.content.y,
|
||||
cast(float32)(column.width - Scale(24)), cast(float32)frame.agreement_height},
|
||||
.text = TextFromBytes(agreement_bytes[:counts.count]), .font = frame.font,
|
||||
.strong = agreement_strong[:counts.strong_count], .wrap = cast(TextWrap)TextWrapAuto})
|
||||
.text = TextFromBytes(agreement_bytes[:counts.count]), .size = frame.font,
|
||||
.strong = agreement_strong[:counts.strong_count], .wrap = cast(Text.Wrap)TextWrapAuto})
|
||||
unused End(frame.session)
|
||||
}
|
||||
reading := frame.agreement == 2
|
||||
half := (column.width - Scale(12)) / 2
|
||||
first := ifx reading then "lumi_agreement_withdraw" else "lumi_agreement_agree"
|
||||
second := ifx reading then "close_button" else "lumi_agreement_later"
|
||||
if Button(frame.session, ButtonProps.{.id = 30041,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 30041,
|
||||
.bounds = Bounds(column.x, buttons_top, half, Scale(48)),
|
||||
.label = LumiViewLocaleHost(first),
|
||||
.tone = cast(ButtonTone)(ifx reading then ButtonToneDanger else ButtonToneAccent),
|
||||
@@ -715,7 +706,7 @@ LumiAgreementView :: (top: s32) {
|
||||
agreement_scroll = 0
|
||||
unused LumiAgreementHost(ifx reading then 3 else 1)
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 30042,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 30042,
|
||||
.bounds = Bounds(column.x + half + Scale(12), buttons_top, half, Scale(48)),
|
||||
.label = LumiViewLocaleHost(second), .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft}) != 0 {
|
||||
@@ -732,7 +723,7 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
WriteLumiUiHost(frame)
|
||||
return message
|
||||
}
|
||||
column := CenteredColumnFor(frame.width, Scale(720), Scale(16))
|
||||
column := Layout.CenteredColumnFor(frame.width, Scale(720), Scale(16))
|
||||
x := column.x
|
||||
width := column.width
|
||||
input_height := Scale(48)
|
||||
@@ -795,7 +786,7 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
// short pause.
|
||||
typing := frame.waiting && !frame.typing_pause
|
||||
typing_height := ifx typing then Scale(70) else 0
|
||||
history := Scroll(frame.session, ScrollProps.{.key = cast(u64)300100,
|
||||
history := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)300100,
|
||||
.bounds = Bounds(x, history_top, width, chat_height),
|
||||
.content_height = frame.history_height + typing_height, .scroll_offset = frame.scroll, .scale = frame.scale})
|
||||
frame.scroll = history.scroll_offset
|
||||
@@ -823,7 +814,7 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
}
|
||||
if selecting {
|
||||
checked := IsSelected(index)
|
||||
toggled := Checkbox(frame.session, CheckboxProps.{.key = cast(u64)(420000 + RowSlot(index) + 1),
|
||||
toggled := Checkbox.Draw(frame.session, Checkbox.Props.{.key = cast(u64)(420000 + RowSlot(index) + 1),
|
||||
.bounds = Bounds(x + Scale(8), top + (row_height - Scale(10)) / 2 - Scale(12), Scale(24), Scale(24)),
|
||||
.label = LumiViewLocaleHost("lumi_message"), .checked = checked})
|
||||
if toggled.changed {
|
||||
@@ -832,18 +823,25 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
} else if !row.user && !row.developer {
|
||||
LumiAvatar(index, x, top + row_height - Scale(54))
|
||||
}
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)(300401 + index * 4),
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)(300401 + index * 4),
|
||||
.bounds = Bounds(left, top, bubble_width, row_height - Scale(10)),
|
||||
.fill = ifx row.user then Color.{156, 188, 143, 48} else Color.{156, 156, 156, 24},
|
||||
.radius = cast(float32)Scale(16)})
|
||||
if !row.user {
|
||||
Text(frame.session, TextProps.{.key = cast(u64)(300402 + index * 4),
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)(300402 + index * 4),
|
||||
.bounds = Bounds(left + Scale(14), top + Scale(8),
|
||||
bubble_width - Scale(28), Scale(20)),
|
||||
.text = ifx row.developer then LumiViewLocaleHost("lumi_developer") else "Lumi",
|
||||
.font = Scale(12)})
|
||||
.size = Scale(12)})
|
||||
}
|
||||
text_top := Scale(ifx row.user then 12 else 32)
|
||||
from_telegram := row.user && row.kind == LUMI_CHAT_TEXT && row.payload == "telegram"
|
||||
if from_telegram {
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)(300408 + index * 4),
|
||||
.bounds = Bounds(left + Scale(14), top + Scale(8),
|
||||
bubble_width - Scale(28), Scale(16)),
|
||||
.text = LumiViewLocaleHost("lumi_from_telegram"), .size = Scale(11)})
|
||||
}
|
||||
text_top := Scale(ifx row.user then (ifx from_telegram then 30 else 12) else 32)
|
||||
if row.developer && row.quote.count > 0 {
|
||||
FeedbackQuote(row, index, left, top + text_top, bubble_width)
|
||||
text_top += Scale(LUMI_QUOTE_HEIGHT)
|
||||
@@ -851,26 +849,26 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
card_height := Scale(ifx row.kind == LUMI_CHAT_PROGRESS then 242 else
|
||||
ifx row.kind == LUMI_CHAT_FEEDBACK then 54 else 0)
|
||||
text_height := row_height - text_top - Scale(16) - card_height
|
||||
props := TextProps.{.key = cast(u64)(300403 + index * 4),
|
||||
props := Text.Props.{.key = cast(u64)(300403 + index * 4),
|
||||
.bounds = Bounds(left + Scale(14), top + text_top,
|
||||
bubble_width - Scale(28), text_height),
|
||||
.text = row.text, .font = frame.font,
|
||||
.text = row.text, .size = frame.font,
|
||||
.selectable = !selecting,
|
||||
.wrap = cast(TextWrap)TextWrapAuto}
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto}
|
||||
drawn := RowText(index, row.text, !row.user)
|
||||
props.text = TextFromBytes(drawn.text.bytes[:drawn.text.count])
|
||||
props.strong = drawn.text.strong[:drawn.text.strong_count]
|
||||
// Web links are part of the words, in the theme's link color,
|
||||
// and a tap on one opens it, as in a chat app.
|
||||
links := drawn.links
|
||||
link_ranges: [LUMI_LINKS_MAX]TextRange
|
||||
link_ranges: [LUMI_LINKS_MAX]Text.Range
|
||||
for link: cast(s32)0..links.count - 1 {
|
||||
link_ranges[link] = TextRange.{links.items[link].start, links.items[link].end}
|
||||
link_ranges[link] = Text.Range.{links.items[link].start, links.items[link].end}
|
||||
}
|
||||
props.links = link_ranges[:links.count]
|
||||
Text(frame.session, props)
|
||||
Text.Draw(frame.session, props)
|
||||
if row_press.clicked && !selecting && links.count > 0 {
|
||||
tapped := TextLinkAt(frame.session, props, row_press.x, row_press.y)
|
||||
tapped := Text.TextLinkAt(frame.session, props, row_press.x, row_press.y)
|
||||
if tapped >= 0 {
|
||||
unused OpenLinkHost(props.text[link_ranges[tapped].start:link_ranges[tapped].end])
|
||||
}
|
||||
@@ -880,12 +878,12 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
ProgressCard(row, index, left + Scale(14), card_top, bubble_width - Scale(28))
|
||||
} else if row.kind == LUMI_CHAT_FEEDBACK {
|
||||
pending := LumiFeedbackChoiceHost(row.payload, 0)
|
||||
if Button(frame.session, ButtonProps.{.id = 351000 + index * 2,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 351000 + index * 2,
|
||||
.bounds = Bounds(left + Scale(14), card_top, Scale(88), Scale(44)),
|
||||
.label = LumiViewLocaleHost("lumi_feedback_yes"), .disabled = !pending}) != 0 {
|
||||
unused LumiFeedbackChoiceHost(row.payload, 1)
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 351001 + index * 2,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 351001 + index * 2,
|
||||
.bounds = Bounds(left + Scale(108), card_top, Scale(88), Scale(44)),
|
||||
.label = LumiViewLocaleHost("lumi_feedback_no"), .disabled = !pending}) != 0 {
|
||||
unused LumiFeedbackChoiceHost(row.payload, 2)
|
||||
@@ -1028,10 +1026,10 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
}
|
||||
chosen: s32 = -1
|
||||
if menu_count > 0 {
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)360000,
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)360000,
|
||||
.bounds = Bounds(x, menu_top, width, menu_height),
|
||||
.fill = Color.{156, 156, 156, 24}, .radius = cast(float32)Scale(12)})
|
||||
menu_list := Scroll(frame.session, ScrollProps.{.key = cast(u64)360001,
|
||||
menu_list := Scroll.Draw(frame.session, Scroll.Props.{.key = cast(u64)360001,
|
||||
.bounds = Bounds(x, menu_top, width, menu_height),
|
||||
.content_height = menu_count * menu_row, .scroll_offset = menu_scroll, .scale = frame.scale})
|
||||
menu_scroll = menu_list.scroll_offset
|
||||
@@ -1046,34 +1044,34 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
command := menu[index]
|
||||
key := 360100 + index * 4
|
||||
if row == menu_target {
|
||||
Box(frame.session, BoxProps.{.key = cast(u64)key,
|
||||
Box.Draw(frame.session, Box.Props.{.key = cast(u64)key,
|
||||
.bounds = Bounds(x, top, width, menu_row),
|
||||
.fill = Color.{156, 188, 143, 48}, .radius = cast(float32)Scale(12)})
|
||||
}
|
||||
if Button(frame.session, ButtonProps.{.id = 360200 + index,
|
||||
if Button.Draw(frame.session, Button.Props.{.id = 360200 + index,
|
||||
.bounds = Bounds(x, top, width, menu_row), .invisible = true,
|
||||
.label = command.description}) != 0 {
|
||||
chosen = index
|
||||
}
|
||||
strong: [1]TextRange = .[TextRange.{.start = 0, .end = cast(s32)command.name.count}]
|
||||
Text(frame.session, TextProps.{.key = cast(u64)(key + 1),
|
||||
strong: [1]Text.Range = .[Text.Range.{.start = 0, .end = cast(s32)command.name.count}]
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)(key + 1),
|
||||
.bounds = Bounds(x + Scale(16), top, name_width, menu_row),
|
||||
.text = command.name, .font = frame.font, .strong = strong[:],
|
||||
.wrap = cast(TextWrap)TextWrapNone, .vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
.text = command.name, .size = frame.font, .strong = strong[:],
|
||||
.wrap = cast(Text.Wrap)TextWrapNone, .vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
// Long translations wrap to a second line on narrow phones.
|
||||
Text(frame.session, TextProps.{.key = cast(u64)(key + 2),
|
||||
Text.Draw(frame.session, Text.Props.{.key = cast(u64)(key + 2),
|
||||
.bounds = Bounds(x + Scale(16) + name_width, top,
|
||||
width - Scale(32) - name_width, menu_row),
|
||||
.text = command.description, .font = Scale(14),
|
||||
.wrap = cast(TextWrap)TextWrapAuto, .vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
.text = command.description, .size = Scale(14),
|
||||
.wrap = cast(Text.Wrap)TextWrapAuto, .vertical_align = cast(TextAlign)TextAlignCenter})
|
||||
}
|
||||
End(frame.session)
|
||||
}
|
||||
}
|
||||
// As in Telegram, an empty draft offers the command button and a draft
|
||||
// offers Send. A pending answer keeps Send visible as its progress.
|
||||
show_commands := LumiTrim(frame.value).count == 0 && !frame.waiting
|
||||
if show_commands && Button(frame.session, ButtonProps.{.id = 30012,
|
||||
// offers Send. Typing dots in the history show the pending answer.
|
||||
show_commands := LumiTrim(frame.value).count == 0
|
||||
if show_commands && Button.Draw(frame.session, Button.Props.{.id = 30012,
|
||||
.bounds = Bounds(x + width - Scale(48), footer, Scale(48), Scale(48)),
|
||||
.label = LumiViewLocaleHost("lumi_commands"), .icon_shape = LUMI_COMMANDS_ICON, .icon_only = true,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0 {
|
||||
@@ -1092,7 +1090,7 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
field_input.focus = true
|
||||
focus_request -= 1
|
||||
}
|
||||
field := TextArea(frame.session, TextAreaProps.{.key = cast(u64)300200, .focus_id = 30010,
|
||||
field := TextArea.Draw(frame.session, TextArea.Props.{.key = cast(u64)300200, .focus_id = 30010,
|
||||
.bounds = Bounds(x, footer, width - Scale(56), input_height),
|
||||
.value = frame.value, .placeholder = LumiViewLocaleHost("lumi_placeholder"), .label = "Lumi",
|
||||
.cursor = frame.cursor, .anchor = frame.anchor, .scroll_y = frame.input_scroll,
|
||||
@@ -1135,25 +1133,24 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
frame.clipboard_write = true
|
||||
frame.clipboard_text = BuilderFinish(words)
|
||||
}
|
||||
send := !show_commands && Button(frame.session, ButtonProps.{.id = 30011,
|
||||
send := !show_commands && Button.Draw(frame.session, Button.Props.{.id = 30011,
|
||||
.bounds = Bounds(x + width - Scale(48), footer, Scale(48), Scale(48)),
|
||||
.label = LumiViewLocaleHost("lumi_send"), .icon_shape = LUMI_SEND_ICON, .icon_only = true,
|
||||
.disabled = frame.waiting, .loading = frame.waiting, .tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.tone = cast(ButtonTone)ButtonToneNeutral,
|
||||
.emphasis = cast(ButtonEmphasis)ButtonEmphasisGhost}) != 0
|
||||
if chosen < 0 && field.committed && !send && menu_target >= 0 && !frame.waiting && !selected {
|
||||
if chosen < 0 && field.committed && !send && menu_target >= 0 && !selected {
|
||||
chosen = menu_matches[menu_target]
|
||||
}
|
||||
submit := ""
|
||||
if chosen >= 0 {
|
||||
// A command that needs text, or one chosen while Lumi is answering,
|
||||
// waits in the draft.
|
||||
// Commands that need text wait in the draft.
|
||||
text := CommandText(menu[chosen])
|
||||
if menu[chosen].needs_text || frame.waiting {
|
||||
if menu[chosen].needs_text {
|
||||
FillDraft(text)
|
||||
} else {
|
||||
submit = text
|
||||
}
|
||||
} else if !frame.waiting && (send || field.committed) && LumiTrim(frame.value).count > 0 && !selected {
|
||||
} else if (send || field.committed) && LumiTrim(frame.value).count > 0 && !selected {
|
||||
submit = frame.value
|
||||
}
|
||||
if submit.count > 0 {
|
||||
@@ -1169,6 +1166,8 @@ LumiView :: (message: LumiMessage, commands: LumiCommands, revision: s64) -> Lum
|
||||
frame.input_scroll = 0
|
||||
frame.selecting = false
|
||||
frame.preferred_x_valid = false
|
||||
frame.focused = true
|
||||
focus_request = 2
|
||||
frame.scroll = 1000000
|
||||
frame.follow_end = true
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
// Reply emphasis is presentation only. Stored messages remain verbatim, and
|
||||
// typed messages and code keep their literal text.
|
||||
#import "text_props"
|
||||
Text :: #import "kryon/text";
|
||||
#import "byte_text_linux"
|
||||
#import, file "../../src/apps/lumi_types.zi";
|
||||
|
||||
LumiMessageText :: struct {
|
||||
bytes: [LUMI_INPUT_MAX]u8
|
||||
count: s32
|
||||
strong: [256]TextRange
|
||||
strong: [256]Text.Range
|
||||
strong_count: s32
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ LumiFormatCounts :: struct {
|
||||
|
||||
// Formats into caller buffers, for text longer than a chat message such
|
||||
// as Lumi's online terms. Bytes that do not fit are left out.
|
||||
LumiFormatInto :: (value: string, formatted: bool, bytes: []u8, strong: []TextRange) -> LumiFormatCounts {
|
||||
LumiFormatInto :: (value: string, formatted: bool, bytes: []u8, strong: []Text.Range) -> LumiFormatCounts {
|
||||
result: LumiFormatCounts
|
||||
limit := cast(s32)bytes.count - 1
|
||||
at: s32 = 0
|
||||
@@ -71,7 +71,7 @@ LumiFormatInto :: (value: string, formatted: bool, bytes: []u8, strong: []TextRa
|
||||
if formatted && !code && LumiTextMarker(value, at) && result.strong_count < cast(s32)strong.count {
|
||||
end := LumiTextClosing(value, at)
|
||||
if end >= 0 {
|
||||
range := TextRange.{.start = result.count}
|
||||
range := Text.Range.{.start = result.count}
|
||||
at += 2
|
||||
while at < end && result.count < limit {
|
||||
bytes[result.count] = value[at]
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
// Exact, short phrases only. Commands, extra clauses and quoted text fall
|
||||
// through to Lumi's interpreter and AI; no fuzzy or substring matching.
|
||||
#import, file "command_text.zi";
|
||||
|
||||
LumiSmallTalkTrim :: (text: string) -> string {
|
||||
start: s64 = 0
|
||||
end := text.count
|
||||
while start < end && (text[start] == 32 || text[start] == 9) {
|
||||
start += 1
|
||||
}
|
||||
while end > start && (text[end - 1] == 32 || text[end - 1] == 9 ||
|
||||
text[end - 1] == 33 || text[end - 1] == 63 || text[end - 1] == 46 || text[end - 1] == 44) {
|
||||
end -= 1
|
||||
}
|
||||
text = text[start:end]
|
||||
if text.count >= 2 && (text[:2] == "¿" || text[:2] == "¡") {
|
||||
text = text[2:]
|
||||
}
|
||||
while text.count >= 3 && (text[text.count - 3:] == "?" ||
|
||||
text[text.count - 3:] == "!" || text[text.count - 3:] == "。") {
|
||||
text = text[:text.count - 3]
|
||||
}
|
||||
return text
|
||||
}
|
||||
|
||||
LumiSmallTalkPhrase :: (message: string, phrases: string) -> bool {
|
||||
start: s64 = 0
|
||||
for at: cast(s64)0..phrases.count {
|
||||
if at == phrases.count || phrases[at] == 124 {
|
||||
phrase := phrases[start:at]
|
||||
if phrase.count > 0 && CommandEqual(message, phrase) {
|
||||
return true
|
||||
}
|
||||
start = at + 1
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Returns a locale key, or empty for the normal interpreter/AI path. Lists
|
||||
// contain English and the active language; replies use the active locale.
|
||||
LumiSmallTalk :: (message: string, greetings: string, thanks: string,
|
||||
wellbeing: string, affection: string, goodbye: string) -> string {
|
||||
if message.count == 0 || message.count > 96 {
|
||||
return ""
|
||||
}
|
||||
for byte: message {
|
||||
if byte == 10 || byte == 13 {
|
||||
return ""
|
||||
}
|
||||
}
|
||||
message = LumiSmallTalkTrim(message)
|
||||
if message.count > 4 && CommandEqual(message[:4], "lumi") &&
|
||||
(message[4] == 32 || message[4] == 44) {
|
||||
message = LumiSmallTalkTrim(message[5:])
|
||||
} else if message.count > 5 && CommandEqual(message[message.count - 4:], "lumi") &&
|
||||
(message[message.count - 5] == 32 || message[message.count - 5] == 44) {
|
||||
message = LumiSmallTalkTrim(message[:message.count - 5])
|
||||
}
|
||||
if LumiSmallTalkPhrase(message, "hi|hello|hey|good morning|good afternoon|good evening") ||
|
||||
LumiSmallTalkPhrase(message, greetings) {
|
||||
return "lumi_small_greeting"
|
||||
}
|
||||
if LumiSmallTalkPhrase(message, "thanks|thank you|thanks a lot|thank you very much") ||
|
||||
LumiSmallTalkPhrase(message, thanks) {
|
||||
return "lumi_small_thanks"
|
||||
}
|
||||
if LumiSmallTalkPhrase(message, "how are you|how are you doing") ||
|
||||
LumiSmallTalkPhrase(message, wellbeing) {
|
||||
return "lumi_small_wellbeing"
|
||||
}
|
||||
if LumiSmallTalkPhrase(message, "do you love me|i love you") ||
|
||||
LumiSmallTalkPhrase(message, affection) {
|
||||
return "lumi_small_affection"
|
||||
}
|
||||
if LumiSmallTalkPhrase(message, "bye|goodbye|good night|see you later") ||
|
||||
LumiSmallTalkPhrase(message, goodbye) {
|
||||
return "lumi_small_goodbye"
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
// A short update message from the installed root package's changelog: the
|
||||
// first few entries, with no link.
|
||||
// A short update message from the installed root package's core Breeze notes,
|
||||
// filtered by scripts/release_notes.py before packaging, with no link.
|
||||
#import "json_scan"
|
||||
#import "byte_text_linux"
|
||||
#import "std/format"
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
# Photos changelog
|
||||
|
||||
## [1.0.4] - 2026-10-24
|
||||
|
||||
- Download on the current Inner Breeze, which only runs the new app format.
|
||||
|
||||
## [1.0.3] - 2026-10-22
|
||||
|
||||
- Make Photos available to everyone without enabling beta apps.
|
||||
|
||||
## [1.0.2] - 2026-10-21
|
||||
|
||||
- Give each achievement its own meaningful icon.
|
||||
|
||||
## [1.0.1] - 2026-10-18
|
||||
|
||||
- Back from an open photo returns to the gallery and keeps your place.
|
||||
- Pinning Photos shows its icon in the sidebar and bottom navigation.
|
||||
- Photos stay unobstructed while the full image arrives, without a loading
|
||||
message over the preview.
|
||||
|
||||
## [1.0.0] - 2026-10-17
|
||||
|
||||
- Keep your photos in Inner Breeze: add them from your device, and see them
|
||||
newest first, by the day they were taken, on every device of your account.
|
||||
Each photo is encrypted on your device and kept once, however often you
|
||||
add it, on your account's nodes that take photos.
|
||||
- Open a photo to see it whole, go to the previous or next one, and move it
|
||||
to Trash. Photos in Trash can be restored.
|
||||
- Photos is in beta and not installed by default; add it from More apps once
|
||||
Settings › About › Show beta apps is on.
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_photos_originals_1_title": "Fotografie · 1 různých položek",
|
||||
"achievement_photos_originals_1_description": "Dosáhněte 1 různých položek touto aktivitou: samostatná původní fotografie uchovaná v knihovně.",
|
||||
"achievement_photos_originals_10_title": "Fotografie · 10 různých položek",
|
||||
"achievement_photos_originals_10_description": "Dosáhněte 10 různých položek touto aktivitou: samostatná původní fotografie uchovaná v knihovně.",
|
||||
"achievement_photos_originals_50_title": "Fotografie · 50 různých položek",
|
||||
"achievement_photos_originals_50_description": "Dosáhněte 50 různých položek touto aktivitou: samostatná původní fotografie uchovaná v knihovně.",
|
||||
"achievement_photos_originals_100_title": "Fotografie · 100 různých položek",
|
||||
"achievement_photos_originals_100_description": "Dosáhněte 100 různých položek touto aktivitou: samostatná původní fotografie uchovaná v knihovně.",
|
||||
"achievement_photos_capture_days_3_title": "Fotografie · 3 dnů",
|
||||
"achievement_photos_capture_days_3_description": "Vykonejte tuto aktivitu v 3 různých dnech: původní fotografie s platným datem pořízení z fotoaparátu.",
|
||||
"achievement_photos_capture_days_7_title": "Fotografie · 7 dnů",
|
||||
"achievement_photos_capture_days_7_description": "Vykonejte tuto aktivitu v 7 různých dnech: původní fotografie s platným datem pořízení z fotoaparátu.",
|
||||
"achievement_photos_capture_days_30_title": "Fotografie · 30 dnů",
|
||||
"achievement_photos_capture_days_30_description": "Vykonejte tuto aktivitu v 30 různých dnech: původní fotografie s platným datem pořízení z fotoaparátu.",
|
||||
"achievement_photos_opened_1_title": "Fotografie · 1 různých položek",
|
||||
"achievement_photos_opened_1_description": "Dosáhněte 1 různých položek touto aktivitou: záměrné úspěšné otevření fotografie.",
|
||||
"achievement_photos_opened_10_title": "Fotografie · 10 různých položek",
|
||||
"achievement_photos_opened_10_description": "Dosáhněte 10 různých položek touto aktivitou: záměrné úspěšné otevření fotografie.",
|
||||
"achievement_photos_view_days_7_title": "Fotografie · 7 dnů",
|
||||
"achievement_photos_view_days_7_description": "Vykonejte tuto aktivitu v 7 různých dnech: záměrné úspěšné otevření fotografie."
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_photos_originals_1_title": "Fotos · 1 verschiedene Elemente",
|
||||
"achievement_photos_originals_1_description": "Erreiche 1 unterschiedliche Elemente mit dieser Aktion: ein eigenständiges Originalfoto in deiner Bibliothek.",
|
||||
"achievement_photos_originals_10_title": "Fotos · 10 verschiedene Elemente",
|
||||
"achievement_photos_originals_10_description": "Erreiche 10 unterschiedliche Elemente mit dieser Aktion: ein eigenständiges Originalfoto in deiner Bibliothek.",
|
||||
"achievement_photos_originals_50_title": "Fotos · 50 verschiedene Elemente",
|
||||
"achievement_photos_originals_50_description": "Erreiche 50 unterschiedliche Elemente mit dieser Aktion: ein eigenständiges Originalfoto in deiner Bibliothek.",
|
||||
"achievement_photos_originals_100_title": "Fotos · 100 verschiedene Elemente",
|
||||
"achievement_photos_originals_100_description": "Erreiche 100 unterschiedliche Elemente mit dieser Aktion: ein eigenständiges Originalfoto in deiner Bibliothek.",
|
||||
"achievement_photos_capture_days_3_title": "Fotos · 3 Tage",
|
||||
"achievement_photos_capture_days_3_description": "Führe dies an 3 unterschiedlichen Tagen aus: ein Originalfoto mit gültigem Aufnahmedatum der Kamera.",
|
||||
"achievement_photos_capture_days_7_title": "Fotos · 7 Tage",
|
||||
"achievement_photos_capture_days_7_description": "Führe dies an 7 unterschiedlichen Tagen aus: ein Originalfoto mit gültigem Aufnahmedatum der Kamera.",
|
||||
"achievement_photos_capture_days_30_title": "Fotos · 30 Tage",
|
||||
"achievement_photos_capture_days_30_description": "Führe dies an 30 unterschiedlichen Tagen aus: ein Originalfoto mit gültigem Aufnahmedatum der Kamera.",
|
||||
"achievement_photos_opened_1_title": "Fotos · 1 verschiedene Elemente",
|
||||
"achievement_photos_opened_1_description": "Erreiche 1 unterschiedliche Elemente mit dieser Aktion: ein bewusst erfolgreich geöffnetes Foto.",
|
||||
"achievement_photos_opened_10_title": "Fotos · 10 verschiedene Elemente",
|
||||
"achievement_photos_opened_10_description": "Erreiche 10 unterschiedliche Elemente mit dieser Aktion: ein bewusst erfolgreich geöffnetes Foto.",
|
||||
"achievement_photos_view_days_7_title": "Fotos · 7 Tage",
|
||||
"achievement_photos_view_days_7_description": "Führe dies an 7 unterschiedlichen Tagen aus: ein bewusst erfolgreich geöffnetes Foto."
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_photos_originals_1_title": "First memory kept",
|
||||
"achievement_photos_originals_1_description": "Reach 1 distinct items through this action: a distinct original photo kept in your library.",
|
||||
"achievement_photos_originals_10_title": "Ten memories kept",
|
||||
"achievement_photos_originals_10_description": "Reach 10 distinct items through this action: a distinct original photo kept in your library.",
|
||||
"achievement_photos_originals_50_title": "Fifty memories kept",
|
||||
"achievement_photos_originals_50_description": "Reach 50 distinct items through this action: a distinct original photo kept in your library.",
|
||||
"achievement_photos_originals_100_title": "One hundred memories kept",
|
||||
"achievement_photos_originals_100_description": "Reach 100 distinct items through this action: a distinct original photo kept in your library.",
|
||||
"achievement_photos_capture_days_3_title": "Three days remembered",
|
||||
"achievement_photos_capture_days_3_description": "Do this on 3 distinct dates: an original photo with a valid camera capture date.",
|
||||
"achievement_photos_capture_days_7_title": "Seven days remembered",
|
||||
"achievement_photos_capture_days_7_description": "Do this on 7 distinct dates: an original photo with a valid camera capture date.",
|
||||
"achievement_photos_capture_days_30_title": "Thirty days remembered",
|
||||
"achievement_photos_capture_days_30_description": "Do this on 30 distinct dates: an original photo with a valid camera capture date.",
|
||||
"achievement_photos_opened_1_title": "A closer look",
|
||||
"achievement_photos_opened_1_description": "Reach 1 distinct items through this action: a photo deliberately opened successfully.",
|
||||
"achievement_photos_opened_10_title": "Ten closer looks",
|
||||
"achievement_photos_opened_10_description": "Reach 10 distinct items through this action: a photo deliberately opened successfully.",
|
||||
"achievement_photos_view_days_7_title": "Returning to your memories",
|
||||
"achievement_photos_view_days_7_description": "Do this on 7 distinct dates: a photo deliberately opened successfully."
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_photos_originals_1_title": "Fotos · 1 elementos distintos",
|
||||
"achievement_photos_originals_1_description": "Alcanza 1 elementos distintos mediante esta acción: una foto original distinta conservada en tu biblioteca.",
|
||||
"achievement_photos_originals_10_title": "Fotos · 10 elementos distintos",
|
||||
"achievement_photos_originals_10_description": "Alcanza 10 elementos distintos mediante esta acción: una foto original distinta conservada en tu biblioteca.",
|
||||
"achievement_photos_originals_50_title": "Fotos · 50 elementos distintos",
|
||||
"achievement_photos_originals_50_description": "Alcanza 50 elementos distintos mediante esta acción: una foto original distinta conservada en tu biblioteca.",
|
||||
"achievement_photos_originals_100_title": "Fotos · 100 elementos distintos",
|
||||
"achievement_photos_originals_100_description": "Alcanza 100 elementos distintos mediante esta acción: una foto original distinta conservada en tu biblioteca.",
|
||||
"achievement_photos_capture_days_3_title": "Fotos · 3 días",
|
||||
"achievement_photos_capture_days_3_description": "Realiza esto en 3 fechas distintas: una foto original con una fecha de captura válida de la cámara.",
|
||||
"achievement_photos_capture_days_7_title": "Fotos · 7 días",
|
||||
"achievement_photos_capture_days_7_description": "Realiza esto en 7 fechas distintas: una foto original con una fecha de captura válida de la cámara.",
|
||||
"achievement_photos_capture_days_30_title": "Fotos · 30 días",
|
||||
"achievement_photos_capture_days_30_description": "Realiza esto en 30 fechas distintas: una foto original con una fecha de captura válida de la cámara.",
|
||||
"achievement_photos_opened_1_title": "Fotos · 1 elementos distintos",
|
||||
"achievement_photos_opened_1_description": "Alcanza 1 elementos distintos mediante esta acción: una foto abierta deliberadamente con éxito.",
|
||||
"achievement_photos_opened_10_title": "Fotos · 10 elementos distintos",
|
||||
"achievement_photos_opened_10_description": "Alcanza 10 elementos distintos mediante esta acción: una foto abierta deliberadamente con éxito.",
|
||||
"achievement_photos_view_days_7_title": "Fotos · 7 días",
|
||||
"achievement_photos_view_days_7_description": "Realiza esto en 7 fechas distintas: una foto abierta deliberadamente con éxito."
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_photos_originals_1_title": "Photos · 1 éléments distincts",
|
||||
"achievement_photos_originals_1_description": "Atteignez 1 éléments distincts par cette action : une photo originale distincte conservée dans votre bibliothèque.",
|
||||
"achievement_photos_originals_10_title": "Photos · 10 éléments distincts",
|
||||
"achievement_photos_originals_10_description": "Atteignez 10 éléments distincts par cette action : une photo originale distincte conservée dans votre bibliothèque.",
|
||||
"achievement_photos_originals_50_title": "Photos · 50 éléments distincts",
|
||||
"achievement_photos_originals_50_description": "Atteignez 50 éléments distincts par cette action : une photo originale distincte conservée dans votre bibliothèque.",
|
||||
"achievement_photos_originals_100_title": "Photos · 100 éléments distincts",
|
||||
"achievement_photos_originals_100_description": "Atteignez 100 éléments distincts par cette action : une photo originale distincte conservée dans votre bibliothèque.",
|
||||
"achievement_photos_capture_days_3_title": "Photos · 3 jours",
|
||||
"achievement_photos_capture_days_3_description": "Faites ceci à 3 dates distinctes : une photo originale avec une date de prise de vue valide de l’appareil.",
|
||||
"achievement_photos_capture_days_7_title": "Photos · 7 jours",
|
||||
"achievement_photos_capture_days_7_description": "Faites ceci à 7 dates distinctes : une photo originale avec une date de prise de vue valide de l’appareil.",
|
||||
"achievement_photos_capture_days_30_title": "Photos · 30 jours",
|
||||
"achievement_photos_capture_days_30_description": "Faites ceci à 30 dates distinctes : une photo originale avec une date de prise de vue valide de l’appareil.",
|
||||
"achievement_photos_opened_1_title": "Photos · 1 éléments distincts",
|
||||
"achievement_photos_opened_1_description": "Atteignez 1 éléments distincts par cette action : une photo ouverte volontairement avec succès.",
|
||||
"achievement_photos_opened_10_title": "Photos · 10 éléments distincts",
|
||||
"achievement_photos_opened_10_description": "Atteignez 10 éléments distincts par cette action : une photo ouverte volontairement avec succès.",
|
||||
"achievement_photos_view_days_7_title": "Photos · 7 jours",
|
||||
"achievement_photos_view_days_7_description": "Faites ceci à 7 dates distinctes : une photo ouverte volontairement avec succès."
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_photos_originals_1_title": "Foto · 1 item berbeda",
|
||||
"achievement_photos_originals_1_description": "Capai 1 item berbeda melalui tindakan ini: foto asli berbeda yang disimpan di perpustakaan Anda.",
|
||||
"achievement_photos_originals_10_title": "Foto · 10 item berbeda",
|
||||
"achievement_photos_originals_10_description": "Capai 10 item berbeda melalui tindakan ini: foto asli berbeda yang disimpan di perpustakaan Anda.",
|
||||
"achievement_photos_originals_50_title": "Foto · 50 item berbeda",
|
||||
"achievement_photos_originals_50_description": "Capai 50 item berbeda melalui tindakan ini: foto asli berbeda yang disimpan di perpustakaan Anda.",
|
||||
"achievement_photos_originals_100_title": "Foto · 100 item berbeda",
|
||||
"achievement_photos_originals_100_description": "Capai 100 item berbeda melalui tindakan ini: foto asli berbeda yang disimpan di perpustakaan Anda.",
|
||||
"achievement_photos_capture_days_3_title": "Foto · 3 hari",
|
||||
"achievement_photos_capture_days_3_description": "Lakukan ini pada 3 tanggal berbeda: foto asli dengan tanggal pengambilan kamera yang sah.",
|
||||
"achievement_photos_capture_days_7_title": "Foto · 7 hari",
|
||||
"achievement_photos_capture_days_7_description": "Lakukan ini pada 7 tanggal berbeda: foto asli dengan tanggal pengambilan kamera yang sah.",
|
||||
"achievement_photos_capture_days_30_title": "Foto · 30 hari",
|
||||
"achievement_photos_capture_days_30_description": "Lakukan ini pada 30 tanggal berbeda: foto asli dengan tanggal pengambilan kamera yang sah.",
|
||||
"achievement_photos_opened_1_title": "Foto · 1 item berbeda",
|
||||
"achievement_photos_opened_1_description": "Capai 1 item berbeda melalui tindakan ini: foto yang sengaja dibuka dengan berhasil.",
|
||||
"achievement_photos_opened_10_title": "Foto · 10 item berbeda",
|
||||
"achievement_photos_opened_10_description": "Capai 10 item berbeda melalui tindakan ini: foto yang sengaja dibuka dengan berhasil.",
|
||||
"achievement_photos_view_days_7_title": "Foto · 7 hari",
|
||||
"achievement_photos_view_days_7_description": "Lakukan ini pada 7 tanggal berbeda: foto yang sengaja dibuka dengan berhasil."
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_photos_originals_1_title": "Foto · 1 elementi distinti",
|
||||
"achievement_photos_originals_1_description": "Raggiungi 1 elementi distinti tramite questa azione: una foto originale distinta conservata nella tua raccolta.",
|
||||
"achievement_photos_originals_10_title": "Foto · 10 elementi distinti",
|
||||
"achievement_photos_originals_10_description": "Raggiungi 10 elementi distinti tramite questa azione: una foto originale distinta conservata nella tua raccolta.",
|
||||
"achievement_photos_originals_50_title": "Foto · 50 elementi distinti",
|
||||
"achievement_photos_originals_50_description": "Raggiungi 50 elementi distinti tramite questa azione: una foto originale distinta conservata nella tua raccolta.",
|
||||
"achievement_photos_originals_100_title": "Foto · 100 elementi distinti",
|
||||
"achievement_photos_originals_100_description": "Raggiungi 100 elementi distinti tramite questa azione: una foto originale distinta conservata nella tua raccolta.",
|
||||
"achievement_photos_capture_days_3_title": "Foto · 3 giorni",
|
||||
"achievement_photos_capture_days_3_description": "Fallo in 3 date distinte: una foto originale con una data di scatto valida della fotocamera.",
|
||||
"achievement_photos_capture_days_7_title": "Foto · 7 giorni",
|
||||
"achievement_photos_capture_days_7_description": "Fallo in 7 date distinte: una foto originale con una data di scatto valida della fotocamera.",
|
||||
"achievement_photos_capture_days_30_title": "Foto · 30 giorni",
|
||||
"achievement_photos_capture_days_30_description": "Fallo in 30 date distinte: una foto originale con una data di scatto valida della fotocamera.",
|
||||
"achievement_photos_opened_1_title": "Foto · 1 elementi distinti",
|
||||
"achievement_photos_opened_1_description": "Raggiungi 1 elementi distinti tramite questa azione: una foto aperta volontariamente con successo.",
|
||||
"achievement_photos_opened_10_title": "Foto · 10 elementi distinti",
|
||||
"achievement_photos_opened_10_description": "Raggiungi 10 elementi distinti tramite questa azione: una foto aperta volontariamente con successo.",
|
||||
"achievement_photos_view_days_7_title": "Foto · 7 giorni",
|
||||
"achievement_photos_view_days_7_description": "Fallo in 7 date distinte: una foto aperta volontariamente con successo."
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_photos_originals_1_title": "写真 · 1 種類の項目",
|
||||
"achievement_photos_originals_1_description": "この操作で異なる1項目に達する:ライブラリに保存した別々のオリジナル写真。",
|
||||
"achievement_photos_originals_10_title": "写真 · 10 種類の項目",
|
||||
"achievement_photos_originals_10_description": "この操作で異なる10項目に達する:ライブラリに保存した別々のオリジナル写真。",
|
||||
"achievement_photos_originals_50_title": "写真 · 50 種類の項目",
|
||||
"achievement_photos_originals_50_description": "この操作で異なる50項目に達する:ライブラリに保存した別々のオリジナル写真。",
|
||||
"achievement_photos_originals_100_title": "写真 · 100 種類の項目",
|
||||
"achievement_photos_originals_100_description": "この操作で異なる100項目に達する:ライブラリに保存した別々のオリジナル写真。",
|
||||
"achievement_photos_capture_days_3_title": "写真 · 3 日",
|
||||
"achievement_photos_capture_days_3_description": "異なる3日で行う:カメラの有効な撮影日が記録されたオリジナル写真。",
|
||||
"achievement_photos_capture_days_7_title": "写真 · 7 日",
|
||||
"achievement_photos_capture_days_7_description": "異なる7日で行う:カメラの有効な撮影日が記録されたオリジナル写真。",
|
||||
"achievement_photos_capture_days_30_title": "写真 · 30 日",
|
||||
"achievement_photos_capture_days_30_description": "異なる30日で行う:カメラの有効な撮影日が記録されたオリジナル写真。",
|
||||
"achievement_photos_opened_1_title": "写真 · 1 種類の項目",
|
||||
"achievement_photos_opened_1_description": "この操作で異なる1項目に達する:意図して正常に開いた写真。",
|
||||
"achievement_photos_opened_10_title": "写真 · 10 種類の項目",
|
||||
"achievement_photos_opened_10_description": "この操作で異なる10項目に達する:意図して正常に開いた写真。",
|
||||
"achievement_photos_view_days_7_title": "写真 · 7 日",
|
||||
"achievement_photos_view_days_7_description": "異なる7日で行う:意図して正常に開いた写真。"
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
{
|
||||
"achievement_photos_originals_1_title": "사진 · 1 개 항목",
|
||||
"achievement_photos_originals_1_description": "이 작업으로 서로 다른 1개 항목에 도달하세요: 보관함에 저장한 서로 다른 원본 사진.",
|
||||
"achievement_photos_originals_10_title": "사진 · 10 개 항목",
|
||||
"achievement_photos_originals_10_description": "이 작업으로 서로 다른 10개 항목에 도달하세요: 보관함에 저장한 서로 다른 원본 사진.",
|
||||
"achievement_photos_originals_50_title": "사진 · 50 개 항목",
|
||||
"achievement_photos_originals_50_description": "이 작업으로 서로 다른 50개 항목에 도달하세요: 보관함에 저장한 서로 다른 원본 사진.",
|
||||
"achievement_photos_originals_100_title": "사진 · 100 개 항목",
|
||||
"achievement_photos_originals_100_description": "이 작업으로 서로 다른 100개 항목에 도달하세요: 보관함에 저장한 서로 다른 원본 사진.",
|
||||
"achievement_photos_capture_days_3_title": "사진 · 3 일",
|
||||
"achievement_photos_capture_days_3_description": "서로 다른 3일에 수행하세요: 유효한 카메라 촬영 날짜가 기록된 원본 사진.",
|
||||
"achievement_photos_capture_days_7_title": "사진 · 7 일",
|
||||
"achievement_photos_capture_days_7_description": "서로 다른 7일에 수행하세요: 유효한 카메라 촬영 날짜가 기록된 원본 사진.",
|
||||
"achievement_photos_capture_days_30_title": "사진 · 30 일",
|
||||
"achievement_photos_capture_days_30_description": "서로 다른 30일에 수행하세요: 유효한 카메라 촬영 날짜가 기록된 원본 사진.",
|
||||
"achievement_photos_opened_1_title": "사진 · 1 개 항목",
|
||||
"achievement_photos_opened_1_description": "이 작업으로 서로 다른 1개 항목에 도달하세요: 직접 선택하여 정상적으로 연 사진.",
|
||||
"achievement_photos_opened_10_title": "사진 · 10 개 항목",
|
||||
"achievement_photos_opened_10_description": "이 작업으로 서로 다른 10개 항목에 도달하세요: 직접 선택하여 정상적으로 연 사진.",
|
||||
"achievement_photos_view_days_7_title": "사진 · 7 일",
|
||||
"achievement_photos_view_days_7_description": "서로 다른 7일에 수행하세요: 직접 선택하여 정상적으로 연 사진."
|
||||
}
|
||||
Loaded 100 of 1447 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user