Use standard Kryon buttons throughout Inbe and show lists as tabs
This commit is contained in:
1 parent
6d67c320d4
commit
ee3cf84e8d
58 files changed
+1704
-1169
No files matched your search
@@ -40,6 +40,14 @@
|
||||
|
||||
## Readability Rule
|
||||
|
||||
- Buttons use Kryon's `Button(ButtonProps)` directly, including icon buttons
|
||||
and clickable cards. Do not restore app-local button wrappers or separately
|
||||
painted hover/click surfaces. Keep custom card content and domain gestures,
|
||||
but let the shared button own its surface and activation. Checkboxes and
|
||||
toggles use their own standard widgets. Run `make button-api-check`.
|
||||
- The Lists screen starts with list tabs; do not restore a separate Lists
|
||||
title bar or replace the tabs with a dropdown.
|
||||
|
||||
- Write conventional, fully readable code. Never compress multiple statements,
|
||||
branches, declarations, or error checks onto one line. Use descriptive names,
|
||||
explicit control flow, and focused helpers.
|
||||
|
||||
@@ -745,6 +745,12 @@ no-vendor-edits:
|
||||
clean-text-api-check:
|
||||
python3 $(KRYON_DIR)/scripts/check-clean-text-api.py src tests
|
||||
|
||||
.PHONY: button-api-check
|
||||
button-api-check:
|
||||
bash scripts/check-button-api.sh
|
||||
|
||||
test: button-api-check
|
||||
|
||||
secret-check:
|
||||
python3 ./scripts/check-secrets.py --working-tree
|
||||
|
||||
@@ -761,6 +767,10 @@ embedded-image-assets-check: $(EMBEDDED_ASSETS_C)
|
||||
habits-cards-ui-test: $(TARGET)
|
||||
xvfb-run -a bash tests/habits_cards_ui_test.sh "$(abspath $(TARGET))"
|
||||
|
||||
.PHONY: lists-ui-test
|
||||
lists-ui-test: $(TARGET)
|
||||
xvfb-run -a bash tests/lists_ui_test.sh "$(abspath $(TARGET))"
|
||||
|
||||
test: clean-text-api-check no-vendor-edits secret-check $(TESTS) font-bundle-check audio-test-fixture-check embedded-image-assets-check
|
||||
bash ./tests/screenshot_scene_test.sh
|
||||
echo "== BreathSession tests =="; \
|
||||
@@ -876,6 +886,16 @@ $(APP_BOTTOM_NAV_TEST): tests/app_bottom_nav_test.c src/app/app_nav.h src/app/ap
|
||||
$(KRY_GEN_DIR)/src/app/customize_nav.c \
|
||||
$(KRY_GEN_DIR)/src/widgets/bottom_nav.c
|
||||
|
||||
.PHONY: elist-screen-test
|
||||
test: elist-screen-test
|
||||
elist-screen-test: $(TEST_BIN_DIR)/elist_screen_test
|
||||
$<
|
||||
|
||||
$(TEST_BIN_DIR)/elist_screen_test: tests/elist_screen_test.c $(KRY_GEN_DIR)/src/screens/elist_screen.c src/app/app.h | $(TEST_BIN_DIR)
|
||||
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE -ffunction-sections -fdata-sections \
|
||||
-Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/storage -Isrc/platform/android $(KRYON_INCLUDE) -I$(KRY_GEN_DIR) -I$(KRY_GEN_DIR)/src $(SQLITE_INCLUDE) \
|
||||
-Wl,--gc-sections -o $@ tests/elist_screen_test.c
|
||||
|
||||
$(TEST_BIN_DIR)/habit_form_test: tests/habit_form_test.c $(KRY_GEN_DIR)/src/screens/habits/edit.c src/app/app.h | $(TEST_BIN_DIR)
|
||||
$(CC) -Wall -Wextra -std=c99 -D_DEFAULT_SOURCE -ffunction-sections -fdata-sections \
|
||||
-Isrc -Isrc/app -Isrc/core -Isrc/screens -Isrc/screens/settings -Isrc/storage -Isrc/platform/android $(KRYON_INCLUDE) -I$(KRY_GEN_DIR) -I$(KRY_GEN_DIR)/src \
|
||||
|
||||
@@ -76,6 +76,8 @@ list(REMOVE_ITEM KRYON_SOURCES
|
||||
"${KRYON_DIR}/src/scene/node_collision_shape2d.c")
|
||||
file(GLOB KRYON_K2C_SOURCES CONFIGURE_DEPENDS "${KRYON_DIR}/cmd/k2c/*.c")
|
||||
file(GLOB KRYON_KIR_SOURCES CONFIGURE_DEPENDS "${KRYON_DIR}/cmd/kir/*.c")
|
||||
file(GLOB KRYON_K2C_HEADERS CONFIGURE_DEPENDS
|
||||
"${KRYON_DIR}/cmd/k2c/*.h" "${KRYON_DIR}/cmd/kir/*.h")
|
||||
list(APPEND KRYON_K2C_SOURCES ${KRYON_KIR_SOURCES})
|
||||
list(SORT KRYON_K2C_SOURCES)
|
||||
find_program(HOST_CC NAMES cc clang gcc REQUIRED)
|
||||
@@ -118,7 +120,7 @@ add_custom_command(
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_BINARY_DIR}/host-tools"
|
||||
# VERBATIM escapes embedded quotes, so unquoted -I paths (no spaces here)
|
||||
COMMAND "${HOST_CC}" -Wall -Wextra -O2 -I${KRYON_DIR}/cmd/kir -I${KRYON_DIR}/cmd/k2c -o "${KRYON_K2C}" ${KRYON_K2C_SOURCES}
|
||||
DEPENDS ${KRYON_K2C_SOURCES}
|
||||
DEPENDS ${KRYON_K2C_SOURCES} ${KRYON_K2C_HEADERS}
|
||||
VERBATIM
|
||||
)
|
||||
# Kryon ships part of its runtime as Kry modules transpiled at build time
|
||||
@@ -126,11 +128,13 @@ add_custom_command(
|
||||
# the generated sources and put their directory on the include path so
|
||||
# kryon's own C files can #include "runtime/*.h".
|
||||
set(KRYON_RUNTIME_GEN_DIR "${CMAKE_BINARY_DIR}/kryon/generated-runtime")
|
||||
set(KRYON_RUNTIME_KRY_MODULES
|
||||
runtime/button.kry
|
||||
runtime/theme.kry
|
||||
runtime/menu_button.kry
|
||||
runtime/split_button.kry)
|
||||
file(GLOB KRYON_RUNTIME_MODULE_FILES CONFIGURE_DEPENDS
|
||||
"${KRYON_DIR}/runtime/*.kry")
|
||||
set(KRYON_RUNTIME_KRY_MODULES)
|
||||
foreach(kryon_module_file ${KRYON_RUNTIME_MODULE_FILES})
|
||||
file(RELATIVE_PATH kryon_module "${KRYON_DIR}" "${kryon_module_file}")
|
||||
list(APPEND KRYON_RUNTIME_KRY_MODULES "${kryon_module}")
|
||||
endforeach()
|
||||
set(KRYON_RUNTIME_KRY_FILES)
|
||||
set(KRYON_RUNTIME_GENERATED_C)
|
||||
foreach(kryon_module ${KRYON_RUNTIME_KRY_MODULES})
|
||||
|
||||
@@ -1780,15 +1780,22 @@ Rozvrh a připomenutí
|
||||
---
|
||||
[tab_elist]
|
||||
Seznamy
|
||||
---
|
||||
[elist_title]
|
||||
Seznamy
|
||||
---
|
||||
[elist_new_list]
|
||||
Novy seznam
|
||||
---
|
||||
[elist_create_list]
|
||||
Vytvorit seznam
|
||||
---
|
||||
[elist_add_item]
|
||||
Pridat
|
||||
---
|
||||
[elist_empty_title]
|
||||
Zatim zadne seznamy
|
||||
---
|
||||
[elist_empty_detail]
|
||||
Vytvorte seznam a pridejte ukoly a poznamky na jednom miste.
|
||||
---
|
||||
@@ -1780,15 +1780,22 @@ Zeitplan & Erinnerung
|
||||
---
|
||||
[tab_elist]
|
||||
Listen
|
||||
---
|
||||
[elist_title]
|
||||
Listen
|
||||
---
|
||||
[elist_new_list]
|
||||
Neue Liste
|
||||
---
|
||||
[elist_create_list]
|
||||
Liste erstellen
|
||||
---
|
||||
[elist_add_item]
|
||||
Hinzufugen
|
||||
---
|
||||
[elist_empty_title]
|
||||
Noch keine Listen
|
||||
---
|
||||
[elist_empty_detail]
|
||||
Erstelle eine Liste und fuge Aufgaben und Notizen an einem Ort hinzu.
|
||||
---
|
||||
@@ -1812,15 +1812,22 @@ Schedule & reminder
|
||||
---
|
||||
[tab_elist]
|
||||
Lists
|
||||
---
|
||||
[elist_title]
|
||||
Lists
|
||||
---
|
||||
[elist_new_list]
|
||||
New list
|
||||
---
|
||||
[elist_create_list]
|
||||
Create list
|
||||
---
|
||||
[elist_add_item]
|
||||
Add
|
||||
---
|
||||
[elist_empty_title]
|
||||
No lists yet
|
||||
---
|
||||
[elist_empty_detail]
|
||||
Create a list, then add tasks and notes in one place.
|
||||
---
|
||||
@@ -1780,15 +1780,22 @@ Horario y recordatorio
|
||||
---
|
||||
[tab_elist]
|
||||
Listas
|
||||
---
|
||||
[elist_title]
|
||||
Listas
|
||||
---
|
||||
[elist_new_list]
|
||||
Nueva lista
|
||||
---
|
||||
[elist_create_list]
|
||||
Crear lista
|
||||
---
|
||||
[elist_add_item]
|
||||
Agregar
|
||||
---
|
||||
[elist_empty_title]
|
||||
Aun no hay listas
|
||||
---
|
||||
[elist_empty_detail]
|
||||
Crea una lista y agrega tareas y notas en un solo lugar.
|
||||
---
|
||||
@@ -1780,15 +1780,22 @@ Planning et rappel
|
||||
---
|
||||
[tab_elist]
|
||||
Listes
|
||||
---
|
||||
[elist_title]
|
||||
Listes
|
||||
---
|
||||
[elist_new_list]
|
||||
Nouvelle liste
|
||||
---
|
||||
[elist_create_list]
|
||||
Creer la liste
|
||||
---
|
||||
[elist_add_item]
|
||||
Ajouter
|
||||
---
|
||||
[elist_empty_title]
|
||||
Aucune liste
|
||||
---
|
||||
[elist_empty_detail]
|
||||
Creez une liste, puis ajoutez vos taches et notes au meme endroit.
|
||||
---
|
||||
@@ -1780,15 +1780,22 @@ Jadwal & pengingat
|
||||
---
|
||||
[tab_elist]
|
||||
Daftar
|
||||
---
|
||||
[elist_title]
|
||||
Daftar
|
||||
---
|
||||
[elist_new_list]
|
||||
Daftar baru
|
||||
---
|
||||
[elist_create_list]
|
||||
Buat daftar
|
||||
---
|
||||
[elist_add_item]
|
||||
Tambah
|
||||
---
|
||||
[elist_empty_title]
|
||||
Belum ada daftar
|
||||
---
|
||||
[elist_empty_detail]
|
||||
Buat daftar, lalu tambahkan tugas dan catatan di satu tempat.
|
||||
---
|
||||
@@ -1780,15 +1780,22 @@ Pianificazione e promemoria
|
||||
---
|
||||
[tab_elist]
|
||||
Liste
|
||||
---
|
||||
[elist_title]
|
||||
Liste
|
||||
---
|
||||
[elist_new_list]
|
||||
Nuova lista
|
||||
---
|
||||
[elist_create_list]
|
||||
Crea lista
|
||||
---
|
||||
[elist_add_item]
|
||||
Aggiungi
|
||||
---
|
||||
[elist_empty_title]
|
||||
Nessuna lista
|
||||
---
|
||||
[elist_empty_detail]
|
||||
Crea una lista, poi aggiungi attivita e note in un unico posto.
|
||||
---
|
||||
@@ -1782,15 +1782,22 @@ Dismiss forever
|
||||
---
|
||||
[tab_elist]
|
||||
リスト
|
||||
---
|
||||
[elist_title]
|
||||
リスト
|
||||
---
|
||||
[elist_new_list]
|
||||
新しいリスト
|
||||
---
|
||||
[elist_create_list]
|
||||
リストを作成
|
||||
---
|
||||
[elist_add_item]
|
||||
追加
|
||||
---
|
||||
[elist_empty_title]
|
||||
リストはまだありません
|
||||
---
|
||||
[elist_empty_detail]
|
||||
リストを作成して、タスクとメモをまとめて管理できます。
|
||||
---
|
||||
@@ -1780,15 +1780,22 @@ Dismiss forever
|
||||
---
|
||||
[tab_elist]
|
||||
목록
|
||||
---
|
||||
[elist_title]
|
||||
목록
|
||||
---
|
||||
[elist_new_list]
|
||||
새 목록
|
||||
---
|
||||
[elist_create_list]
|
||||
목록 만들기
|
||||
---
|
||||
[elist_add_item]
|
||||
추가
|
||||
---
|
||||
[elist_empty_title]
|
||||
아직 목록이 없습니다
|
||||
---
|
||||
[elist_empty_detail]
|
||||
목록을 만들고 작업과 메모를 한곳에 추가하세요.
|
||||
---
|
||||
@@ -1780,15 +1780,22 @@ Programação e lembrete
|
||||
---
|
||||
[tab_elist]
|
||||
Listas
|
||||
---
|
||||
[elist_title]
|
||||
Listas
|
||||
---
|
||||
[elist_new_list]
|
||||
Nova lista
|
||||
---
|
||||
[elist_create_list]
|
||||
Criar lista
|
||||
---
|
||||
[elist_add_item]
|
||||
Adicionar
|
||||
---
|
||||
[elist_empty_title]
|
||||
Ainda nao ha listas
|
||||
---
|
||||
[elist_empty_detail]
|
||||
Crie uma lista e adicione tarefas e notas em um so lugar.
|
||||
---
|
||||
@@ -1780,15 +1780,22 @@ Dismiss forever
|
||||
---
|
||||
[tab_elist]
|
||||
Списки
|
||||
---
|
||||
[elist_title]
|
||||
Списки
|
||||
---
|
||||
[elist_new_list]
|
||||
Новый список
|
||||
---
|
||||
[elist_create_list]
|
||||
Создать список
|
||||
---
|
||||
[elist_add_item]
|
||||
Добавить
|
||||
---
|
||||
[elist_empty_title]
|
||||
Списков пока нет
|
||||
---
|
||||
[elist_empty_detail]
|
||||
Создайте список и добавляйте задачи и заметки в одном месте.
|
||||
---
|
||||
@@ -1780,15 +1780,22 @@ Dismiss forever
|
||||
---
|
||||
[tab_elist]
|
||||
清单
|
||||
---
|
||||
[elist_title]
|
||||
清单
|
||||
---
|
||||
[elist_new_list]
|
||||
新建清单
|
||||
---
|
||||
[elist_create_list]
|
||||
创建清单
|
||||
---
|
||||
[elist_add_item]
|
||||
添加
|
||||
---
|
||||
[elist_empty_title]
|
||||
还没有清单
|
||||
---
|
||||
[elist_empty_detail]
|
||||
创建清单,在一个地方添加任务和备注。
|
||||
---
|
||||
@@ -0,0 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
if rg -n '\b(StyledButton|TextButton|RenderTextButton|IconButton|PaddedIconBtn|IconBtn|OverlayButton|InvisibleButton)\s*\(' src --glob '*.kry' --glob '*.c'; then
|
||||
echo 'Use Button(ButtonProps) for buttons; use standard Checkbox/Toggle for their own controls.' >&2
|
||||
exit 1
|
||||
fi
|
||||
if rg -n 'TitleBar\(' src/screens/elist_screen.kry; then
|
||||
echo 'The Lists screen starts with its list tabs, without a separate title bar.' >&2
|
||||
exit 1
|
||||
fi
|
||||
echo 'Canonical button API and title-free list tabs checks passed'
|
||||
+67
-60
@@ -72,13 +72,6 @@
|
||||
#define APP_DEFAULT_HEIGHT 720
|
||||
#endif
|
||||
|
||||
int
|
||||
TextButton(int id, int x, int y, const char *label, int *hover)
|
||||
{
|
||||
(void)id;
|
||||
return RenderTextButton(x, y, label, hover);
|
||||
}
|
||||
|
||||
void
|
||||
ReadonlyTextBox(ReadonlyTextBoxProps props)
|
||||
{
|
||||
@@ -615,15 +608,12 @@ app_draw_blank_home_easteregg(InnerBreeze*app)
|
||||
Texture2D logo;
|
||||
Rectangle src;
|
||||
Rectangle dst;
|
||||
Vector2 mouse;
|
||||
Vector2 origin;
|
||||
Color logo_tint;
|
||||
float scale;
|
||||
float logo_size;
|
||||
float logo_scale;
|
||||
int bottom_reserved;
|
||||
int available_h;
|
||||
int logo_hover;
|
||||
|
||||
if(app == NULL)
|
||||
return;
|
||||
@@ -681,26 +671,15 @@ app_draw_blank_home_easteregg(InnerBreeze*app)
|
||||
dst.y = ((float)available_h - (float)logo.height * logo_scale) * 0.5f;
|
||||
dst.width = (float)logo.width * logo_scale;
|
||||
dst.height = (float)logo.height * logo_scale;
|
||||
mouse = GetScreenToWorld2D(GetMousePosition(), app->camera);
|
||||
logo_hover = CheckCollisionPointRec(mouse, dst) &&
|
||||
!UIInputCapturesClick(mouse);
|
||||
if(logo_hover) {
|
||||
MarkUIClickable();
|
||||
if(IsMouseButtonReleased(MOUSE_BUTTON_LEFT))
|
||||
(void)OpenURI("https://waozi.xyz");
|
||||
}
|
||||
if(logo_hover) {
|
||||
logo_tint.r = 210;
|
||||
logo_tint.g = 210;
|
||||
logo_tint.b = 210;
|
||||
logo_tint.a = 255;
|
||||
} else {
|
||||
logo_tint.r = 150;
|
||||
logo_tint.g = 150;
|
||||
logo_tint.b = 150;
|
||||
logo_tint.a = 255;
|
||||
}
|
||||
DrawTexturePro(logo, src, dst, origin, 0.0f, logo_tint);
|
||||
if(Button((ButtonProps){
|
||||
.bounds = dst, .icon = logo, .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisGhost,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = logo_size * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}))
|
||||
(void)OpenURI("https://waozi.xyz");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1096,7 +1075,6 @@ app_draw_donation_coin_section(const char *label, const char *address,
|
||||
int card_y = y != NULL ? *y : 0;
|
||||
int card_h;
|
||||
int box_h;
|
||||
int hover = 0;
|
||||
TextInputStyle style = app_donation_address_style();
|
||||
TextAreaProps text_area;
|
||||
|
||||
@@ -1152,9 +1130,14 @@ app_draw_donation_coin_section(const char *label, const char *address,
|
||||
if(stack_buttons)
|
||||
button_w = content_w;
|
||||
|
||||
if(StyledButton(content_x, *y, button_w, button_h,
|
||||
GetLocaleText("copy_address_button"),
|
||||
ButtonStyleSecondary, 0, &hover)) {
|
||||
if(Button((ButtonProps){
|
||||
.bounds = {(float)(content_x), (float)(*y), (float)(button_w), (float)(button_h)},
|
||||
.label = GetLocaleText("copy_address_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
})) {
|
||||
#if ANDROID_BUILD
|
||||
int android_copy_ok =
|
||||
android_device_copy_text_and_toast(address,
|
||||
@@ -1171,20 +1154,29 @@ app_draw_donation_coin_section(const char *label, const char *address,
|
||||
|
||||
if(stack_buttons)
|
||||
*y += button_h + gap;
|
||||
if(StyledButton(stack_buttons ? content_x : content_x + button_w + gap,
|
||||
*y, button_w, button_h,
|
||||
GetLocaleText("open_wallet_button"),
|
||||
ButtonStyleSecondary, 0, &hover)) {
|
||||
if(Button((ButtonProps){
|
||||
.bounds = {(float)(stack_buttons ? content_x : content_x + button_w + gap), (float)(*y), (float)(button_w), (float)(button_h)},
|
||||
.label = GetLocaleText("open_wallet_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
})) {
|
||||
if(!OpenURI(wallet_url))
|
||||
ShowToast(GetLocaleText("wallet_not_installed_toast"));
|
||||
}
|
||||
|
||||
if(stack_buttons)
|
||||
*y += button_h + gap;
|
||||
if(StyledButton(stack_buttons ? content_x :
|
||||
content_x + (button_w + gap) * 2, *y, button_w, button_h,
|
||||
GetLocaleText("trocador_button"),
|
||||
ButtonStylePrimary, 0, &hover)) {
|
||||
if(Button((ButtonProps){
|
||||
.bounds = {(float)(stack_buttons ? content_x :
|
||||
content_x + (button_w + gap) * 2), (float)(*y), (float)(button_w), (float)(button_h)},
|
||||
.label = GetLocaleText("trocador_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
})) {
|
||||
(void)OpenURI(trocador_url);
|
||||
}
|
||||
|
||||
@@ -1216,7 +1208,6 @@ draw_about_donation_modal(InnerBreeze*app)
|
||||
int coin_y;
|
||||
int button_w;
|
||||
int button_h = Scale(36);
|
||||
int hover = 0;
|
||||
Texture2D empty_icon;
|
||||
|
||||
if(app == NULL)
|
||||
@@ -1338,11 +1329,14 @@ draw_about_donation_modal(InnerBreeze*app)
|
||||
}
|
||||
EndUIScrollContainer(scroll_area, scroll_view);
|
||||
|
||||
if(StyledButton(frame.x + (frame.w - button_w) / 2,
|
||||
frame.y + frame.h - button_h - Scale(16),
|
||||
button_w, button_h,
|
||||
GetLocaleText("close_button"),
|
||||
ButtonStyleSecondary, 0, &hover)) {
|
||||
if(Button((ButtonProps){
|
||||
.bounds = {(float)(frame.x + (frame.w - button_w) / 2), (float)(frame.y + frame.h - button_h - Scale(16)), (float)(button_w), (float)(button_h)},
|
||||
.label = GetLocaleText("close_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
})) {
|
||||
app_close_modal(app);
|
||||
}
|
||||
}
|
||||
@@ -1397,7 +1391,6 @@ draw_secure_migration_modal(InnerBreeze*app)
|
||||
int button_y;
|
||||
int button_h;
|
||||
int gap;
|
||||
int hover = 0;
|
||||
|
||||
if(app == NULL)
|
||||
return;
|
||||
@@ -1480,23 +1473,37 @@ draw_secure_migration_modal(InnerBreeze*app)
|
||||
button_y = frame.y + frame.h - Scale(24) - button_h;
|
||||
if(!status.secure_migration_pending) {
|
||||
int button_w = Scale(120);
|
||||
if(StyledButton(frame.x + (frame.w - button_w) / 2, button_y,
|
||||
button_w, button_h, GetLocaleText("ok_button"),
|
||||
ButtonStylePrimary, 0, &hover))
|
||||
if(Button((ButtonProps){
|
||||
.bounds = {(float)(frame.x + (frame.w - button_w) / 2), (float)(button_y), (float)(button_w), (float)(button_h)},
|
||||
.label = GetLocaleText("ok_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}))
|
||||
app_close_modal(app);
|
||||
} else {
|
||||
int button_w = (frame.content_w - gap) / 2;
|
||||
if(StyledButton(frame.content_x, button_y, button_w, button_h,
|
||||
GetLocaleText("sync_secure_migration_later_button"),
|
||||
ButtonStyleSecondary, 0, &hover)) {
|
||||
if(Button((ButtonProps){
|
||||
.bounds = {(float)(frame.content_x), (float)(button_y), (float)(button_w), (float)(button_h)},
|
||||
.label = GetLocaleText("sync_secure_migration_later_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
})) {
|
||||
app->secure_migration_prompt_seen = 1;
|
||||
app->secure_migration_deferred = 1;
|
||||
app_close_modal(app);
|
||||
}
|
||||
if(StyledButton(frame.content_x + button_w + gap, button_y,
|
||||
button_w, button_h,
|
||||
GetLocaleText("sync_secure_migration_start_button"),
|
||||
ButtonStylePrimary, 0, &hover)) {
|
||||
if(Button((ButtonProps){
|
||||
.bounds = {(float)(frame.content_x + button_w + gap), (float)(button_y), (float)(button_w), (float)(button_h)},
|
||||
.label = GetLocaleText("sync_secure_migration_start_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
})) {
|
||||
app->secure_migration_prompt_seen = 1;
|
||||
app->secure_migration_deferred = 0;
|
||||
app->secure_migration_started = 1;
|
||||
@@ -1617,11 +1624,11 @@ static const struct {
|
||||
static void
|
||||
updateapp(InnerBreeze*app)
|
||||
{
|
||||
int hover = 0;
|
||||
int center_x = view_width / 2;
|
||||
int frame_view_height = view_height;
|
||||
int center_y;
|
||||
int i;
|
||||
int hover = 0;
|
||||
AppRoute frame_route;
|
||||
int first_run_guide_active = 0;
|
||||
int habits_guide_active = 0;
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "kryon.h"
|
||||
#include "platform.h"
|
||||
#include "styled_button.h"
|
||||
#include "core/breath_engine.h"
|
||||
#include "breaks/break_engine.h"
|
||||
#include "app_fwd.h"
|
||||
@@ -17,7 +16,6 @@
|
||||
extern int view_width;
|
||||
extern int view_height;
|
||||
|
||||
int TextButton(int id, int x, int y, const char *label, int *hover);
|
||||
int app_locale_dropdown(int id, int x, int y, int w, int h,
|
||||
int *selected_index);
|
||||
void ReadonlyTextBox(ReadonlyTextBoxProps props);
|
||||
|
||||
+26
-6
@@ -4,7 +4,7 @@
|
||||
|
||||
app_draw_close_title_bar :: (app: InnerBreeze*, title: const char*,
|
||||
height: int) -> int #export {
|
||||
hover := 0
|
||||
|
||||
button_size := Scale(22)
|
||||
padding := Scale(11)
|
||||
button_total := button_size + padding * 2
|
||||
@@ -13,8 +13,18 @@ app_draw_close_title_bar :: (app: InnerBreeze*, title: const char*,
|
||||
if y < 0 { y = 0 }
|
||||
TitleBar(title, height)
|
||||
if app != nil && !app->modal.active &&
|
||||
PaddedIconBtn(0, x, y, button_size, padding,
|
||||
app->icons[UI_ICON_TYPE_X], &hover) {
|
||||
Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(x), (float)(y),
|
||||
(float)((button_size) + (padding) * 2),
|
||||
(float)((button_size) + (padding) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_X], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(button_size) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
@@ -28,7 +38,7 @@ app_scaffold_close_title :: (title: const char*, height: int,
|
||||
app_draw_close_dropdown_title_bar :: (app: InnerBreeze*,
|
||||
dropdown: UITitleBarDropdown,
|
||||
height: int) -> int #export {
|
||||
hover := 0
|
||||
|
||||
button_size := Scale(22)
|
||||
padding := Scale(11)
|
||||
button_total := button_size + padding * 2
|
||||
@@ -47,8 +57,18 @@ app_draw_close_dropdown_title_bar :: (app: InnerBreeze*,
|
||||
Dropdown(dropdown.id, dropdown_x, dropdown_y, dropdown_w, dropdown_h,
|
||||
dropdown.options, dropdown.option_count, dropdown.selected_index)
|
||||
if app != nil && !app->modal.active &&
|
||||
PaddedIconBtn(0, close_x, close_y, button_size, padding,
|
||||
app->icons[UI_ICON_TYPE_X], &hover) {
|
||||
Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(close_x), (float)(close_y),
|
||||
(float)((button_size) + (padding) * 2),
|
||||
(float)((button_size) + (padding) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_X], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(button_size) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
|
||||
+53
-46
@@ -44,7 +44,7 @@ app_active_practice_title_height :: () -> int {
|
||||
}
|
||||
|
||||
app_draw_active_practice_title_bar :: (app: InnerBreeze*, title: const char*, height: int) -> int {
|
||||
hover := 0
|
||||
|
||||
button_size := Scale(24)
|
||||
padding := Scale(10)
|
||||
button_total := button_size + padding * 2
|
||||
@@ -94,8 +94,18 @@ app_draw_active_practice_title_bar :: (app: InnerBreeze*, title: const char*, he
|
||||
.wrap = TextWrapNone
|
||||
})
|
||||
if app != NULL && !app->modal.active &&
|
||||
PaddedIconBtn(0, close_x, close_y, button_size, padding,
|
||||
app->icons[UI_ICON_TYPE_X], &hover) {
|
||||
Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(close_x), (float)(close_y),
|
||||
(float)((button_size) + (padding) * 2),
|
||||
(float)((button_size) + (padding) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_X], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(button_size) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
@@ -151,8 +161,7 @@ app_nav_desktop_rail_enabled :: (app: const InnerBreeze*) -> int {
|
||||
if app->modal.active && app->modal.type == UIModalEditProgressiveStartSpeed {
|
||||
return 0
|
||||
}
|
||||
if app->breathing.screen == ScreenHabitEdit ||
|
||||
app->breathing.screen == ScreenHabitSessionEdit ||
|
||||
if app->breathing.screen == ScreenHabitSessionEdit ||
|
||||
app->breathing.screen == ScreenSession ||
|
||||
app->breathing.screen == ScreenMeditation ||
|
||||
app->breathing.screen == ScreenSunSalutation ||
|
||||
@@ -162,6 +171,7 @@ app_nav_desktop_rail_enabled :: (app: const InnerBreeze*) -> int {
|
||||
}
|
||||
return app->breathing.screen == ScreenStart ||
|
||||
app->breathing.screen == ScreenHabits ||
|
||||
app->breathing.screen == ScreenHabitEdit ||
|
||||
app->breathing.screen == ScreenEList ||
|
||||
app->breathing.screen == ScreenProfile ||
|
||||
app->breathing.screen == ScreenSettings
|
||||
@@ -301,8 +311,8 @@ app_reset_bottom_nav_routes :: (app: InnerBreeze*) {
|
||||
if app == NULL {
|
||||
return
|
||||
}
|
||||
app->bottom_nav_routes[0] = APP_NAV_ROUTE_HABITS
|
||||
app->bottom_nav_routes[1] = APP_NAV_ROUTE_ELIST
|
||||
app->bottom_nav_routes[0] = APP_NAV_ROUTE_ELIST
|
||||
app->bottom_nav_routes[1] = APP_NAV_ROUTE_HABITS
|
||||
app->bottom_nav_routes[2] = APP_NAV_ROUTE_PRACTICE
|
||||
app->bottom_nav_routes[3] = APP_NAV_ROUTE_SETTINGS
|
||||
app->bottom_nav_route_count = 4
|
||||
@@ -319,8 +329,16 @@ app_sanitize_bottom_nav_routes :: (app: InnerBreeze*) {
|
||||
app->bottom_nav_routes[0] == APP_NAV_ROUTE_HABITS &&
|
||||
app->bottom_nav_routes[1] == APP_NAV_ROUTE_PRACTICE &&
|
||||
app->bottom_nav_routes[2] == APP_NAV_ROUTE_SETTINGS {
|
||||
app->bottom_nav_routes[3] = APP_NAV_ROUTE_ELIST
|
||||
app->bottom_nav_route_count = 4
|
||||
app_reset_bottom_nav_routes(app)
|
||||
} else if app->bottom_nav_route_count == 4 &&
|
||||
app->bottom_nav_routes[0] == APP_NAV_ROUTE_HABITS &&
|
||||
((app->bottom_nav_routes[1] == APP_NAV_ROUTE_PRACTICE &&
|
||||
app->bottom_nav_routes[2] == APP_NAV_ROUTE_SETTINGS &&
|
||||
app->bottom_nav_routes[3] == APP_NAV_ROUTE_ELIST) ||
|
||||
(app->bottom_nav_routes[1] == APP_NAV_ROUTE_ELIST &&
|
||||
app->bottom_nav_routes[2] == APP_NAV_ROUTE_PRACTICE &&
|
||||
app->bottom_nav_routes[3] == APP_NAV_ROUTE_SETTINGS)) {
|
||||
app_reset_bottom_nav_routes(app)
|
||||
}
|
||||
allowed[allowed_count] = APP_NAV_ROUTE_HABITS
|
||||
allowed_count += 1
|
||||
@@ -627,33 +645,12 @@ app_open_settings_tab :: (app: InnerBreeze*, tab: int) #private {
|
||||
|
||||
app_sidebar_clean_button :: (x: int, y: int, w: int, h: int,
|
||||
label: const char*, id: int, disabled: int) -> int #private {
|
||||
mouse := GetMousePosition()
|
||||
bounds := (Rectangle){(float)x, (float)y, (float)w, (float)h}
|
||||
hover := !disabled && CheckCollisionPointRec(mouse, bounds) &&
|
||||
!UIInputCapturesClick(mouse)
|
||||
fill := hover ? Fade(GetThemeSurface(), 0.48f) :
|
||||
Fade(GetThemeSurface(), 0.16f)
|
||||
border := Fade(GetThemeText(), hover ? 0.14f : 0.07f)
|
||||
label_w := TextWidth(label, Text16)
|
||||
|
||||
DrawRectangleRounded(bounds, 0.08f, 10, fill)
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.08f, 10, 1.0f, border)
|
||||
Text((TextProps){
|
||||
.bounds = {
|
||||
(float)(x + (w - label_w) / 2),
|
||||
(float)GetUIControlTextY(label, y, h, Text16),
|
||||
0.0f,
|
||||
0.0f
|
||||
},
|
||||
.text = label,
|
||||
.font = Text16,
|
||||
.color = disabled ? Fade(GetThemeText(), 0.42f) : GetThemeText(),
|
||||
.wrap = TextWrapNone
|
||||
return Button((ButtonProps){
|
||||
.bounds = {(float)x, (float)y, (float)w, (float)h},
|
||||
.id = id, .label = label, .font = Text16,
|
||||
.disabled = disabled,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
})
|
||||
if disabled {
|
||||
return 0
|
||||
}
|
||||
return InvisibleButton((InvisibleButtonProps){.bounds = bounds, .id = id})
|
||||
}
|
||||
|
||||
app_sidebar_settings_button :: (app: InnerBreeze*, x: int, y: int*, w: int,
|
||||
@@ -1171,7 +1168,6 @@ app_draw_customize_nav_page :: (app: InnerBreeze*) -> int {
|
||||
}
|
||||
|
||||
for int i = 0; i < draw_count; i++ {
|
||||
trash_hover := 0
|
||||
icon_w := Scale(36)
|
||||
icon_gap := Scale(8)
|
||||
dropdown_x := scaffold.page.content_x + handle_w
|
||||
@@ -1197,10 +1193,18 @@ app_draw_customize_nav_page :: (app: InnerBreeze*) -> int {
|
||||
action_index = i
|
||||
action_route = app_nav_route_for_option(selected[i])
|
||||
}
|
||||
if PaddedIconBtn(0, trash_x, dropdown_y - Scale(2),
|
||||
Scale(20), Scale(8),
|
||||
app->icons[UI_ICON_TYPE_TRASH],
|
||||
&trash_hover) &&
|
||||
if Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(trash_x), (float)(dropdown_y - Scale(2)),
|
||||
(float)((Scale(20)) + (Scale(8)) * 2),
|
||||
(float)((Scale(20)) + (Scale(8)) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_TRASH], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(Scale(20)) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) &&
|
||||
action == APP_NAV_CONFIG_ACTION_NONE {
|
||||
action = APP_NAV_CONFIG_ACTION_REMOVE
|
||||
action_index = i
|
||||
@@ -1213,7 +1217,6 @@ app_draw_customize_nav_page :: (app: InnerBreeze*) -> int {
|
||||
if reorder.dragging && reorder.active_index >= 0 &&
|
||||
reorder.active_index < draw_count {
|
||||
i := reorder.active_index
|
||||
trash_hover := 0
|
||||
icon_w := Scale(36)
|
||||
icon_gap := Scale(8)
|
||||
dropdown_x := scaffold.page.content_x + handle_w
|
||||
@@ -1231,7 +1234,6 @@ app_draw_customize_nav_page :: (app: InnerBreeze*) -> int {
|
||||
Dropdown(740 + i, dropdown_x, dropdown_y,
|
||||
dropdown_w, button_h, options,
|
||||
option_count, &selected[i])
|
||||
app_nav_mark_int_used(trash_hover)
|
||||
Icon(0, trash_x + Scale(8), dropdown_y + Scale(6),
|
||||
Scale(20), UI_ICON_TYPE_TRASH, GetThemeIcon())
|
||||
}
|
||||
@@ -1239,10 +1241,15 @@ app_draw_customize_nav_page :: (app: InnerBreeze*) -> int {
|
||||
y += row_h * draw_count
|
||||
|
||||
if draw_count < option_count {
|
||||
add_hover := 0
|
||||
if StyledButton(scaffold.page.content_x, y, scaffold.page.content_w, button_h,
|
||||
GetLocaleText("customize_nav_add"),
|
||||
ButtonStyleSecondary, 0, &add_hover) &&
|
||||
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(scaffold.page.content_x), (float)(y), (float)(scaffold.page.content_w), (float)(button_h)},
|
||||
.label = GetLocaleText("customize_nav_add"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) &&
|
||||
action == APP_NAV_CONFIG_ACTION_NONE {
|
||||
action = APP_NAV_CONFIG_ACTION_ADD
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
#include "styled_button.h"
|
||||
|
||||
#include "kryon.h"
|
||||
|
||||
int
|
||||
StyledButton(int x, int y, int w, int h, const char *label,
|
||||
ButtonStyle style, int disabled, int *hover)
|
||||
{
|
||||
ButtonProps button = {0};
|
||||
|
||||
button.bounds = (Rectangle){(float)x, (float)y, (float)w, (float)h};
|
||||
button.label = label;
|
||||
button.font = GetFontSize();
|
||||
button.disabled = disabled;
|
||||
switch(style) {
|
||||
case ButtonStyleDanger:
|
||||
button.tone = ButtonToneDanger;
|
||||
button.emphasis = ButtonEmphasisFilled;
|
||||
break;
|
||||
case ButtonStyleOutline:
|
||||
button.tone = ButtonToneNeutral;
|
||||
button.emphasis = ButtonEmphasisOutline;
|
||||
break;
|
||||
case ButtonStyleTab:
|
||||
button.tone = ButtonToneNeutral;
|
||||
button.emphasis = ButtonEmphasisGhost;
|
||||
break;
|
||||
case ButtonStyleTabSelected:
|
||||
button.tone = ButtonToneAccent;
|
||||
button.emphasis = ButtonEmphasisSoft;
|
||||
button.selected = 1;
|
||||
break;
|
||||
case ButtonStyleSecondary:
|
||||
button.tone = ButtonToneNeutral;
|
||||
button.emphasis = ButtonEmphasisSoft;
|
||||
break;
|
||||
case ButtonStylePrimary:
|
||||
default:
|
||||
button.tone = ButtonToneAccent;
|
||||
button.emphasis = ButtonEmphasisFilled;
|
||||
break;
|
||||
}
|
||||
if(hover != NULL)
|
||||
*hover = 0;
|
||||
return Button(button);
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
#ifndef APP_STYLED_BUTTON_H
|
||||
#define APP_STYLED_BUTTON_H
|
||||
|
||||
/* Inbe-side stand-in for kryon's removed StyledButton/ButtonStyle API,
|
||||
* lowered onto the tone/emphasis control styling that replaced it. */
|
||||
|
||||
typedef enum ButtonStyle {
|
||||
ButtonStylePrimary,
|
||||
ButtonStyleSecondary,
|
||||
ButtonStyleOutline,
|
||||
ButtonStyleDanger,
|
||||
ButtonStyleTab,
|
||||
ButtonStyleTabSelected
|
||||
} ButtonStyle;
|
||||
|
||||
int StyledButton(int x, int y, int w, int h, const char *label,
|
||||
ButtonStyle style, int disabled, int *hover);
|
||||
|
||||
#endif
|
||||
@@ -247,7 +247,7 @@ app_breaks_window_update :: (app: InnerBreeze*) {
|
||||
}
|
||||
|
||||
# Manual hit-test of the break overlay's button row (layout mirrored from
|
||||
# break_overlay_draw; TextButton centers each button on its x).
|
||||
# break_overlay_draw; the action buttons are centered on their x).
|
||||
app_breaks_window_click :: (app: InnerBreeze*, t: int, x: int, y: int,
|
||||
view_w: int, view_h: int) {
|
||||
timer: BreakTimer* = &app->breaks.timers[t]
|
||||
|
||||
@@ -683,7 +683,16 @@ setup_screenshot_scene(InnerBreeze*app, const ScreenshotRequest *request)
|
||||
app->theme_style = request->theme_style;
|
||||
screenshot_apply_theme(app, request->theme_id, request->dark_mode);
|
||||
|
||||
if(strcmp(request->scene, "statistics") == 0) {
|
||||
if(strcmp(request->scene, "lists") == 0) {
|
||||
char list_id[37];
|
||||
app->main_tab = APP_MAIN_TAB_ELIST;
|
||||
app->breathing.screen = ScreenEList;
|
||||
if(storage_elist_create_list("Shopping", list_id))
|
||||
storage_elist_create_item(list_id, "Fresh fruit", "", NULL);
|
||||
storage_elist_create_list("Home", NULL);
|
||||
storage_elist_create_list("Weekend", NULL);
|
||||
app->elist.loaded = 0;
|
||||
} else if(strcmp(request->scene, "statistics") == 0) {
|
||||
app->main_tab = APP_MAIN_TAB_HABITS;
|
||||
app->habits.tab = HABIT_TAB_STATISTICS;
|
||||
app->breathing.screen = ScreenHabits;
|
||||
|
||||
@@ -61,7 +61,7 @@ meditation_config_draw_duration :: (app: InnerBreeze*, x: int, w: int, y: int*)
|
||||
row_y := 0
|
||||
custom_row_y := 0
|
||||
toggle_value := 0
|
||||
hover := 0
|
||||
|
||||
custom_text: [64] char = {0}
|
||||
|
||||
if app == NULL || y == NULL {
|
||||
@@ -88,10 +88,16 @@ meditation_config_draw_duration :: (app: InnerBreeze*, x: int, w: int, y: int*)
|
||||
row := i / columns
|
||||
bx := x + col * (btn_w + gap)
|
||||
by := *y + row * (btn_h + gap)
|
||||
style := i == mode ? ButtonStylePrimary : ButtonStyleSecondary
|
||||
style := i == mode ? ButtonToneAccent : ButtonToneNeutral
|
||||
|
||||
if StyledButton(bx, by, btn_w, btn_h, labels[i],
|
||||
style, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(bx), (float)(by), (float)(btn_w), (float)(btn_h)},
|
||||
.label = labels[i],
|
||||
.font = GetFontSize(),
|
||||
.tone = style,
|
||||
.emphasis = (style) == ButtonToneAccent ? ButtonEmphasisFilled : ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->meditation.duration_mode = i
|
||||
meditation_config_save(app)
|
||||
}
|
||||
@@ -119,9 +125,14 @@ meditation_config_draw_duration :: (app: InnerBreeze*, x: int, w: int, y: int*)
|
||||
adjust_y := custom_row_y + Scale(34)
|
||||
|
||||
for int i = 0; i < 4; i++ {
|
||||
if StyledButton(adjust_x + i * (adjust_w + gap), adjust_y,
|
||||
adjust_w, btn_h, adjust_labels[i],
|
||||
ButtonStyleSecondary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(adjust_x + i * (adjust_w + gap)), (float)(adjust_y), (float)(adjust_w), (float)(btn_h)},
|
||||
.label = adjust_labels[i],
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->meditation.custom_minutes =
|
||||
clampi(app->meditation.custom_minutes + adjust_values[i], 1, 240)
|
||||
app->meditation.duration_mode = meditation_config_preset_count()
|
||||
@@ -173,9 +184,15 @@ meditation_config_draw_duration :: (app: InnerBreeze*, x: int, w: int, y: int*)
|
||||
for int i = 0; i < 7; i++ {
|
||||
bx := x + (i % bell_columns) * (bell_w + gap)
|
||||
by := *y + Scale(26) + (i / bell_columns) * (btn_h + gap)
|
||||
style := i == bell_selected ? ButtonStylePrimary : ButtonStyleSecondary
|
||||
if StyledButton(bx, by, bell_w, btn_h,
|
||||
bell_labels[i], style, 0, &hover) {
|
||||
style := i == bell_selected ? ButtonToneAccent : ButtonToneNeutral
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(bx), (float)(by), (float)(bell_w), (float)(btn_h)},
|
||||
.label = bell_labels[i],
|
||||
.font = GetFontSize(),
|
||||
.tone = style,
|
||||
.emphasis = (style) == ButtonToneAccent ? ButtonEmphasisFilled : ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->meditation.interval_bell_minutes = bell_values[i]
|
||||
meditation_config_save(app)
|
||||
}
|
||||
|
||||
@@ -664,7 +664,7 @@ meditation_music_draw_practice_settings :: (app: InnerBreeze*,
|
||||
show_status: int) {
|
||||
button_h := Scale(48)
|
||||
button_w: int
|
||||
hover := 0
|
||||
|
||||
installed: int
|
||||
selected_track: int
|
||||
selection: int
|
||||
@@ -748,14 +748,14 @@ meditation_music_draw_practice_settings :: (app: InnerBreeze*,
|
||||
if button_w > content_w {
|
||||
button_w = content_w
|
||||
}
|
||||
if StyledButton(content_x,
|
||||
*y,
|
||||
button_w,
|
||||
button_h,
|
||||
test_label,
|
||||
ButtonStyleSecondary,
|
||||
0,
|
||||
&hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(content_x), (float)(*y), (float)(button_w), (float)(button_h)},
|
||||
.label = test_label,
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->meditation.music_track =
|
||||
app->meditation.music_practice_tracks[practice]
|
||||
test_track(app)
|
||||
@@ -775,14 +775,14 @@ meditation_music_draw_practice_settings :: (app: InnerBreeze*,
|
||||
if button_w > content_w {
|
||||
button_w = content_w
|
||||
}
|
||||
if StyledButton(content_x,
|
||||
*y,
|
||||
button_w,
|
||||
button_h,
|
||||
download_label,
|
||||
ButtonStylePrimary,
|
||||
0,
|
||||
&hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(content_x), (float)(*y), (float)(button_w), (float)(button_h)},
|
||||
.label = download_label,
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
meditation_music_start_download(app)
|
||||
}
|
||||
*y += button_h + Scale(12)
|
||||
|
||||
@@ -290,9 +290,15 @@ format_time :: (dst: char*, dst_size: size_t, seconds: int) #private {
|
||||
|
||||
draw_duration_button :: (x: int, y: int, w: int, h: int,
|
||||
label: const char*) -> int #private {
|
||||
hover := 0
|
||||
return StyledButton(x, y, w, h, label,
|
||||
ButtonStylePrimary, 0, &hover)
|
||||
|
||||
return Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(y), (float)(w), (float)(h)},
|
||||
.label = label,
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
})
|
||||
}
|
||||
|
||||
extend_session :: (app: InnerBreeze*, seconds: int) #private {
|
||||
@@ -334,7 +340,7 @@ meditation_draw_setup_modal :: (app: InnerBreeze*) {
|
||||
cancel_w := Scale(120)
|
||||
cancel_x: int
|
||||
cancel_y: int
|
||||
cancel_hover := 0
|
||||
|
||||
|
||||
if modal_w > view_width - Scale(24) {
|
||||
modal_w = view_width - Scale(24)
|
||||
@@ -397,14 +403,14 @@ meditation_draw_setup_modal :: (app: InnerBreeze*) {
|
||||
|
||||
cancel_y = modal_y + modal_h - btn_h - Scale(16)
|
||||
cancel_x = modal_x + (modal_w - cancel_w) / 2
|
||||
if StyledButton(cancel_x,
|
||||
cancel_y,
|
||||
cancel_w,
|
||||
btn_h,
|
||||
GetLocaleText("cancel_button"),
|
||||
ButtonStyleSecondary,
|
||||
0,
|
||||
&cancel_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(cancel_x), (float)(cancel_y), (float)(cancel_w), (float)(btn_h)},
|
||||
.label = GetLocaleText("cancel_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app_close_modal(app)
|
||||
}
|
||||
}
|
||||
@@ -418,7 +424,7 @@ draw_extend_controls :: (app: InnerBreeze*, center_x: int, y: int) #private {
|
||||
finish_w := Scale(96)
|
||||
total_w := btn_w * 3 + gap * 2
|
||||
x := center_x - total_w / 2
|
||||
hover := 0
|
||||
|
||||
|
||||
if app == nil || !app->meditation.show_extend_controls {
|
||||
return
|
||||
@@ -432,14 +438,14 @@ draw_extend_controls :: (app: InnerBreeze*, center_x: int, y: int) #private {
|
||||
}
|
||||
|
||||
for int i = 0; i < 3; i++ {
|
||||
if StyledButton(x + i * (btn_w + gap),
|
||||
y,
|
||||
btn_w,
|
||||
btn_h,
|
||||
labels[i],
|
||||
ButtonStyleSecondary,
|
||||
0,
|
||||
&hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x + i * (btn_w + gap)), (float)(y), (float)(btn_w), (float)(btn_h)},
|
||||
.label = labels[i],
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
extend_session(app, add_seconds[i])
|
||||
}
|
||||
}
|
||||
@@ -455,14 +461,14 @@ draw_extend_controls :: (app: InnerBreeze*, center_x: int, y: int) #private {
|
||||
finish_x = view_width - Scale(12) - finish_w
|
||||
}
|
||||
|
||||
if StyledButton(finish_x,
|
||||
finish_y,
|
||||
finish_w,
|
||||
btn_h,
|
||||
GetLocaleText("finish_button"),
|
||||
ButtonStylePrimary,
|
||||
0,
|
||||
&hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(finish_x), (float)(finish_y), (float)(finish_w), (float)(btn_h)},
|
||||
.label = GetLocaleText("finish_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
finish(app)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ patterns_advance_elapsed :: (app: InnerBreeze*, elapsed_ms: int) {
|
||||
|
||||
draw_config :: (app: InnerBreeze*) #private {
|
||||
layout := (PracticeSubscreenLayout){0}
|
||||
hover := 0
|
||||
|
||||
|
||||
practice_screen_config_layout(app, UIModalPracticeConfig, Scale(18), &layout)
|
||||
practice_screen_handle_config_title(app, GetLocaleText("practice_configure_button"),
|
||||
@@ -342,11 +342,16 @@ draw_config :: (app: InnerBreeze*) #private {
|
||||
GetLocaleText(patterns_preset_label_key(i)),
|
||||
ratio[0], ratio[1], ratio[2], ratio[3])
|
||||
style := app->patterns.preset == i
|
||||
? ButtonStylePrimary
|
||||
: ButtonStyleSecondary
|
||||
if StyledButton(x,
|
||||
y + row * (btn_h + gap), preset_w, btn_h,
|
||||
label, style, 0, &hover) {
|
||||
? ButtonToneAccent
|
||||
: ButtonToneNeutral
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(y + row * (btn_h + gap)), (float)(preset_w), (float)(btn_h)},
|
||||
.label = label,
|
||||
.font = GetFontSize(),
|
||||
.tone = style,
|
||||
.emphasis = (style) == ButtonToneAccent ? ButtonEmphasisFilled : ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->patterns.preset = i
|
||||
app->settings_dirty = 1
|
||||
save_settings(app)
|
||||
@@ -378,9 +383,14 @@ draw_config :: (app: InnerBreeze*) #private {
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
minus_w := Scale(46)
|
||||
if StyledButton(x + w - minus_w * 2 - gap, y,
|
||||
minus_w, btn_h, "-5",
|
||||
ButtonStyleSecondary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x + w - minus_w * 2 - gap), (float)(y), (float)(minus_w), (float)(btn_h)},
|
||||
.label = "-5",
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->patterns.custom[i] -= 5
|
||||
if app->patterns.custom[i] < 0 {
|
||||
app->patterns.custom[i] = 0
|
||||
@@ -388,9 +398,14 @@ draw_config :: (app: InnerBreeze*) #private {
|
||||
app->settings_dirty = 1
|
||||
save_settings(app)
|
||||
}
|
||||
if StyledButton(x + w - minus_w, y, minus_w, btn_h,
|
||||
"+5", ButtonStyleSecondary, 0,
|
||||
&hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x + w - minus_w), (float)(y), (float)(minus_w), (float)(btn_h)},
|
||||
.label = "+5",
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->patterns.custom[i] += 5
|
||||
if app->patterns.custom[i] > PATTERNS_MAX_SECONDS {
|
||||
app->patterns.custom[i] = PATTERNS_MAX_SECONDS
|
||||
@@ -433,10 +448,16 @@ draw_config :: (app: InnerBreeze*) #private {
|
||||
}
|
||||
dur_w := (w - gap * 4) / 5
|
||||
style := app->patterns.duration_minutes == duration_values[i]
|
||||
? ButtonStylePrimary
|
||||
: ButtonStyleSecondary
|
||||
if StyledButton(x + i * (dur_w + gap), y, dur_w, btn_h,
|
||||
label, style, 0, &hover) {
|
||||
? ButtonToneAccent
|
||||
: ButtonToneNeutral
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x + i * (dur_w + gap)), (float)(y), (float)(dur_w), (float)(btn_h)},
|
||||
.label = label,
|
||||
.font = GetFontSize(),
|
||||
.tone = style,
|
||||
.emphasis = (style) == ButtonToneAccent ? ButtonEmphasisFilled : ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->patterns.duration_minutes = duration_values[i]
|
||||
app->settings_dirty = 1
|
||||
save_settings(app)
|
||||
@@ -484,7 +505,7 @@ patterns_draw_session_title_bar :: (app: InnerBreeze*, title: const char*, heigh
|
||||
patterns_draw_screen :: (app: InnerBreeze*, center_x: int, center_y: int) {
|
||||
ratio: [4] int
|
||||
time_text: [32] char
|
||||
hover := 0
|
||||
|
||||
title_h := app_active_practice_title_height()
|
||||
button_w := view_width - Scale(112)
|
||||
button_h := Scale(56)
|
||||
@@ -586,18 +607,26 @@ patterns_draw_screen :: (app: InnerBreeze*, center_x: int, center_y: int) {
|
||||
|
||||
button_y = center_y + pattern_circle_max_radius() + Scale(42)
|
||||
if app->patterns.paused {
|
||||
if StyledButton(center_x - button_w / 2, button_y,
|
||||
button_w, button_h,
|
||||
GetLocaleText("patterns_resume_button"),
|
||||
ButtonStylePrimary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(center_x - button_w / 2), (float)(button_y), (float)(button_w), (float)(button_h)},
|
||||
.label = GetLocaleText("patterns_resume_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->patterns.paused = 0
|
||||
}
|
||||
return
|
||||
}
|
||||
if IsKeyPressed(KEY_SPACE) || StyledButton(center_x - button_w / 2,
|
||||
button_y, button_w,
|
||||
button_h, GetLocaleText("patterns_pause_button"),
|
||||
ButtonStyleSecondary, 0, &hover) {
|
||||
if IsKeyPressed(KEY_SPACE) || Button((ButtonProps){
|
||||
.bounds = {(float)(center_x - button_w / 2), (float)(button_y), (float)(button_w), (float)(button_h)},
|
||||
.label = GetLocaleText("patterns_pause_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->patterns.paused = 1
|
||||
}
|
||||
|
||||
|
||||
@@ -277,7 +277,6 @@ draw_figure_selector :: (app: InnerBreeze*, x: int, y: int, w: int) -> int #priv
|
||||
option_h := Scale(118)
|
||||
image_h := Scale(72)
|
||||
changed := 0
|
||||
mouse := GetMousePosition()
|
||||
|
||||
if app == nil || SUN_SALUTATION_ACTIVE_FIGURE_COUNT <= 1 {
|
||||
return 0
|
||||
@@ -308,17 +307,10 @@ draw_figure_selector :: (app: InnerBreeze*, x: int, y: int, w: int) -> int #priv
|
||||
(float)image_h
|
||||
}
|
||||
selected := app->sun_salutation.figure == i
|
||||
hover := CheckCollisionPointRec(mouse, bounds)
|
||||
bg := DarkenUIColor(GetThemeBackground(), hover ? 10 : 6)
|
||||
border := DarkenUIColor(GetThemeText(), 45)
|
||||
label: const char*
|
||||
text_w: int
|
||||
pose_index := sun_salutation_step_pose_index(1)
|
||||
|
||||
if selected {
|
||||
bg = Fade(GetThemeButtonHover(), 0.18f)
|
||||
border = GetThemeButtonHover()
|
||||
}
|
||||
|
||||
if i == SUN_SALUTATION_FIGURE_MAN {
|
||||
label = GetLocaleText("sun_salutation_figure_man")
|
||||
@@ -327,8 +319,12 @@ draw_figure_selector :: (app: InnerBreeze*, x: int, y: int, w: int) -> int #priv
|
||||
}
|
||||
text_w = TextWidth(label, small_font)
|
||||
|
||||
DrawRectangleRec(bounds, bg)
|
||||
DrawRectangleLinesEx(bounds, selected ? 2.0f : 1.0f, border)
|
||||
clicked := Button((ButtonProps){
|
||||
.bounds = bounds, .id = 24900 + i,
|
||||
.tone = selected ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft, .selected = selected,
|
||||
.disabled = app->modal.active
|
||||
})
|
||||
draw_preview_pose(app->sun_salutation.pose_sheets[i],
|
||||
pose_index,
|
||||
(int)image_bounds.x,
|
||||
@@ -344,8 +340,7 @@ draw_figure_selector :: (app: InnerBreeze*, x: int, y: int, w: int) -> int #priv
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
|
||||
if hover && IsMouseButtonReleased(MOUSE_BUTTON_LEFT) &&
|
||||
!UIInputCapturesClick(mouse) && !selected {
|
||||
if clicked && !selected {
|
||||
app->sun_salutation.figure = i
|
||||
changed = 1
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ whm_draw_progressive_start_speed_editor :: (app: InnerBreeze*) #private {
|
||||
close_size := Scale(22)
|
||||
close_padding := Scale(8)
|
||||
close_w := close_size + close_padding * 2
|
||||
close_hover := 0
|
||||
|
||||
max_speed := app->breathing.speed_level
|
||||
start_speed := clampi(app->breathing.progressive_start_speed,
|
||||
SETTINGS_SPEED_MIN, max_speed)
|
||||
@@ -87,9 +87,18 @@ whm_draw_progressive_start_speed_editor :: (app: InnerBreeze*) #private {
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
|
||||
if PaddedIconBtn(0, modal_x + modal_w - close_w - Scale(6),
|
||||
modal_y + Scale(6), close_size, close_padding,
|
||||
app->icons[UI_ICON_TYPE_X], &close_hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(modal_x + modal_w - close_w - Scale(6)), (float)(modal_y + Scale(6)),
|
||||
(float)((close_size) + (close_padding) * 2),
|
||||
(float)((close_size) + (close_padding) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_X], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(close_size) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
app_close_modal(app)
|
||||
return
|
||||
}
|
||||
@@ -254,7 +263,7 @@ whm_config_draw_breath_card :: (app: InnerBreeze*, content_x: int, content_w: in
|
||||
if app->breathing.progressive_speed {
|
||||
modify_w := TextWidth(GetLocaleText("modify_start_speed_button"),
|
||||
GetFontSize()) + Scale(24)
|
||||
modify_hover := 0
|
||||
|
||||
|
||||
if modify_w > inner_w {
|
||||
modify_w = inner_w
|
||||
@@ -267,9 +276,14 @@ whm_config_draw_breath_card :: (app: InnerBreeze*, content_x: int, content_w: in
|
||||
app->breathing.progressive_start_speed
|
||||
app->settings_dirty = 1
|
||||
}
|
||||
if StyledButton(inner_x, inner_y, modify_w, Scale(48),
|
||||
GetLocaleText("modify_start_speed_button"),
|
||||
ButtonStyleSecondary, 0, &modify_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(inner_x), (float)(inner_y), (float)(modify_w), (float)(Scale(48))},
|
||||
.label = GetLocaleText("modify_start_speed_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app_open_modal(app, UIModalEditProgressiveStartSpeed)
|
||||
}
|
||||
}
|
||||
@@ -401,14 +415,19 @@ whm_config_draw_reset_button :: (app: InnerBreeze*, content_x: int, content_w: i
|
||||
reset_w := TextWidth(GetLocaleText("reset_to_defaults_label"),
|
||||
GetFontSize()) + Scale(24)
|
||||
reset_h := Scale(48)
|
||||
reset_hover := 0
|
||||
|
||||
|
||||
if reset_w > content_w {
|
||||
reset_w = content_w
|
||||
}
|
||||
if StyledButton(content_x + content_w - reset_w, y, reset_w, reset_h,
|
||||
GetLocaleText("reset_to_defaults_label"),
|
||||
ButtonStyleSecondary, 0, &reset_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(content_x + content_w - reset_w), (float)(y), (float)(reset_w), (float)(reset_h)},
|
||||
.label = GetLocaleText("reset_to_defaults_label"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
speed = DefaultSpeedLevel
|
||||
max_rounds = DefaultMaxRounds
|
||||
max_breaths = DefaultMaxBreaths
|
||||
|
||||
@@ -1122,9 +1122,14 @@ session_update_screen :: (app: InnerBreeze*, center_x: int, center_y: int, hover
|
||||
breath_y = breath_max_y
|
||||
}
|
||||
breath_x = center_x - breath_w / 2
|
||||
if StyledButton(breath_x, breath_y, breath_w, breath_h,
|
||||
breath_label, ButtonStylePrimary, 0,
|
||||
&breath_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(breath_x), (float)(breath_y), (float)(breath_w), (float)(breath_h)},
|
||||
.label = breath_label,
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
finish_hold(app)
|
||||
}
|
||||
if hover != nil {
|
||||
@@ -1236,11 +1241,21 @@ session_draw_results_screen :: (app: InnerBreeze*, center_x: int, center_y: int,
|
||||
row_y += row_h
|
||||
}
|
||||
|
||||
if TextButton(0, center_x - box_w / 4, action_y, GetLocaleText("discard_button"), &discard_hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 0, .label = GetLocaleText("discard_button"), .font = GetFontSize(),
|
||||
.bounds = {(center_x - box_w / 4) - fmaxf(TextWidth(GetLocaleText("discard_button"), GetFontSize()) + Scale(16), Scale(34)) / 2.0f,
|
||||
(float)(action_y), fmaxf(TextWidth(GetLocaleText("discard_button"), GetFontSize()) + Scale(16), Scale(34)), fmaxf(TextLineHeight(GetFontSize()) + Scale(8), Scale(34))},
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
session_discard_saved_results(app)
|
||||
app_init(app)
|
||||
}
|
||||
if TextButton(0, center_x + box_w / 4, action_y, GetLocaleText("save_results_button"), &save_hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 0, .label = GetLocaleText("save_results_button"), .font = GetFontSize(),
|
||||
.bounds = {(center_x + box_w / 4) - fmaxf(TextWidth(GetLocaleText("save_results_button"), GetFontSize()) + Scale(16), Scale(34)) / 2.0f,
|
||||
(float)(action_y), fmaxf(TextWidth(GetLocaleText("save_results_button"), GetFontSize()) + Scale(16), Scale(34)), fmaxf(TextLineHeight(GetFontSize()) + Scale(8), Scale(34))},
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
if session_ensure_results_saved(app) {
|
||||
app_init(app)
|
||||
}
|
||||
|
||||
@@ -276,7 +276,7 @@ break_overlay_draw_sized :: (app: InnerBreeze*, w: int, h: int) {
|
||||
row_w := count * button_w + (count - 1) * gap
|
||||
button_x := w / 2 - row_w / 2
|
||||
locked := timer->lock_buttons_s > 0
|
||||
hover := 0
|
||||
|
||||
|
||||
if timer->show_postpone != 0 {
|
||||
if locked {
|
||||
@@ -293,7 +293,12 @@ break_overlay_draw_sized :: (app: InnerBreeze*, w: int, h: int) {
|
||||
.vertical_align = TextAlignCenter
|
||||
})
|
||||
} else {
|
||||
if TextButton(4101, button_x, button_y, GetLocaleText("break_postpone_button"), &hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 4101, .label = GetLocaleText("break_postpone_button"), .font = GetFontSize(),
|
||||
.bounds = {(button_x) - fmaxf(TextWidth(GetLocaleText("break_postpone_button"), GetFontSize()) + Scale(16), Scale(34)) / 2.0f,
|
||||
(float)(button_y), fmaxf(TextWidth(GetLocaleText("break_postpone_button"), GetFontSize()) + Scale(16), Scale(34)), fmaxf(TextLineHeight(GetFontSize()) + Scale(8), Scale(34))},
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
break_engine_postpone(&app->breaks, t)
|
||||
return
|
||||
}
|
||||
@@ -303,7 +308,12 @@ break_overlay_draw_sized :: (app: InnerBreeze*, w: int, h: int) {
|
||||
|
||||
if timer->show_skip != 0 {
|
||||
if !locked {
|
||||
if TextButton(4102, button_x, button_y, GetLocaleText("break_skip_button"), &hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 4102, .label = GetLocaleText("break_skip_button"), .font = GetFontSize(),
|
||||
.bounds = {(button_x) - fmaxf(TextWidth(GetLocaleText("break_skip_button"), GetFontSize()) + Scale(16), Scale(34)) / 2.0f,
|
||||
(float)(button_y), fmaxf(TextWidth(GetLocaleText("break_skip_button"), GetFontSize()) + Scale(16), Scale(34)), fmaxf(TextLineHeight(GetFontSize()) + Scale(8), Scale(34))},
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
break_engine_skip(&app->breaks, t)
|
||||
return
|
||||
}
|
||||
@@ -312,7 +322,12 @@ break_overlay_draw_sized :: (app: InnerBreeze*, w: int, h: int) {
|
||||
}
|
||||
|
||||
if t == BREAK_MICRO {
|
||||
if TextButton(4103, button_x, button_y, GetLocaleText("break_rest_now_button"), &hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 4103, .label = GetLocaleText("break_rest_now_button"), .font = GetFontSize(),
|
||||
.bounds = {(button_x) - fmaxf(TextWidth(GetLocaleText("break_rest_now_button"), GetFontSize()) + Scale(16), Scale(34)) / 2.0f,
|
||||
(float)(button_y), fmaxf(TextWidth(GetLocaleText("break_rest_now_button"), GetFontSize()) + Scale(16), Scale(34)), fmaxf(TextLineHeight(GetFontSize()) + Scale(8), Scale(34))},
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
break_engine_force_break(&app->breaks, BREAK_REST)
|
||||
return
|
||||
}
|
||||
|
||||
+156
-56
@@ -12,6 +12,8 @@ elist_field :: (app: InnerBreeze*, bounds: Rectangle) -> TextFieldProps #private
|
||||
.text_size = sizeof(app->elist.input),
|
||||
.cursor_position = &app->elist.input_cursor,
|
||||
.focused = &app->elist.input_focused,
|
||||
.focus_id = 6501,
|
||||
.commit_pressed = &app->elist.input_committed,
|
||||
.max_codepoints = elist_types.ELIST_TITLE_SIZE - 1,
|
||||
.font = GetFontSize(),
|
||||
.style = (TextInputStyle){
|
||||
@@ -33,6 +35,7 @@ elist_comment_field :: (app: InnerBreeze*, bounds: Rectangle) -> TextFieldProps
|
||||
field.text_size = sizeof(app->elist.comment_input)
|
||||
field.cursor_position = &app->elist.comment_cursor
|
||||
field.focused = &app->elist.comment_focused
|
||||
field.focus_id = 6502
|
||||
field.max_codepoints = elist_types.ELIST_COMMENT_SIZE - 1
|
||||
return field
|
||||
}
|
||||
@@ -53,31 +56,40 @@ elist_begin_input :: (app: InnerBreeze*, editing_item: int,
|
||||
app->elist.comment_input[0] = '\0'
|
||||
app->elist.comment_cursor = 0
|
||||
app->elist.input_focused = 1
|
||||
app->elist.input_error = 0
|
||||
SetUIFocus(6501)
|
||||
app->elist.editing_item = editing_item
|
||||
}
|
||||
|
||||
elist_commit_input :: (app: InnerBreeze*) #private {
|
||||
state := &app->elist
|
||||
saved: int = 0
|
||||
created_id: [37]char = {0}
|
||||
|
||||
if state->input[0] == '\0' {
|
||||
return
|
||||
}
|
||||
if state->editing_item == -2 {
|
||||
storage_elist_create_list(state->input, nil)
|
||||
saved = storage_elist_create_list(state->input, created_id)
|
||||
} else if state->editing_item == -3 && state->selected_list >= 0 &&
|
||||
state->selected_list < state->list_count {
|
||||
list := &state->lists[state->selected_list]
|
||||
storage_elist_update_list(list->id, state->input, list->sort_order)
|
||||
saved = storage_elist_update_list(list->id, state->input, list->sort_order)
|
||||
} else if state->editing_item >= 0 &&
|
||||
state->editing_item < state->item_count {
|
||||
item := &state->items[state->editing_item]
|
||||
storage_elist_update_item(item->id, state->input, state->comment_input,
|
||||
saved = storage_elist_update_item(item->id, state->input, state->comment_input,
|
||||
item->done, item->sort_order)
|
||||
} else if state->selected_list >= 0 &&
|
||||
state->selected_list < state->list_count {
|
||||
storage_elist_create_item(state->lists[state->selected_list].id,
|
||||
saved = storage_elist_create_item(state->lists[state->selected_list].id,
|
||||
state->input, state->comment_input, nil)
|
||||
}
|
||||
if !saved {
|
||||
state->input_error = 1
|
||||
return
|
||||
}
|
||||
state->input_error = 0
|
||||
state->input[0] = '\0'
|
||||
state->input_cursor = 0
|
||||
state->comment_input[0] = '\0'
|
||||
@@ -85,9 +97,40 @@ elist_commit_input :: (app: InnerBreeze*) #private {
|
||||
state->input_focused = 0
|
||||
state->editing_item = -1
|
||||
elist_reload(app)
|
||||
if created_id[0] != '\0' {
|
||||
for int i = 0; i < state->list_count; i++ {
|
||||
if strcmp(state->lists[i].id, created_id) == 0 {
|
||||
state->selected_list = i
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
app_auto_sync(app)
|
||||
}
|
||||
|
||||
elist_content_bounds :: () -> Rectangle #private {
|
||||
pad := Scale(16)
|
||||
return (Rectangle){(float)pad, 0, (float)(view_width - pad * 2), (float)view_height}
|
||||
}
|
||||
|
||||
elist_select_list :: (app: InnerBreeze*, index: int) #private {
|
||||
state := &app->elist
|
||||
if index < 0 || index >= state->list_count || index == state->selected_list {
|
||||
return
|
||||
}
|
||||
state->selected_list = index
|
||||
state->editing_item = -1
|
||||
state->input[0] = '\0'
|
||||
state->comment_input[0] = '\0'
|
||||
state->input_cursor = 0
|
||||
state->comment_cursor = 0
|
||||
state->input_focused = 0
|
||||
state->comment_focused = 0
|
||||
state->input_error = 0
|
||||
state->input_committed = 0
|
||||
SetUIFocus(0)
|
||||
}
|
||||
|
||||
elist_draw_empty :: (x: int, y: int, w: int) #private {
|
||||
title := GetLocaleText("elist_empty_title")
|
||||
detail := GetLocaleText("elist_empty_detail")
|
||||
@@ -112,16 +155,13 @@ elist_draw_empty :: (x: int, y: int, w: int) #private {
|
||||
|
||||
draw_elist_screen :: (app: InnerBreeze*) {
|
||||
state: elist_types.EListState*
|
||||
left := app_nav_desktop_rail_enabled(app) ? app_nav_desktop_content_offset() : 0
|
||||
width := view_width - left
|
||||
pad := Scale(16)
|
||||
x := left + pad
|
||||
content_w := width - pad * 2
|
||||
title_h := Scale(58)
|
||||
y := title_h + Scale(12)
|
||||
hover := 0
|
||||
tab_h := Scale(36)
|
||||
list_options: [elist_types.ELIST_LIST_MAX] const char* = {0}
|
||||
content := elist_content_bounds()
|
||||
x := (int)content.x
|
||||
content_w := (int)content.width
|
||||
y := Scale(12)
|
||||
|
||||
tab_h := Scale(44)
|
||||
list_tabs: [elist_types.ELIST_LIST_MAX] Tab = {0}
|
||||
|
||||
if app == nil {
|
||||
return
|
||||
@@ -131,15 +171,34 @@ draw_elist_screen :: (app: InnerBreeze*) {
|
||||
elist_reload(app)
|
||||
}
|
||||
|
||||
TitleBar(GetLocaleText("elist_title"), title_h)
|
||||
if state->list_count > 0 && state->selected_list >= 0 &&
|
||||
PaddedIconBtn(0, left + width - Scale(88), Scale(9), Scale(22), Scale(8),
|
||||
app->icons[UI_ICON_TYPE_EDIT], &hover) {
|
||||
Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(view_width - Scale(88)), (float)(Scale(15)),
|
||||
(float)((Scale(22)) + (Scale(8)) * 2),
|
||||
(float)((Scale(22)) + (Scale(8)) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_EDIT], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(Scale(22)) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
elist_begin_input(app, -3, state->lists[state->selected_list].title)
|
||||
}
|
||||
if state->list_count > 0 && state->selected_list >= 0 &&
|
||||
PaddedIconBtn(0, left + width - Scale(48), Scale(9), Scale(22), Scale(8),
|
||||
app->icons[UI_ICON_TYPE_TRASH], &hover) {
|
||||
Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(view_width - Scale(48)), (float)(Scale(15)),
|
||||
(float)((Scale(22)) + (Scale(8)) * 2),
|
||||
(float)((Scale(22)) + (Scale(8)) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_TRASH], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(Scale(22)) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
storage_elist_delete_list(state->lists[state->selected_list].id)
|
||||
state->selected_list = 0
|
||||
elist_reload(app)
|
||||
@@ -147,28 +206,60 @@ draw_elist_screen :: (app: InnerBreeze*) {
|
||||
return
|
||||
}
|
||||
for int i = 0; i < state->list_count; i++ {
|
||||
list_options[i] = state->lists[i].title
|
||||
list_tabs[i] = (Tab){.label = state->lists[i].title}
|
||||
}
|
||||
selector_w := content_w - Scale(112)
|
||||
selector_w := content_w - Scale(200)
|
||||
if state->list_count > 0 {
|
||||
Dropdown(6500, x, y, selector_w, tab_h, list_options,
|
||||
state->list_count, &state->selected_list)
|
||||
selected := TabBar((TabBarProps){
|
||||
.id = 6500,
|
||||
.bounds = {(float)x, (float)y, (float)selector_w, (float)tab_h},
|
||||
.tabs = list_tabs,
|
||||
.count = state->list_count,
|
||||
.selected_index = state->selected_list,
|
||||
.font = GetFontSize(),
|
||||
.min_tab_width = Scale(88),
|
||||
.max_tab_width = Scale(180)
|
||||
})
|
||||
elist_select_list(app, selected)
|
||||
}
|
||||
if StyledButton(x + selector_w + Scale(8), y, Scale(104), tab_h,
|
||||
GetLocaleText("elist_new_list"),
|
||||
ButtonStyleSecondary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x + selector_w + Scale(8)), (float)(y), (float)(Scale(104)), (float)(tab_h)},
|
||||
.label = GetLocaleText("elist_new_list"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
elist_begin_input(app, -2, "")
|
||||
return
|
||||
}
|
||||
y += tab_h + Scale(16)
|
||||
|
||||
if state->input_error {
|
||||
Text((TextProps){
|
||||
.bounds = {(float)x, (float)y, (float)content_w, (float)Scale(40)},
|
||||
.text = GetLocaleText("results_write_failed"),
|
||||
.font = GetSmallFontSize(),
|
||||
.color = GetThemeText(),
|
||||
.wrap = TextWrapAuto
|
||||
})
|
||||
y += Scale(48)
|
||||
}
|
||||
|
||||
if state->editing_item == -2 || state->editing_item == -3 {
|
||||
TextField(elist_field(app, (Rectangle){(float)x, (float)y,
|
||||
(float)content_w, (float)Scale(44)}))
|
||||
y += Scale(52)
|
||||
if StyledButton(x, y, content_w, Scale(40),
|
||||
state->editing_item == -3 ? GetLocaleText("done_button") :
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(y), (float)(content_w), (float)(Scale(40))},
|
||||
.label = state->editing_item == -3 ? GetLocaleText("done_button") :
|
||||
GetLocaleText("elist_create_list"),
|
||||
ButtonStylePrimary, state->input[0] == '\0', &hover) {
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = state->input[0] == '\0'
|
||||
}) ||
|
||||
state->input_committed {
|
||||
elist_commit_input(app)
|
||||
}
|
||||
return
|
||||
@@ -182,10 +273,16 @@ draw_elist_screen :: (app: InnerBreeze*) {
|
||||
field_w := content_w - Scale(92)
|
||||
TextField(elist_field(app, (Rectangle){(float)x, (float)y,
|
||||
(float)field_w, (float)Scale(44)}))
|
||||
if StyledButton(x + field_w + Scale(8), y, Scale(84), Scale(44),
|
||||
state->editing_item >= 0 ? GetLocaleText("done_button") :
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x + field_w + Scale(8)), (float)(y), (float)(Scale(84)), (float)(Scale(44))},
|
||||
.label = state->editing_item >= 0 ? GetLocaleText("done_button") :
|
||||
GetLocaleText("elist_add_item"),
|
||||
ButtonStylePrimary, state->input[0] == '\0', &hover) {
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = state->input[0] == '\0'
|
||||
}) ||
|
||||
state->input_committed {
|
||||
elist_commit_input(app)
|
||||
}
|
||||
y += Scale(52)
|
||||
@@ -206,27 +303,10 @@ draw_elist_screen :: (app: InnerBreeze*) {
|
||||
bounds := (Rectangle){(float)x, (float)y, (float)content_w, (float)row_h}
|
||||
DrawRectangleRounded(bounds, 0.08f, 8,
|
||||
DarkenUIColor(GetThemeBackground(), 5))
|
||||
check_bounds := (Rectangle){(float)(x + Scale(10)),
|
||||
(float)(y + Scale(17)),
|
||||
(float)Scale(24), (float)Scale(24)}
|
||||
DrawRectangleRoundedLines(check_bounds, 0.24f, 6,
|
||||
item->done ? GetThemeButton() : GetThemeMutedText())
|
||||
if item->done {
|
||||
DrawLineEx((Vector2){check_bounds.x + Scale(5),
|
||||
check_bounds.y + Scale(12)},
|
||||
(Vector2){check_bounds.x + Scale(10),
|
||||
check_bounds.y + Scale(17)},
|
||||
Scale(2), GetThemeButton())
|
||||
DrawLineEx((Vector2){check_bounds.x + Scale(10),
|
||||
check_bounds.y + Scale(17)},
|
||||
(Vector2){check_bounds.x + Scale(20),
|
||||
check_bounds.y + Scale(7)},
|
||||
Scale(2), GetThemeButton())
|
||||
}
|
||||
if InvisibleButton((InvisibleButtonProps){.bounds = check_bounds,
|
||||
.id = 6400 + i}) {
|
||||
done := item->done
|
||||
if Checkbox(6400 + i, x + Scale(10), y + Scale(17), "", &done) {
|
||||
storage_elist_update_item(item->id, item->title, item->comment,
|
||||
!item->done, item->sort_order)
|
||||
done, item->sort_order)
|
||||
elist_reload(app)
|
||||
app_auto_sync(app)
|
||||
return
|
||||
@@ -250,15 +330,35 @@ draw_elist_screen :: (app: InnerBreeze*) {
|
||||
.wrap = TextWrapNone
|
||||
})
|
||||
}
|
||||
if PaddedIconBtn(0, x + content_w - Scale(78), y + Scale(12),
|
||||
Scale(20), Scale(7), app->icons[UI_ICON_TYPE_EDIT], &hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(x + content_w - Scale(78)), (float)(y + Scale(12)),
|
||||
(float)((Scale(20)) + (Scale(7)) * 2),
|
||||
(float)((Scale(20)) + (Scale(7)) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_EDIT], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(Scale(20)) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
elist_begin_input(app, i, item->title)
|
||||
snprintf(state->comment_input, sizeof(state->comment_input), "%s",
|
||||
item->comment)
|
||||
state->comment_cursor = (int)strlen(state->comment_input)
|
||||
}
|
||||
if PaddedIconBtn(0, x + content_w - Scale(40), y + Scale(12),
|
||||
Scale(20), Scale(7), app->icons[UI_ICON_TYPE_TRASH], &hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(x + content_w - Scale(40)), (float)(y + Scale(12)),
|
||||
(float)((Scale(20)) + (Scale(7)) * 2),
|
||||
(float)((Scale(20)) + (Scale(7)) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_TRASH], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(Scale(20)) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
storage_elist_delete_item(item->id)
|
||||
elist_reload(app)
|
||||
app_auto_sync(app)
|
||||
|
||||
@@ -37,6 +37,8 @@ EListState :: struct {
|
||||
comment_cursor: int
|
||||
comment_focused: int
|
||||
editing_item: int
|
||||
input_committed: int
|
||||
input_error: int
|
||||
input: [ELIST_TITLE_SIZE]char
|
||||
comment_input: [ELIST_COMMENT_SIZE]char
|
||||
}
|
||||
+86
-57
@@ -111,7 +111,7 @@ trimmed_text :: (app: InnerBreeze*) -> const char* #private {
|
||||
practice_picker :: (app: InnerBreeze*) -> int #private {
|
||||
modal_w := view_width - Scale(32)
|
||||
modal_h := Scale(344)
|
||||
hover := 0
|
||||
|
||||
result := 0
|
||||
if modal_w > Scale(400) { modal_w = Scale(400) }
|
||||
frame := ModalFrame(modal_w, modal_h, GetLocaleText("habit_link_practices"),
|
||||
@@ -137,9 +137,14 @@ practice_picker :: (app: InnerBreeze*) -> int #private {
|
||||
}
|
||||
y += GetNodeHeight(NodeCheckboxRow((CheckboxRowProps){0}, 0, 0))
|
||||
}
|
||||
if StyledButton(frame.content_x, frame.y + frame.h - Scale(56),
|
||||
frame.content_w, Scale(40), GetLocaleText("done_button"),
|
||||
ButtonStylePrimary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(frame.content_x), (float)(frame.y + frame.h - Scale(56)), (float)(frame.content_w), (float)(Scale(40))},
|
||||
.label = GetLocaleText("done_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
result = 1
|
||||
}
|
||||
if frame.right_clicked { result = 1 }
|
||||
@@ -344,7 +349,7 @@ draw_form :: (app: InnerBreeze*) #private {
|
||||
}
|
||||
top := Scale(56)
|
||||
footer := Scale(app->habit_edit.name_error ? 92 : 64)
|
||||
hover := 0
|
||||
|
||||
font := GetFontSize()
|
||||
small := GetSmallFontSize()
|
||||
if IsKeyPressed(KEY_ESCAPE) {
|
||||
@@ -380,8 +385,9 @@ draw_form :: (app: InnerBreeze*) #private {
|
||||
open := app->habit_edit.sections[section]
|
||||
DrawRectangleRounded((Rectangle){(float)x, (float)y, (float)w, (float)height},
|
||||
0.08f, 10, GetThemeSurface())
|
||||
if InvisibleButton((InvisibleButtonProps){
|
||||
.bounds = {(float)x, (float)y, (float)w, (float)header}, .id = 7510 + section
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)x, (float)y, (float)w, (float)header}, .id = 7510 + section,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
app->habit_edit.sections[section] = !app->habit_edit.sections[section]
|
||||
SetUIFocusTextInputActive(0)
|
||||
@@ -493,37 +499,29 @@ draw_form :: (app: InnerBreeze*) #private {
|
||||
cell: Rectangle = {(float)(px + (c % columns) * Scale(48)),
|
||||
(float)(row + (c / columns) * Scale(44)), (float)Scale(48), (float)Scale(44)}
|
||||
more := c == 6 && !app->habit_edit.more_colors
|
||||
if InvisibleButton((InvisibleButtonProps){.bounds = cell, .id = 7530 + c}) {
|
||||
chosen := !more && app->habit_edit.color.r == colors[c].r &&
|
||||
app->habit_edit.color.g == colors[c].g &&
|
||||
app->habit_edit.color.b == colors[c].b
|
||||
color := more ? GetThemeButton() : colors[c]
|
||||
if Button((ButtonProps){
|
||||
.bounds = {cell.x + Scale(4), cell.y + Scale(2),
|
||||
(float)Scale(40), (float)Scale(40)},
|
||||
.id = 7530 + c, .label = more ? "..." : "",
|
||||
.circle = 1, .selected = chosen,
|
||||
.icon_type = chosen ? UI_ICON_TYPE_CHECK : UI_ICON_TYPE_NONE,
|
||||
.font = small,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisFilled,
|
||||
.style.normal = {
|
||||
.fields = StyleBackground | StyleForeground,
|
||||
.background = color, .foreground = GetThemeReadableText(color)
|
||||
}
|
||||
}) {
|
||||
if more {
|
||||
app->habit_edit.more_colors = 1
|
||||
} else {
|
||||
app->habit_edit.color = colors[c]
|
||||
}
|
||||
}
|
||||
center_x := (int)cell.x + Scale(24)
|
||||
center_y := (int)cell.y + Scale(22)
|
||||
if more {
|
||||
more_color := GetThemeButtonHover()
|
||||
DrawCircle(center_x, center_y, Scale(14), more_color)
|
||||
Text((TextProps){
|
||||
.bounds={(center_x - TextWidth("...", small) / 2), (GetUIControlTextY("...", (int)cell.y, (int)cell.height, small)), 0, 0},
|
||||
.text=("..."),
|
||||
.font=(small),
|
||||
.color=(GetThemeReadableText(more_color)),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
} else {
|
||||
DrawCircle(center_x, center_y, Scale(14), colors[c])
|
||||
if app->habit_edit.color.r == colors[c].r && app->habit_edit.color.g == colors[c].g && app->habit_edit.color.b == colors[c].b {
|
||||
check := GetThemeReadableText(colors[c])
|
||||
DrawLineEx((Vector2){(float)(center_x - Scale(6)), (float)center_y},
|
||||
(Vector2){(float)(center_x - Scale(1)), (float)(center_y + Scale(5))},
|
||||
Scale(2), check)
|
||||
DrawLineEx((Vector2){(float)(center_x - Scale(1)), (float)(center_y + Scale(5))},
|
||||
(Vector2){(float)(center_x + Scale(7)), (float)(center_y - Scale(6))},
|
||||
Scale(2), check)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if open && section == 1 {
|
||||
@@ -541,8 +539,14 @@ draw_form :: (app: InnerBreeze*) #private {
|
||||
}
|
||||
row += Scale(52)
|
||||
if schedule_enabled {
|
||||
if StyledButton(px, row, inner, Scale(40), GetLocaleText("habit_every_day"),
|
||||
app->habit_edit.weekdays == 0 ? ButtonStylePrimary : ButtonStyleSecondary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(px), (float)(row), (float)(inner), (float)(Scale(40))},
|
||||
.label = GetLocaleText("habit_every_day"),
|
||||
.font = GetFontSize(),
|
||||
.tone = app->habit_edit.weekdays == 0 ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = (app->habit_edit.weekdays == 0 ? ButtonToneAccent : ButtonToneNeutral) == ButtonToneAccent ? ButtonEmphasisFilled : ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->habit_edit.weekdays = 0
|
||||
}
|
||||
row += Scale(44)
|
||||
@@ -554,17 +558,14 @@ draw_form :: (app: InnerBreeze*) #private {
|
||||
dx := px + (d % columns) * Scale(48)
|
||||
dy := row + (d / columns) * Scale(44)
|
||||
selected := (mask & (1 << d)) != 0
|
||||
fill := selected ? app->habit_edit.color : GetThemeBackground()
|
||||
DrawCircle(dx + Scale(24), dy + Scale(24), Scale(17), fill)
|
||||
Text((TextProps){
|
||||
.bounds={(dx + (Scale(48) - TextWidth(days[d], small)) / 2), (GetUIControlTextY(days[d], dy, Scale(48), small)), 0, 0},
|
||||
.text=(days[d]),
|
||||
.font=(small),
|
||||
.color=(GetThemeReadableText(fill)),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if InvisibleButton((InvisibleButtonProps){.bounds = {(float)dx, (float)dy,
|
||||
(float)Scale(48), (float)Scale(48)}, .id = 7560 + d}) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(dx + Scale(4)), (float)(dy + Scale(4)),
|
||||
(float)Scale(40), (float)Scale(40)},
|
||||
.id = 7560 + d, .label = days[d], .font = small,
|
||||
.circle = 1, .selected = selected,
|
||||
.tone = selected ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
mask = mask ^ (1 << d)
|
||||
if mask != 0 {
|
||||
app->habit_edit.weekdays = mask == 127 ? 0 : mask
|
||||
@@ -618,9 +619,14 @@ draw_form :: (app: InnerBreeze*) #private {
|
||||
.color=(GetThemeText()),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if StyledButton(control_x, row, button_w, Scale(44), "-",
|
||||
ButtonStyleSecondary,
|
||||
app->habit_edit.counter_target <= 1, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(control_x), (float)(row), (float)(button_w), (float)(Scale(44))},
|
||||
.label = "-",
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = app->habit_edit.counter_target <= 1
|
||||
}) {
|
||||
app->habit_edit.counter_target--
|
||||
}
|
||||
snprintf(target_text, sizeof(target_text), "%d",
|
||||
@@ -632,10 +638,14 @@ draw_form :: (app: InnerBreeze*) #private {
|
||||
.color=(GetThemeText()),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if StyledButton(control_x + control_w - button_w, row,
|
||||
button_w, Scale(44), "+",
|
||||
ButtonStyleSecondary,
|
||||
app->habit_edit.counter_target >= 99, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(control_x + control_w - button_w), (float)(row), (float)(button_w), (float)(Scale(44))},
|
||||
.label = "+",
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = app->habit_edit.counter_target >= 99
|
||||
}) {
|
||||
app->habit_edit.counter_target++
|
||||
}
|
||||
row += Scale(52)
|
||||
@@ -647,7 +657,14 @@ draw_form :: (app: InnerBreeze*) #private {
|
||||
linked_summary: [32] char = {0}
|
||||
snprintf(linked_summary, sizeof(linked_summary), "%s · %d",
|
||||
GetLocaleText("habit_link_practices"), linked_count)
|
||||
if StyledButton(px, row, inner, Scale(44), linked_summary, ButtonStyleSecondary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(px), (float)(row), (float)(inner), (float)(Scale(44))},
|
||||
.label = linked_summary,
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app_open_modal(app, UIModalHabitPracticePicker)
|
||||
}
|
||||
}
|
||||
@@ -669,15 +686,27 @@ draw_form :: (app: InnerBreeze*) #private {
|
||||
action_w := w
|
||||
if !app->habit_edit.is_new {
|
||||
delete_w := Scale(104)
|
||||
if StyledButton(x, view_height - Scale(54), delete_w, Scale(44),
|
||||
GetLocaleText("habit_delete_button"), ButtonStyleDanger, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(view_height - Scale(54)), (float)(delete_w), (float)(Scale(44))},
|
||||
.label = GetLocaleText("habit_delete_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneDanger,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app_open_modal(app, UIModalConfirmDeleteHabit)
|
||||
}
|
||||
action_x += delete_w + Scale(8)
|
||||
action_w -= delete_w + Scale(8)
|
||||
}
|
||||
if StyledButton(action_x, view_height - Scale(54), action_w, Scale(44),
|
||||
GetLocaleText(app->habit_edit.is_new ? "habit_create_button" : "save_button"), ButtonStylePrimary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(action_x), (float)(view_height - Scale(54)), (float)(action_w), (float)(Scale(44))},
|
||||
.label = GetLocaleText(app->habit_edit.is_new ? "habit_create_button" : "save_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
commit(app)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ draw_edit_content :: (app: InnerBreeze*, ctx: HabitLinkedContext*,
|
||||
trash_x := content_x + content_w - icon_w
|
||||
row_font := GetSmallFontSize()
|
||||
summary_x := 0
|
||||
hover_trash := 0
|
||||
|
||||
|
||||
if ctx->entries[i].activity != activity {
|
||||
continue
|
||||
@@ -358,10 +358,18 @@ draw_edit_content :: (app: InnerBreeze*, ctx: HabitLinkedContext*,
|
||||
.color=(DarkenUIColor(GetThemeText(), 12)),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if PaddedIconBtn(0, trash_x, y - Scale(4),
|
||||
icon_size, icon_padding,
|
||||
app->icons[UI_ICON_TYPE_TRASH],
|
||||
&hover_trash) {
|
||||
if Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(trash_x), (float)(y - Scale(4)),
|
||||
(float)((icon_size) + (icon_padding) * 2),
|
||||
(float)((icon_size) + (icon_padding) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_TRASH], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(icon_size) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
if data_delete_session(ctx->entries[i].path) {
|
||||
habit_session_changed(app, ctx->count)
|
||||
}
|
||||
@@ -389,8 +397,8 @@ draw_edit_content :: (app: InnerBreeze*, ctx: HabitLinkedContext*,
|
||||
app->habit_session_edit.round == r &&
|
||||
strcmp(app->habit_session_edit.path,
|
||||
ctx->entries[i].path) == 0
|
||||
hover_round_edit := 0
|
||||
hover_round_trash := 0
|
||||
|
||||
|
||||
|
||||
FormatLocaleText(round_line, sizeof(round_line),
|
||||
"round_result_label", r + 1,
|
||||
@@ -411,12 +419,20 @@ draw_edit_content :: (app: InnerBreeze*, ctx: HabitLinkedContext*,
|
||||
draw_round_line(round_line, round_seconds, round_text_x,
|
||||
y, round_text_w, Scale(24),
|
||||
row_font, editing_round)
|
||||
if PaddedIconBtn(0, round_edit_x, y - Scale(6),
|
||||
icon_size, icon_padding,
|
||||
app->icons[editing_round
|
||||
if Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(round_edit_x), (float)(y - Scale(6)),
|
||||
(float)((icon_size) + (icon_padding) * 2),
|
||||
(float)((icon_size) + (icon_padding) * 2)},
|
||||
.icon = app->icons[editing_round
|
||||
? UI_ICON_TYPE_SAVE
|
||||
: UI_ICON_TYPE_EDIT],
|
||||
&hover_round_edit) {
|
||||
: UI_ICON_TYPE_EDIT], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(icon_size) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
if editing_round {
|
||||
if habit_session_commit_edit(app, &ctx->entries[i]) {
|
||||
return y
|
||||
@@ -426,10 +442,18 @@ draw_edit_content :: (app: InnerBreeze*, ctx: HabitLinkedContext*,
|
||||
}
|
||||
return y
|
||||
}
|
||||
if PaddedIconBtn(0, round_trash_x, y - Scale(6),
|
||||
icon_size, icon_padding,
|
||||
app->icons[UI_ICON_TYPE_TRASH],
|
||||
&hover_round_trash) {
|
||||
if Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(round_trash_x), (float)(y - Scale(6)),
|
||||
(float)((icon_size) + (icon_padding) * 2),
|
||||
(float)((icon_size) + (icon_padding) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_TRASH], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(icon_size) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
if delete_round(&ctx->entries[i], r) {
|
||||
habit_session_changed(app, ctx->count)
|
||||
}
|
||||
@@ -459,16 +483,21 @@ draw_edit_content :: (app: InnerBreeze*, ctx: HabitLinkedContext*,
|
||||
plus_x := content_x + content_w - step_w
|
||||
label_x := minus_x + step_w + gap
|
||||
label_w := plus_x - label_x - gap
|
||||
hover := 0
|
||||
|
||||
total_text: [64] char = {0}
|
||||
|
||||
y += Scale(6)
|
||||
if draw {
|
||||
FormatLocaleText(total_text, sizeof(total_text),
|
||||
"habit_session_total_count", total_count)
|
||||
if StyledButton(minus_x, y, step_w, button_h, "-",
|
||||
ButtonStyleSecondary,
|
||||
total_count <= minimum_count, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(minus_x), (float)(y), (float)(step_w), (float)(button_h)},
|
||||
.label = "-",
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = total_count <= minimum_count
|
||||
}) {
|
||||
habit_apply_count_action(app, app->habit_detail_index,
|
||||
ctx->day_filter, -1,
|
||||
minimum_count)
|
||||
@@ -484,8 +513,14 @@ draw_edit_content :: (app: InnerBreeze*, ctx: HabitLinkedContext*,
|
||||
.color=(GetThemeText()),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if StyledButton(plus_x, y, step_w, button_h, "+",
|
||||
ButtonStyleSecondary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(plus_x), (float)(y), (float)(step_w), (float)(button_h)},
|
||||
.label = "+",
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
habit_apply_count_action(app, app->habit_detail_index,
|
||||
ctx->day_filter, 1,
|
||||
minimum_count)
|
||||
@@ -569,10 +604,16 @@ draw_keyboard :: (app: InnerBreeze*, entry: const HabitLinkedEntry*) -> int {
|
||||
|
||||
keyboard_key :: (x: int, y: int, w: int, h: int,
|
||||
label: const char*) -> int {
|
||||
hover := 0
|
||||
|
||||
return StyledButton(x, y, w, h, label,
|
||||
ButtonStyleSecondary, 0, &hover)
|
||||
|
||||
return Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(y), (float)(w), (float)(h)},
|
||||
.label = label,
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
})
|
||||
}
|
||||
|
||||
clamp_cursor :: (app: InnerBreeze*) {
|
||||
|
||||
+103
-200
@@ -717,14 +717,7 @@ habit_calendar_day_cell :: (app: InnerBreeze*, x: int, y: int, w: int, h: int,
|
||||
label: const char*, progress: float,
|
||||
disabled: int, current_day: int,
|
||||
accent: Color) -> int {
|
||||
mouse_world: Vector2
|
||||
bounds: Rectangle = {(float)x, (float)y, (float)w, (float)h}
|
||||
default_style: int = GetEffectiveThemeStyle() == THEME_STYLE_DEFAULT
|
||||
inside: int
|
||||
hovered: int
|
||||
fill: Color = default_style
|
||||
? GetThemeSurface()
|
||||
: DarkenUIColor(GetThemeBackground(), 10)
|
||||
ring: Color = Fade(GetThemeText(), disabled ? 0.16f : 0.28f)
|
||||
progress_ring: Color = accent
|
||||
today_ring: Color = GetThemeButtonHover()
|
||||
@@ -752,41 +745,10 @@ habit_calendar_day_cell :: (app: InnerBreeze*, x: int, y: int, w: int, h: int,
|
||||
radius = Scale(10)
|
||||
}
|
||||
|
||||
if app != nil {
|
||||
mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera)
|
||||
} else {
|
||||
mouse_world = GetMousePosition()
|
||||
}
|
||||
|
||||
inside = !disabled &&
|
||||
CheckCollisionPointRec(mouse_world, bounds) &&
|
||||
!UIInputCapturesClick(mouse_world)
|
||||
hovered = inside && UIHoverEffectsEnabled()
|
||||
|
||||
if default_style {
|
||||
if hovered {
|
||||
fill = LightenUIColor(fill, 8)
|
||||
progress_ring = LightenUIColor(progress_ring, 18)
|
||||
}
|
||||
} else {
|
||||
if hovered {
|
||||
fill = GetThemeButtonHover()
|
||||
}
|
||||
}
|
||||
|
||||
if default_style {
|
||||
DrawRectangleRounded(bounds, 0.24f, 10, fill)
|
||||
if hovered {
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.32f, 10,
|
||||
1.0f,
|
||||
Fade(GetThemeText(), 0.20f))
|
||||
}
|
||||
} else {
|
||||
DrawRectangle(x, y, w, h, fill)
|
||||
Bevel(x, y, w, h,
|
||||
LightenUIColor(fill, hovered ? 36 : 28),
|
||||
DarkenUIColor(fill, hovered ? 42 : 34))
|
||||
}
|
||||
clicked := Button((ButtonProps){
|
||||
.bounds = bounds, .disabled = disabled,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
})
|
||||
|
||||
DrawCircleLinesEx((Vector2){center_x, center_y}, radius,
|
||||
ring_width, ring)
|
||||
@@ -812,11 +774,7 @@ habit_calendar_day_cell :: (app: InnerBreeze*, x: int, y: int, w: int, h: int,
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
|
||||
if inside && app != nil {
|
||||
MarkUIClickable()
|
||||
}
|
||||
|
||||
return inside && IsMouseButtonReleased(MOUSE_BUTTON_LEFT)
|
||||
return clicked
|
||||
}
|
||||
|
||||
habit_calendar_day_metadata :: (app: InnerBreeze*, x: int, y: int,
|
||||
@@ -985,14 +943,7 @@ habit_weekly_summary_button :: (app: InnerBreeze*, x: int, y: int,
|
||||
w: int, h: int, completed: int,
|
||||
disabled: int, primary: const char*,
|
||||
secondary: const char*) -> int #private {
|
||||
mouse_world: Vector2
|
||||
bounds: Rectangle = {(float)x, (float)y, (float)w, (float)h}
|
||||
default_style: int = GetEffectiveThemeStyle() == THEME_STYLE_DEFAULT
|
||||
active: int
|
||||
hovered: int
|
||||
fill: Color = completed
|
||||
? GetThemeButton()
|
||||
: (default_style ? GetThemeSurface() : DarkenUIColor(GetThemeBackground(), 10))
|
||||
text_color: Color = disabled
|
||||
? DarkenUIColor(GetThemeText(), 35)
|
||||
: GetThemeText()
|
||||
@@ -1006,43 +957,11 @@ habit_weekly_summary_button :: (app: InnerBreeze*, x: int, y: int,
|
||||
return 0
|
||||
}
|
||||
|
||||
mouse_world = GetScreenToWorld2D(GetMousePosition(), app->camera)
|
||||
active = CheckCollisionPointRec(mouse_world, bounds) &&
|
||||
!UIInputCapturesClick(mouse_world)
|
||||
hovered = active && UIHoverEffectsEnabled()
|
||||
|
||||
if active {
|
||||
if disabled {
|
||||
MarkUIDisabled()
|
||||
} else {
|
||||
MarkUIClickable()
|
||||
}
|
||||
}
|
||||
|
||||
active = active && !disabled
|
||||
hovered = hovered && !disabled
|
||||
|
||||
if hovered {
|
||||
fill = default_style && !completed
|
||||
? Fade(GetThemeButtonHover(), 0.22f)
|
||||
: GetThemeButtonHover()
|
||||
}
|
||||
if !disabled && completed {
|
||||
text_color = habit_text_color_for_background(fill)
|
||||
}
|
||||
|
||||
if default_style {
|
||||
DrawRectangleRounded(bounds, 0.18f, 10, fill)
|
||||
if hovered {
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.18f, 10, 1.0f,
|
||||
Fade(GetThemeText(), 0.22f))
|
||||
}
|
||||
} else {
|
||||
DrawRectangle(x, y, w, h, fill)
|
||||
Bevel(x, y, w, h,
|
||||
LightenUIColor(fill, 36),
|
||||
DarkenUIColor(fill, 42))
|
||||
}
|
||||
clicked := Button((ButtonProps){
|
||||
.bounds = bounds, .disabled = disabled,
|
||||
.tone = completed ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft, .selected = completed
|
||||
})
|
||||
|
||||
text_x = x + pad
|
||||
text_w = w - pad * 2
|
||||
@@ -1072,10 +991,7 @@ habit_weekly_summary_button :: (app: InnerBreeze*, x: int, y: int,
|
||||
}
|
||||
}
|
||||
|
||||
if active {
|
||||
return IsMouseButtonReleased(MOUSE_BUTTON_LEFT)
|
||||
}
|
||||
return 0
|
||||
return clicked
|
||||
}
|
||||
|
||||
habit_weekly_content_height :: (visible_days: int) -> int #private {
|
||||
@@ -1112,7 +1028,7 @@ draw_habits_weekly_view :: (app: InnerBreeze*, active: Habit*,
|
||||
day_font: int = Text16
|
||||
date_font: int = Text12
|
||||
load_h: int = Scale(38)
|
||||
load_hover: int = 0
|
||||
|
||||
local: struct tm* = localtime(&now)
|
||||
|
||||
if local != nil {
|
||||
@@ -1243,30 +1159,15 @@ draw_habits_weekly_view :: (app: InnerBreeze*, active: Habit*,
|
||||
}
|
||||
|
||||
if counting_enabled {
|
||||
habit_weekly_summary_button(app, button_x, y,
|
||||
button_w, row_h,
|
||||
completed, future_day,
|
||||
primary, secondary)
|
||||
action = habit_counter_day_action(app, selected, day_index,
|
||||
button_x, y,
|
||||
button_w, row_h,
|
||||
future_day,
|
||||
!has_linked_day)
|
||||
if action == 0 && has_linked_day && !future_day {
|
||||
mouse_world: Vector2 =
|
||||
GetScreenToWorld2D(GetMousePosition(), app->camera)
|
||||
bounds: Rectangle = {
|
||||
(float)button_x,
|
||||
(float)y,
|
||||
(float)button_w,
|
||||
(float)row_h
|
||||
}
|
||||
|
||||
if CheckCollisionPointRec(mouse_world, bounds) &&
|
||||
!UIInputCapturesClick(mouse_world) &&
|
||||
IsMouseButtonReleased(MOUSE_BUTTON_LEFT) {
|
||||
habit_open_linked_edit_page(app, selected, day_index)
|
||||
}
|
||||
summary_clicked := habit_weekly_summary_button(app, button_x, y,
|
||||
button_w, row_h, completed, future_day, primary, secondary)
|
||||
if action == 0 && has_linked_day && !future_day && summary_clicked {
|
||||
habit_open_linked_edit_page(app, selected, day_index)
|
||||
}
|
||||
} else if habit_weekly_summary_button(app, button_x, y,
|
||||
button_w, row_h,
|
||||
@@ -1323,11 +1224,14 @@ draw_habits_weekly_view :: (app: InnerBreeze*, active: Habit*,
|
||||
}
|
||||
|
||||
y += Scale(8)
|
||||
if StyledButton(content_x, y, content_w, load_h,
|
||||
GetLocaleText("habit_load_more_button"),
|
||||
ButtonStyleSecondary,
|
||||
app->habits.weekly_days >= HABIT_WEEKLY_MAX_DAYS,
|
||||
&load_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(content_x), (float)(y), (float)(content_w), (float)(load_h)},
|
||||
.label = GetLocaleText("habit_load_more_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = app->habits.weekly_days >= HABIT_WEEKLY_MAX_DAYS
|
||||
}) {
|
||||
app->habits.weekly_days += HABIT_WEEKLY_LOAD_DAYS
|
||||
if app->habits.weekly_days > HABIT_WEEKLY_MAX_DAYS {
|
||||
app->habits.weekly_days = HABIT_WEEKLY_MAX_DAYS
|
||||
@@ -1534,6 +1438,16 @@ habits_focus_draw_week :: (app: InnerBreeze*, habit: Habit*, selected: int,
|
||||
radius := Scale(col == 0 ? 11 : 9)
|
||||
action := 0
|
||||
|
||||
if counting && !app->modal.active && (!off || complete) {
|
||||
action = habit_counter_day_action(app, selected, day,
|
||||
cell_x, row_y, cell_w, row_h, 0, linked == 0)
|
||||
}
|
||||
clicked := Button((ButtonProps){
|
||||
.bounds = cell, .id = 24300 + col,
|
||||
.disabled = app->modal.active || (off && !complete),
|
||||
.tone = complete ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisGhost, .selected = complete
|
||||
})
|
||||
Text((TextProps){
|
||||
.bounds={(cx - TextWidth(label, label_font) / 2), (row_y), 0, 0},
|
||||
.text=(label),
|
||||
@@ -1572,13 +1486,6 @@ habits_focus_draw_week :: (app: InnerBreeze*, habit: Habit*, selected: int,
|
||||
}
|
||||
}
|
||||
if !app->modal.active && (!off || complete) {
|
||||
if counting {
|
||||
action = habit_counter_day_action(app, selected, day,
|
||||
cell_x, row_y, cell_w, row_h, 0, linked == 0)
|
||||
}
|
||||
clicked := InvisibleButton((InvisibleButtonProps){
|
||||
.bounds = cell, .id = 24300 + col
|
||||
})
|
||||
if action == 1 || action == -1 {
|
||||
habit_apply_count_action(app, selected, day, action, linked)
|
||||
app_auto_sync(app)
|
||||
@@ -1622,6 +1529,11 @@ habits_focus_draw_card :: (app: InnerBreeze*, selected: int,
|
||||
|
||||
DrawRectangleRounded((Rectangle){(float)x, (float)y, (float)w, (float)card_h},
|
||||
0.08f, 10, surface)
|
||||
header_clicked := Button((ButtonProps){
|
||||
.bounds = {(float)x, (float)y, (float)w, (float)Scale(72)},
|
||||
.id = 24090, .tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.disabled = app->modal.active
|
||||
})
|
||||
DrawRectangle(x + Scale(16), y + Scale(20),
|
||||
Scale(10), Scale(10), habit->color)
|
||||
habits_draw_fitted_text(habit->name, x + Scale(38), y + Scale(12),
|
||||
@@ -1642,51 +1554,53 @@ habits_focus_draw_card :: (app: InnerBreeze*, selected: int,
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
}
|
||||
if IconButton((IconButtonProps){
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)action_x, (float)action_y,
|
||||
(float)action_w, (float)Scale(52)},
|
||||
.icon = app->icons[UI_ICON_TYPE_CALENDAR], .icon_size = Scale(28),
|
||||
.icon_padding = Scale(12),
|
||||
.background = DarkenUIColor(surface, 5),
|
||||
.hover_background = LightenUIColor(surface, 10),
|
||||
.icon_color = foreground, .radius = 0.18f
|
||||
.icon = app->icons[UI_ICON_TYPE_CALENDAR],
|
||||
.icon_only = 1, .circle = 0,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(Scale(28)) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
habits_open_history(app)
|
||||
return
|
||||
}
|
||||
if IconButton((IconButtonProps){
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(action_x + action_w + action_gap),
|
||||
(float)action_y,
|
||||
(float)action_w, (float)Scale(52)},
|
||||
.icon = app->icons[UI_ICON_TYPE_STAT], .icon_size = Scale(28),
|
||||
.icon_padding = Scale(12),
|
||||
.background = DarkenUIColor(surface, 5),
|
||||
.hover_background = LightenUIColor(surface, 10),
|
||||
.icon_color = foreground, .radius = 0.18f
|
||||
.icon = app->icons[UI_ICON_TYPE_STAT],
|
||||
.icon_only = 1, .circle = 0,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(Scale(28)) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
habits_open_statistics(app)
|
||||
return
|
||||
}
|
||||
if IconButton((IconButtonProps){
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(action_x + (action_w + action_gap) * 2),
|
||||
(float)action_y,
|
||||
(float)action_w, (float)Scale(52)},
|
||||
.icon = app->icons[UI_ICON_TYPE_EDIT], .icon_size = Scale(28),
|
||||
.icon_padding = Scale(12),
|
||||
.background = DarkenUIColor(surface, 5),
|
||||
.hover_background = LightenUIColor(surface, 10),
|
||||
.icon_color = foreground, .radius = 0.18f
|
||||
.icon = app->icons[UI_ICON_TYPE_EDIT],
|
||||
.icon_only = 1, .circle = 0,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(Scale(28)) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
habit_edit_begin(app, selected)
|
||||
return
|
||||
}
|
||||
# The selected card behaves like the collapsed cards: tapping its
|
||||
# non-interactive header collapses it. Header actions keep their own taps.
|
||||
if InvisibleButton((InvisibleButtonProps){
|
||||
.bounds = {(float)x, (float)y,
|
||||
(float)w, (float)Scale(72)},
|
||||
.id = 24090
|
||||
}) {
|
||||
if header_clicked {
|
||||
habits_return_to_overview(app)
|
||||
return
|
||||
}
|
||||
@@ -1709,10 +1623,7 @@ habits_focus_draw_collapsed :: (app: InnerBreeze*, index: int,
|
||||
surface := GetThemeSurface()
|
||||
foreground := GetThemeReadableText(surface)
|
||||
muted := Fade(foreground, 0.66f)
|
||||
mouse := GetScreenToWorld2D(GetMousePosition(), app->camera)
|
||||
bounds := (Rectangle){(float)x, (float)y, (float)w, (float)h}
|
||||
hover := CheckCollisionPointRec(mouse, bounds) &&
|
||||
!UIInputCapturesClick(mouse)
|
||||
description: [HABIT_DESCRIPTION_SIZE + 4] char = {0}
|
||||
weekdays: [7] const char* = {
|
||||
"habit_day_mon", "habit_day_tue", "habit_day_wed", "habit_day_thu",
|
||||
@@ -1724,15 +1635,13 @@ habits_focus_draw_collapsed :: (app: InnerBreeze*, index: int,
|
||||
chevron_cy := y + Scale(31)
|
||||
chevron_span := Scale(14)
|
||||
chevron_drop := Scale(6)
|
||||
chevron_color := Fade(foreground, hover ? 0.88f : 0.68f)
|
||||
chevron_color := Fade(foreground, 0.68f)
|
||||
|
||||
DrawRectangleRounded(bounds, 0.12f, 8, surface)
|
||||
if hover {
|
||||
DrawCircleGradient((Vector2){(float)chevron_cx, (float)chevron_cy},
|
||||
(float)Scale(25),
|
||||
Fade(foreground, 0.10f),
|
||||
Fade(foreground, 0.0f))
|
||||
}
|
||||
clicked := Button((ButtonProps){
|
||||
.bounds = bounds, .id = 24500 + index,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.disabled = app->modal.active
|
||||
})
|
||||
DrawRectangle(x + Scale(16), y + Scale(20),
|
||||
Scale(9), Scale(9), habit->color)
|
||||
habits_draw_fitted_text(habit->name, x + Scale(36), y + Scale(10),
|
||||
@@ -1794,8 +1703,7 @@ habits_focus_draw_collapsed :: (app: InnerBreeze*, index: int,
|
||||
}
|
||||
}
|
||||
}
|
||||
if InvisibleButton((InvisibleButtonProps){.bounds = bounds,
|
||||
.id = 24500 + index}) {
|
||||
if clicked {
|
||||
habits_select_habit(app, index)
|
||||
app->habits.tab = HABIT_TAB_WEEKLY
|
||||
app->habits.scroll = 0
|
||||
@@ -2005,7 +1913,7 @@ draw_habits_screen :: (app: InnerBreeze*) {
|
||||
content_w: int
|
||||
y: int
|
||||
viewport_h: int
|
||||
hover: int = 0
|
||||
|
||||
side_padding: int = GetUIPageSidePadding()
|
||||
max_w: int = Scale(CONTENT_MAX_W)
|
||||
month_h: int = Scale(42)
|
||||
@@ -2031,7 +1939,7 @@ draw_habits_screen :: (app: InnerBreeze*) {
|
||||
forward_disabled: int
|
||||
scroll_y: int
|
||||
scroll_h: int
|
||||
cell_bounds: Rectangle
|
||||
|
||||
cell_clicked: int
|
||||
page_ctx: HabitsScrollPageContext
|
||||
page: UIScrollPage
|
||||
@@ -2084,7 +1992,7 @@ draw_habits_screen :: (app: InnerBreeze*) {
|
||||
button_h: int = Scale(42)
|
||||
empty_y: int = content_top + viewport_h / 2 - Scale(46)
|
||||
empty_w: int = TextWidth(empty_text, empty_font)
|
||||
hover_empty_create: int = 0
|
||||
|
||||
|
||||
BeginUIClip((int)app->camera.offset.x,
|
||||
(int)(app->camera.offset.y +
|
||||
@@ -2098,11 +2006,14 @@ draw_habits_screen :: (app: InnerBreeze*) {
|
||||
.color=(GetThemeText()),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if StyledButton(content_x + (content_w - button_w) / 2,
|
||||
empty_y + Scale(38),
|
||||
button_w, button_h, create_text,
|
||||
ButtonStylePrimary, 0,
|
||||
&hover_empty_create) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(content_x + (content_w - button_w) / 2), (float)(empty_y + Scale(38)), (float)(button_w), (float)(button_h)},
|
||||
.label = create_text,
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
habits_begin_new_detail(app)
|
||||
}
|
||||
EndUIClip()
|
||||
@@ -2222,14 +2133,24 @@ draw_habits_screen :: (app: InnerBreeze*) {
|
||||
}
|
||||
|
||||
forward_disabled = app->habits.month_offset >= 0
|
||||
if StyledButton(content_x, y, Scale(44), month_h, "<",
|
||||
ButtonStyleSecondary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(content_x), (float)(y), (float)(Scale(44)), (float)(month_h)},
|
||||
.label = "<",
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app->habits.month_offset--
|
||||
}
|
||||
if StyledButton(content_x + content_w - Scale(44), y,
|
||||
Scale(44), month_h, ">",
|
||||
ButtonStyleSecondary,
|
||||
forward_disabled, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(content_x + content_w - Scale(44)), (float)(y), (float)(Scale(44)), (float)(month_h)},
|
||||
.label = ">",
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = forward_disabled
|
||||
}) {
|
||||
app->habits.month_offset++
|
||||
}
|
||||
Text((TextProps){
|
||||
@@ -2293,34 +2214,16 @@ draw_habits_screen :: (app: InnerBreeze*) {
|
||||
target: int = habit_counter_target(active)
|
||||
progress: float = (float)count / (float)target
|
||||
|
||||
habit_calendar_day_cell(app, cell_x, cell_y,
|
||||
cell_w, cell_h, day_label,
|
||||
progress, future_day,
|
||||
day_index == today_index,
|
||||
active->color)
|
||||
action = habit_counter_day_action(app, selected, day_index,
|
||||
cell_x, cell_y,
|
||||
cell_w, cell_h,
|
||||
future_day,
|
||||
!has_linked_day)
|
||||
if action == 0 && has_linked_day && !future_day {
|
||||
mouse_world: Vector2 =
|
||||
GetScreenToWorld2D(GetMousePosition(), app->camera)
|
||||
|
||||
cell_bounds = (Rectangle){
|
||||
(float)cell_x,
|
||||
(float)cell_y,
|
||||
(float)cell_w,
|
||||
(float)cell_h
|
||||
}
|
||||
cell_clicked =
|
||||
CheckCollisionPointRec(mouse_world, cell_bounds) &&
|
||||
!UIInputCapturesClick(mouse_world) &&
|
||||
IsMouseButtonReleased(MOUSE_BUTTON_LEFT)
|
||||
if cell_clicked {
|
||||
habit_open_linked_edit_page(app, selected,
|
||||
day_index)
|
||||
}
|
||||
cell_clicked = habit_calendar_day_cell(app, cell_x, cell_y,
|
||||
cell_w, cell_h, day_label, progress, future_day,
|
||||
day_index == today_index, active->color)
|
||||
if action == 0 && has_linked_day && !future_day && cell_clicked {
|
||||
habit_open_linked_edit_page(app, selected, day_index)
|
||||
}
|
||||
} else if habit_calendar_day_cell(app, cell_x, cell_y,
|
||||
cell_w, cell_h, day_label,
|
||||
|
||||
@@ -16,7 +16,7 @@ language_screen_draw :: (app: InnerBreeze*) {
|
||||
dropdown_y := 0
|
||||
button_x := 0
|
||||
button_y := 0
|
||||
next_hover := 0
|
||||
|
||||
selected_index: int* = &app->language_index
|
||||
language_count := GetLocaleCount()
|
||||
selection_changed := 0
|
||||
@@ -60,7 +60,12 @@ language_screen_draw :: (app: InnerBreeze*) {
|
||||
.color=(GetThemeText()),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if TextButton(0, button_x, button_y, GetLocaleText("next_button"), &next_hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 0, .label = GetLocaleText("next_button"), .font = GetFontSize(),
|
||||
.bounds = {(button_x) - fmaxf(TextWidth(GetLocaleText("next_button"), GetFontSize()) + Scale(16), Scale(34)) / 2.0f,
|
||||
(float)(button_y), fmaxf(TextWidth(GetLocaleText("next_button"), GetFontSize()) + Scale(16), Scale(34)), fmaxf(TextLineHeight(GetFontSize()) + Scale(8), Scale(34))},
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
app_accept_language_selection(app)
|
||||
app->main_tab = APP_MAIN_TAB_PRACTICE
|
||||
app->practice_tab = PRACTICE_TAB_PLAY
|
||||
|
||||
@@ -256,45 +256,14 @@ practice_home_action_gap :: (content_w: int) -> int #private {
|
||||
|
||||
practice_home_action_button :: (app: InnerBreeze*, bounds: Rectangle,
|
||||
label: const char*, primary: int) -> int #private {
|
||||
mouse := GetScreenToWorld2D(GetMousePosition(), app->camera)
|
||||
disabled := app != NULL && app->modal.active
|
||||
hover := !disabled && CheckCollisionPointRec(mouse, bounds) &&
|
||||
!UIInputCapturesClick(mouse)
|
||||
fill := primary ? Fade(GetThemeButton(), 0.72f)
|
||||
: Fade(GetThemeSurface(), 0.66f)
|
||||
text_color := primary ? WHITE : Fade(GetThemeText(), 0.88f)
|
||||
font := GetFontSize()
|
||||
label_w := TextWidth(label, font)
|
||||
shadow := bounds
|
||||
|
||||
shadow.y += Scale(3)
|
||||
|
||||
if hover {
|
||||
fill = primary ? Fade(GetThemeButtonHover(), 0.78f)
|
||||
: Fade(GetThemeSurface(), 0.82f)
|
||||
}
|
||||
|
||||
DrawRectangleRounded(shadow, 0.10f, 12, Fade(BLACK, 0.22f))
|
||||
DrawRectangleRounded(bounds, 0.10f, 12, fill)
|
||||
Text((TextProps){
|
||||
.bounds = {(float)(bounds.x + (bounds.width - label_w) / 2),
|
||||
(float)GetUIControlTextY(label, (int)bounds.y,
|
||||
(int)bounds.height, font),
|
||||
0, 0},
|
||||
.text = label,
|
||||
.font = font,
|
||||
.color = text_color,
|
||||
.wrap = TextWrapNone
|
||||
return Button((ButtonProps){
|
||||
.bounds = bounds,
|
||||
.label = label,
|
||||
.font = GetFontSize(),
|
||||
.disabled = app != NULL && app->modal.active,
|
||||
.tone = primary ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = primary ? ButtonEmphasisFilled : ButtonEmphasisSoft
|
||||
})
|
||||
|
||||
if hover {
|
||||
MarkUIClickable()
|
||||
if IsMouseButtonReleased(MOUSE_BUTTON_LEFT) {
|
||||
UIConsumeRelease()
|
||||
return 1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
practice_home_quiet_action_button :: (bounds: Rectangle, label: const char*) -> int #private {
|
||||
@@ -805,17 +774,37 @@ practice_screen_draw_floating_actions :: (app: InnerBreeze*) {
|
||||
}
|
||||
practice := practice_get(app->exercise_type)
|
||||
if practice->draw_config != NULL {
|
||||
hover := 0
|
||||
x -= button_w
|
||||
if PaddedIconBtn(0, x, y, icon_size, icon_padding, app->icons[UI_ICON_TYPE_WRENCH], &hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(x), (float)(y),
|
||||
(float)((icon_size) + (icon_padding) * 2),
|
||||
(float)((icon_size) + (icon_padding) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_WRENCH], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(icon_size) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
practice_screen_open_tab(app, PRACTICE_TAB_CONFIG)
|
||||
}
|
||||
x -= gap
|
||||
}
|
||||
if practice->draw_manual != NULL {
|
||||
hover := 0
|
||||
x -= button_w
|
||||
if PaddedIconBtn(0, x, y, icon_size, icon_padding, app->icons[UI_ICON_TYPE_MANUAL], &hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(x), (float)(y),
|
||||
(float)((icon_size) + (icon_padding) * 2),
|
||||
(float)((icon_size) + (icon_padding) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_MANUAL], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(icon_size) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
practice_screen_open_tab(app, PRACTICE_TAB_MANUAL)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,17 +141,16 @@ profile_draw_identity :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
GetLocaleText("profile_no_account"))
|
||||
}
|
||||
|
||||
if IconButton((IconButtonProps){
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)x, (float)(*y + Scale(18)),
|
||||
(float)icon_size, (float)icon_size},
|
||||
.icon = app->icons[app->profile_picture_icon],
|
||||
.icon_size = icon_size - Scale(18),
|
||||
.icon_padding = Scale(9),
|
||||
.background = DarkenUIColor(GetThemeBackground(), 7),
|
||||
.hover_background = DarkenUIColor(GetThemeBackground(), 14),
|
||||
.border = DarkenUIColor(GetThemeBackground(), 22),
|
||||
.icon_color = WHITE,
|
||||
.radius = 0.5f
|
||||
.icon_only = 1, .circle = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(icon_size - Scale(18)) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
app->profile_picture_picker_scroll = 0
|
||||
app_open_modal(app, UIModalProfilePicturePicker)
|
||||
@@ -324,19 +323,13 @@ profile_draw_hub_route_card :: (app: InnerBreeze*, x: int, y: int*, w: int,
|
||||
if value_w > 0 {
|
||||
text_w -= value_w + Scale(12)
|
||||
}
|
||||
DrawRectangleRounded(bounds, 0.12f, 12, DarkenUIColor(GetThemeBackground(), 7))
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.12f, 12, 1.0f,
|
||||
Fade(GetThemeText(), 0.08f))
|
||||
if OverlayButton((OverlayButtonProps){
|
||||
if Button((ButtonProps){
|
||||
.bounds = bounds,
|
||||
.label = "",
|
||||
.font = GetFontSize(),
|
||||
.background = BLANK,
|
||||
.hover_background = Fade(GetThemeText(), 0.06f),
|
||||
.border = BLANK,
|
||||
.hover_border = BLANK,
|
||||
.text = GetThemeText()
|
||||
}) {
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
profile_open_tab_card(app, tab)
|
||||
}
|
||||
DrawCircle(icon_x + icon_box / 2, *y + h / 2, icon_box / 2,
|
||||
@@ -386,7 +379,7 @@ profile_draw_hub_identity :: (app: InnerBreeze*, x: int, w: int, y: int*) #priva
|
||||
text_x := avatar_x + avatar + Scale(18)
|
||||
title: [96] char = {0}
|
||||
subtitle: [160] char = {0}
|
||||
hover := 0
|
||||
|
||||
subtitle_y := *y + Scale(64)
|
||||
|
||||
if has_account {
|
||||
@@ -414,17 +407,16 @@ profile_draw_hub_identity :: (app: InnerBreeze*, x: int, w: int, y: int*) #priva
|
||||
Fade(GetThemeBackground(), 0.0f))
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.14f, 12, 1.0f,
|
||||
DarkenUIColor(GetThemeButton(), 18))
|
||||
if IconButton((IconButtonProps){
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)avatar_x, (float)avatar_y,
|
||||
(float)avatar, (float)avatar},
|
||||
.icon = app->icons[app->profile_picture_icon],
|
||||
.icon_size = avatar - Scale(26),
|
||||
.icon_padding = Scale(13),
|
||||
.background = DarkenUIColor(GetThemeBackground(), 14),
|
||||
.hover_background = DarkenUIColor(GetThemeBackground(), 22),
|
||||
.border = Fade(GetThemeText(), 0.42f),
|
||||
.icon_color = WHITE,
|
||||
.radius = 0.5f
|
||||
.icon_only = 1, .circle = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(avatar - Scale(26)) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
app->profile_picture_picker_scroll = 0
|
||||
app_open_modal(app, UIModalProfilePicturePicker)
|
||||
@@ -438,12 +430,15 @@ profile_draw_hub_identity :: (app: InnerBreeze*, x: int, w: int, y: int*) #priva
|
||||
.font = GetSmallFontSize(),
|
||||
.line_gap = Scale(3)
|
||||
}, text_x, &subtitle_y)
|
||||
if StyledButton(text_x, *y + Scale(108),
|
||||
w - (text_x - x) - Scale(18),
|
||||
Scale(38),
|
||||
GetLocaleText(has_account ? "sync_account_title"
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(text_x), (float)(*y + Scale(108)), (float)(w - (text_x - x) - Scale(18)), (float)(Scale(38))},
|
||||
.label = GetLocaleText(has_account ? "sync_account_title"
|
||||
: "sync_create_account_button"),
|
||||
ButtonStylePrimary, 0, &hover) {
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
profile_open_tab_card(app, PROFILE_TAB_SYNC)
|
||||
}
|
||||
*y += card_h + Scale(18)
|
||||
@@ -609,16 +604,12 @@ profile_draw_tabs :: (app: InnerBreeze*, y: int, h: int) -> int #private {
|
||||
x := i * tab_w
|
||||
w := i == PROFILE_TAB_COUNT - 1 ? view_width - x : tab_w
|
||||
selected := i == app->profile_tab
|
||||
if OverlayButton((OverlayButtonProps){
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)x, (float)y, (float)w, (float)h},
|
||||
.label = profile_tab_title(i),
|
||||
.font = GetSmallFontSize(),
|
||||
.background = selected ? DarkenUIColor(GetThemeBackground(), 13)
|
||||
: BLANK,
|
||||
.hover_background = DarkenUIColor(GetThemeBackground(), 10),
|
||||
.border = BLANK,
|
||||
.hover_border = BLANK,
|
||||
.text = GetThemeText()
|
||||
.tone = selected ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft, .selected = selected
|
||||
}) {
|
||||
clicked = i
|
||||
}
|
||||
@@ -671,8 +662,8 @@ profile_draw_habits :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
|
||||
for int i = 0; i < app->habits.count; i++ {
|
||||
row_y := *y
|
||||
up_hover := 0
|
||||
down_hover := 0
|
||||
|
||||
|
||||
controls_w := btn_w * 2 + gap
|
||||
name_w := stack_rows ? w : w - controls_w - gap
|
||||
|
||||
@@ -682,21 +673,27 @@ profile_draw_habits :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
if stack_rows {
|
||||
row_y += Scale(36)
|
||||
}
|
||||
if StyledButton(stack_rows ? x : x + w - btn_w * 2 - gap,
|
||||
row_y, btn_w, btn_h,
|
||||
GetLocaleText("move_up_button"),
|
||||
ButtonStyleSecondary, i == 0,
|
||||
&up_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(stack_rows ? x : x + w - btn_w * 2 - gap), (float)(row_y), (float)(btn_w), (float)(btn_h)},
|
||||
.label = GetLocaleText("move_up_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = i == 0
|
||||
}) {
|
||||
if habits_move(&app->habits, i, i - 1) {
|
||||
app_auto_sync(app)
|
||||
}
|
||||
return
|
||||
}
|
||||
if StyledButton(stack_rows ? x + btn_w + gap : x + w - btn_w,
|
||||
row_y, btn_w, btn_h,
|
||||
GetLocaleText("move_down_button"),
|
||||
ButtonStyleSecondary,
|
||||
i == app->habits.count - 1, &down_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(stack_rows ? x + btn_w + gap : x + w - btn_w), (float)(row_y), (float)(btn_w), (float)(btn_h)},
|
||||
.label = GetLocaleText("move_down_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = i == app->habits.count - 1
|
||||
}) {
|
||||
if habits_move(&app->habits, i, i + 1) {
|
||||
app_auto_sync(app)
|
||||
}
|
||||
|
||||
@@ -297,10 +297,10 @@ draw_json_people :: (json: const char*, array_key: const char*,
|
||||
title: [96] char = {0}
|
||||
url: [256] char = {0}
|
||||
row_h := with_actions ? Scale(42) : Scale(30)
|
||||
hover_accept := 0
|
||||
hover_decline := 0
|
||||
hover_remove := 0
|
||||
hover_cancel := 0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if !storage_json_array_object_text(json, array_path, rows, "id",
|
||||
id, sizeof(id)) {
|
||||
@@ -355,10 +355,18 @@ draw_json_people :: (json: const char*, array_key: const char*,
|
||||
icon_padding := Scale(6)
|
||||
button_w := icon_size + icon_padding * 2
|
||||
|
||||
if PaddedIconBtn(0, x + w - button_w, *y - Scale(6),
|
||||
icon_size, icon_padding,
|
||||
app->icons[UI_ICON_TYPE_TRASH],
|
||||
&hover_remove) {
|
||||
if Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(x + w - button_w), (float)(*y - Scale(6)),
|
||||
(float)((icon_size) + (icon_padding) * 2),
|
||||
(float)((icon_size) + (icon_padding) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_TRASH], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(icon_size) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
prompt_remove_friend(app, display_id, title)
|
||||
}
|
||||
} else if with_cancel {
|
||||
@@ -366,10 +374,18 @@ draw_json_people :: (json: const char*, array_key: const char*,
|
||||
icon_padding := Scale(6)
|
||||
button_w := icon_size + icon_padding * 2
|
||||
|
||||
if PaddedIconBtn(0, x + w - button_w, *y - Scale(6),
|
||||
icon_size, icon_padding,
|
||||
app->icons[UI_ICON_TYPE_TRASH],
|
||||
&hover_cancel) &&
|
||||
if Button((ButtonProps){
|
||||
.id = 0,
|
||||
.bounds = {(float)(x + w - button_w), (float)(*y - Scale(6)),
|
||||
(float)((icon_size) + (icon_padding) * 2),
|
||||
(float)((icon_size) + (icon_padding) * 2)},
|
||||
.icon = app->icons[UI_ICON_TYPE_TRASH], .icon_only = 1,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(icon_size) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) &&
|
||||
sync_url(url, sizeof(url)) {
|
||||
app_request_friend_decline(app, id)
|
||||
settings_screen_set_status_success(
|
||||
@@ -380,21 +396,27 @@ draw_json_people :: (json: const char*, array_key: const char*,
|
||||
if with_actions {
|
||||
btn_w := (w - Scale(8)) / 2
|
||||
|
||||
if StyledButton(x, *y + Scale(22), btn_w,
|
||||
Scale(30),
|
||||
GetLocaleText("profile_friend_accept_button"),
|
||||
ButtonStylePrimary, 0,
|
||||
&hover_accept) &&
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y + Scale(22)), (float)(btn_w), (float)(Scale(30))},
|
||||
.label = GetLocaleText("profile_friend_accept_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) &&
|
||||
sync_url(url, sizeof(url)) {
|
||||
app_request_friend_accept(app, id)
|
||||
settings_screen_set_status_success(
|
||||
GetLocaleText("profile_updating_status"), nil)
|
||||
}
|
||||
if StyledButton(x + btn_w + Scale(8),
|
||||
*y + Scale(22), btn_w, Scale(30),
|
||||
GetLocaleText("profile_friend_decline_button"),
|
||||
ButtonStyleSecondary, 0,
|
||||
&hover_decline) &&
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x + btn_w + Scale(8)), (float)(*y + Scale(22)), (float)(btn_w), (float)(Scale(30))},
|
||||
.label = GetLocaleText("profile_friend_decline_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) &&
|
||||
sync_url(url, sizeof(url)) {
|
||||
app_request_friend_decline(app, id)
|
||||
settings_screen_set_status_success(
|
||||
@@ -409,7 +431,7 @@ draw_json_people :: (json: const char*, array_key: const char*,
|
||||
draw_friends :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
font := GetFontSize()
|
||||
btn_h := Scale(34)
|
||||
hover_add := 0
|
||||
|
||||
commit := 0
|
||||
url: [256] char = {0}
|
||||
incoming_count := 0
|
||||
@@ -461,11 +483,14 @@ draw_friends :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
})
|
||||
*y += Scale(46)
|
||||
|
||||
if (StyledButton(x, *y, w, btn_h,
|
||||
GetLocaleText("profile_add_friend_button"),
|
||||
ButtonStylePrimary,
|
||||
app->profile_friend_input[0] == '\0',
|
||||
&hover_add) || commit) &&
|
||||
if (Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(btn_h)},
|
||||
.label = GetLocaleText("profile_add_friend_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = app->profile_friend_input[0] == '\0'
|
||||
}) || commit) &&
|
||||
app->profile_friend_input[0] != '\0' {
|
||||
if sync_url(url, sizeof(url)) {
|
||||
target: [80] char = {0}
|
||||
@@ -1021,17 +1046,13 @@ draw_combined_leaderboard :: (app: InnerBreeze*, x: int, w: int,
|
||||
hx := x
|
||||
for int c = 0; c < column_count; c++ {
|
||||
selected := c > 0 && app->profile_leaderboard_metric == c - 1
|
||||
if OverlayButton((OverlayButtonProps){
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)hx, (float)*y, (float)widths[c], (float)header_h},
|
||||
.label = columns[c],
|
||||
.font = GetSmallFontSize(),
|
||||
.disabled = c == 0,
|
||||
.background = selected ? DarkenUIColor(GetThemeBackground(), 18)
|
||||
: DarkenUIColor(GetThemeBackground(), 8),
|
||||
.hover_background = DarkenUIColor(GetThemeBackground(), 14),
|
||||
.border = DarkenUIColor(GetThemeBackground(), selected ? 40 : 25),
|
||||
.hover_border = DarkenUIColor(GetThemeBackground(), 40),
|
||||
.text = GetThemeText()
|
||||
.tone = selected ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft, .selected = selected
|
||||
}) && c > 0 {
|
||||
app->profile_leaderboard_metric = c - 1
|
||||
}
|
||||
@@ -1135,23 +1156,14 @@ draw_choice_row :: (app: InnerBreeze*, x: int, w: int, y: int*, value: int*,
|
||||
bx := x + i * (btn_w + gap)
|
||||
bw := i == count - 1 ? x + w - bx : btn_w
|
||||
selected: int = *value == i
|
||||
bg := selected
|
||||
? DarkenUIColor(GetThemeBackground(), 18)
|
||||
: DarkenUIColor(GetThemeBackground(), 6)
|
||||
border := selected
|
||||
? GetThemeText()
|
||||
: DarkenUIColor(GetThemeBackground(), 24)
|
||||
|
||||
if OverlayButton((OverlayButtonProps){
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)bx, (float)*y, (float)bw, (float)btn_h},
|
||||
.label = labels[i],
|
||||
.font = GetSmallFontSize(),
|
||||
.disabled = selected,
|
||||
.background = bg,
|
||||
.hover_background = DarkenUIColor(GetThemeBackground(), 13),
|
||||
.border = border,
|
||||
.hover_border = DarkenUIColor(GetThemeBackground(), 36),
|
||||
.text = GetThemeText()
|
||||
.tone = selected ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft, .selected = selected
|
||||
}) && !selected {
|
||||
*value = i
|
||||
load_leaderboard_cache(app)
|
||||
|
||||
@@ -120,7 +120,7 @@ session_result_draw_mood_picker :: (app: InnerBreeze*, x: int, y: int, w: int,
|
||||
gap := Scale(8)
|
||||
item_w := (w - gap * (SESSION_RESULT_MOOD_COUNT - 1)) /
|
||||
SESSION_RESULT_MOOD_COUNT
|
||||
mouse := GetScreenToWorld2D(GetMousePosition(), app->camera)
|
||||
unused hover
|
||||
|
||||
DrawLeftUIControlTextInRect(GetLocaleText("results_mood_title"),
|
||||
(Rectangle){(float)x, (float)y,
|
||||
@@ -133,40 +133,14 @@ session_result_draw_mood_picker :: (app: InnerBreeze*, x: int, y: int, w: int,
|
||||
bx := x + i * (item_w + gap)
|
||||
bw := i == SESSION_RESULT_MOOD_COUNT - 1 ? x + w - bx : item_w
|
||||
bounds := (Rectangle){(float)bx, (float)y, (float)bw, (float)button_h}
|
||||
active := CheckCollisionPointRec(mouse, bounds) &&
|
||||
!UIInputCapturesClick(mouse)
|
||||
selected := app->session_result.mood == i + 1
|
||||
mood_color := session_result_mood_color(i + 1)
|
||||
fill := selected ? LightenUIColor(GetThemeSurface(), 5)
|
||||
: DarkenUIColor(GetThemeBackground(), 7)
|
||||
border := selected ? GetThemeButton()
|
||||
: Fade(GetThemeText(), 0.26f)
|
||||
|
||||
if active {
|
||||
MarkUIClickable()
|
||||
if UIHoverEffectsEnabled() {
|
||||
fill = selected ? LightenUIColor(GetThemeSurface(), 10)
|
||||
: DarkenUIColor(GetThemeBackground(), 3)
|
||||
}
|
||||
if IsMouseButtonReleased(MOUSE_BUTTON_LEFT) &&
|
||||
!UIInputCapturesClick(mouse) {
|
||||
app->session_result.mood = i + 1
|
||||
}
|
||||
if hover != nil {
|
||||
*hover = 1
|
||||
}
|
||||
if Button((ButtonProps){
|
||||
.bounds = bounds, .id = 24800 + i,
|
||||
.tone = selected ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft, .selected = selected
|
||||
}) {
|
||||
app->session_result.mood = i + 1
|
||||
}
|
||||
|
||||
DrawRectangleRounded(bounds, 0.18f, 10, fill)
|
||||
if selected {
|
||||
DrawRectangleRounded(bounds, 0.18f, 10, Fade(mood_color, 0.16f))
|
||||
} else if active && UIHoverEffectsEnabled() {
|
||||
DrawRectangleRounded(bounds, 0.18f, 10,
|
||||
Fade(GetThemeButtonHover(), 0.08f))
|
||||
}
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.18f, 10,
|
||||
selected ? (float)Scale(2) : 1.0f,
|
||||
border)
|
||||
session_result_draw_mood_face(i + 1, bx + bw / 2,
|
||||
y + button_h / 2,
|
||||
Scale(32), selected)
|
||||
@@ -364,21 +338,35 @@ practice_draw_results :: (app: InnerBreeze*, center_x: int, center_y: int, hover
|
||||
button_y = view_height - Scale(28) - button_h
|
||||
if result->saved {
|
||||
button_w = (box_w - gap) / 2
|
||||
if StyledButton(box_x, button_y, button_w, button_h,
|
||||
GetLocaleText("discard_button"),
|
||||
ButtonStyleSecondary, 0, &discard_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(box_x), (float)(button_y), (float)(button_w), (float)(button_h)},
|
||||
.label = GetLocaleText("discard_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
session_result_discard(app)
|
||||
}
|
||||
if StyledButton(box_x + button_w + gap, button_y,
|
||||
box_w - button_w - gap, button_h,
|
||||
GetLocaleText("done_button"),
|
||||
ButtonStylePrimary, 0, &done_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(box_x + button_w + gap), (float)(button_y), (float)(box_w - button_w - gap), (float)(button_h)},
|
||||
.label = GetLocaleText("done_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
session_result_done(app)
|
||||
}
|
||||
} else {
|
||||
if StyledButton(box_x, button_y, box_w, button_h,
|
||||
GetLocaleText("done_button"),
|
||||
ButtonStylePrimary, 0, &done_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(box_x), (float)(button_y), (float)(box_w), (float)(button_h)},
|
||||
.label = GetLocaleText("done_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
session_result_done(app)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ about_draw_link_icons :: (app: InnerBreeze*, content_x: int, content_w: int, y:
|
||||
}
|
||||
|
||||
about_draw_donate_button :: (app: InnerBreeze*, content_x: int, content_w: int, y: int*) #private {
|
||||
hover := 0
|
||||
|
||||
button_h := Scale(38)
|
||||
button_w := Scale(220)
|
||||
|
||||
@@ -88,10 +88,14 @@ about_draw_donate_button :: (app: InnerBreeze*, content_x: int, content_w: int,
|
||||
button_w = content_w
|
||||
}
|
||||
|
||||
if StyledButton(content_x + (content_w - button_w) / 2, *y,
|
||||
button_w, button_h,
|
||||
GetLocaleText("donation_reminder_donate_button"),
|
||||
ButtonStylePrimary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(content_x + (content_w - button_w) / 2), (float)(*y), (float)(button_w), (float)(button_h)},
|
||||
.label = GetLocaleText("donation_reminder_donate_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app_open_modal(app, UIModalAboutDonation)
|
||||
}
|
||||
*y += button_h
|
||||
|
||||
@@ -327,11 +327,16 @@ settings_audio_toggle_music_preview :: (app: InnerBreeze*, index: int) #private
|
||||
|
||||
draw_audio_preview_button :: (x: int, y: int, w: int, playing: int,
|
||||
disabled: int) -> int #private {
|
||||
hover := 0
|
||||
return StyledButton(x, y, w, Scale(32),
|
||||
playing ? GetLocaleText("pause_button")
|
||||
|
||||
return Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(y), (float)(w), (float)(Scale(32))},
|
||||
.label = playing ? GetLocaleText("pause_button")
|
||||
: GetLocaleText("play_button"),
|
||||
ButtonStyleSecondary, disabled, &hover)
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = disabled
|
||||
})
|
||||
}
|
||||
|
||||
audio_action_to_cue :: (action: int) -> int #private {
|
||||
@@ -663,9 +668,15 @@ settings_audio_content_height :: (app: InnerBreeze*, content_w: int) -> int {
|
||||
}
|
||||
|
||||
draw_import_button :: (app: InnerBreeze*, x: int, w: int, y: int*, label: const char*, action: int, practice: int) #private {
|
||||
hover := 0
|
||||
if StyledButton(x, *y, w, Scale(36), label,
|
||||
ButtonStyleSecondary, 0, &hover) {
|
||||
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(Scale(36))},
|
||||
.label = label,
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
settings_audio_start_import(app, action, practice)
|
||||
}
|
||||
*y += Scale(42)
|
||||
@@ -741,7 +752,7 @@ draw_custom_sound_list :: (app: InnerBreeze*, x: int, w: int, y: int*) #private
|
||||
})
|
||||
*y += Scale(30)
|
||||
for int i = 0; i < app->audio_custom_sound_count; i++ {
|
||||
hover := 0
|
||||
|
||||
label_w := w - button_w - preview_w - gap * 2
|
||||
if label_w < Scale(80) {
|
||||
label_w = w - button_w - gap
|
||||
@@ -759,9 +770,14 @@ draw_custom_sound_list :: (app: InnerBreeze*, x: int, w: int, y: int*) #private
|
||||
app == nil || !app->audio_ready) {
|
||||
settings_audio_toggle_custom_sound_preview(app, i)
|
||||
}
|
||||
if StyledButton(x + w - button_w, *y, button_w,
|
||||
Scale(32), GetLocaleText("remove_button"),
|
||||
ButtonStyleDanger, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x + w - button_w), (float)(*y), (float)(button_w), (float)(Scale(32))},
|
||||
.label = GetLocaleText("remove_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneDanger,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
settings_audio_stop_preview(app)
|
||||
app_audio_remove_custom_sound(app, i)
|
||||
app->settings_dirty = 1
|
||||
@@ -808,7 +824,6 @@ draw_music_list :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
practice_total := practice_count()
|
||||
assigned := 0
|
||||
for int p = 0; p < practice_total; p++ {
|
||||
hover := 0
|
||||
current := app->meditation.music_practice_tracks[p]
|
||||
label_w := w - button_w - preview_w - gap * 2
|
||||
|
||||
@@ -850,9 +865,14 @@ draw_music_list :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
app == nil || !app->audio_ready) {
|
||||
settings_audio_toggle_music_preview(app, current)
|
||||
}
|
||||
if StyledButton(x + w - button_w, *y, button_w,
|
||||
Scale(32), GetLocaleText("remove_button"),
|
||||
ButtonStyleDanger, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x + w - button_w), (float)(*y), (float)(button_w), (float)(Scale(32))},
|
||||
.label = GetLocaleText("remove_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneDanger,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
settings_audio_stop_preview(app)
|
||||
app->meditation.music_practice_tracks[p] = AUDIO_MUSIC_NONE
|
||||
app->meditation.music_practice_mask &= ~(1 << p)
|
||||
@@ -887,7 +907,6 @@ draw_music_list :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
})
|
||||
*y += Scale(30)
|
||||
for int i = 0; i < app->audio_custom_music_count; i++ {
|
||||
hover := 0
|
||||
track_index := AUDIO_BUILTIN_MUSIC_COUNT + i
|
||||
label_w := w - button_w - preview_w - gap * 2
|
||||
if label_w < Scale(80) {
|
||||
@@ -912,9 +931,14 @@ draw_music_list :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
app == nil || !app->audio_ready) {
|
||||
settings_audio_toggle_music_preview(app, track_index)
|
||||
}
|
||||
if StyledButton(x + w - button_w, *y, button_w,
|
||||
Scale(32), GetLocaleText("remove_button"),
|
||||
ButtonStyleDanger, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x + w - button_w), (float)(*y), (float)(button_w), (float)(Scale(32))},
|
||||
.label = GetLocaleText("remove_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneDanger,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
settings_audio_stop_preview(app)
|
||||
app_audio_remove_custom_music(app, i)
|
||||
app->settings_dirty = 1
|
||||
@@ -927,7 +951,7 @@ draw_music_list :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
|
||||
draw_music_download :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
button_h := Scale(36)
|
||||
hover := 0
|
||||
|
||||
installed := meditation_music_available(app)
|
||||
download_label: const char*
|
||||
|
||||
@@ -943,8 +967,14 @@ draw_music_download :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
if button_w > w {
|
||||
button_w = w
|
||||
}
|
||||
if StyledButton(x, *y, button_w, button_h, download_label,
|
||||
ButtonStylePrimary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(button_w), (float)(button_h)},
|
||||
.label = download_label,
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
meditation_music_start_download(app)
|
||||
}
|
||||
*y += button_h + Scale(12)
|
||||
|
||||
@@ -328,10 +328,15 @@ settings_breaks_draw :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
if button_w > Scale(200) {
|
||||
button_w = Scale(200)
|
||||
}
|
||||
rest_hover := 0
|
||||
if StyledButton(x, *y, button_w, Scale(40),
|
||||
GetLocaleText("settings_breaks_rest_now"),
|
||||
ButtonStyleSecondary, 0, &rest_hover) {
|
||||
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(button_w), (float)(Scale(40))},
|
||||
.label = GetLocaleText("settings_breaks_rest_now"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app_breaks_rest_break_now(app)
|
||||
}
|
||||
*y += Scale(60)
|
||||
|
||||
@@ -331,50 +331,75 @@ content_height :: (content_w: int) -> int {
|
||||
draw_actions :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
account: SyncAccount
|
||||
data_button_h := Scale(36)
|
||||
hover_import: int = 0
|
||||
hover_export: int = 0
|
||||
hover_delete: int = 0
|
||||
|
||||
|
||||
|
||||
has_account := sync_account_load(&account)
|
||||
|
||||
settings_sync_account_set_save_dialog(start_sync_key_export_dialog)
|
||||
settings_sync_account_set_import_dialog(start_sync_key_import_dialog)
|
||||
|
||||
*y += Scale(SETTINGS_DATA_TOP_PADDING)
|
||||
if StyledButton(x, *y, w, data_button_h,
|
||||
GetLocaleText("import_data_button"),
|
||||
ButtonStylePrimary, 0, &hover_import) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(data_button_h)},
|
||||
.label = GetLocaleText("import_data_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
import_data(app)
|
||||
}
|
||||
*y += data_button_h + Scale(12)
|
||||
|
||||
if StyledButton(x, *y, w, data_button_h,
|
||||
GetLocaleText("export_data_button"),
|
||||
ButtonStylePrimary, 0, &hover_export) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(data_button_h)},
|
||||
.label = GetLocaleText("export_data_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
export_data(app)
|
||||
}
|
||||
*y += data_button_h + Scale(12)
|
||||
|
||||
if StyledButton(x, *y, w, data_button_h,
|
||||
GetLocaleText("export_csv_button"),
|
||||
ButtonStyleSecondary, 0, &hover_export) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(data_button_h)},
|
||||
.label = GetLocaleText("export_csv_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
export_csv(app)
|
||||
}
|
||||
*y += data_button_h + Scale(12)
|
||||
|
||||
#if ANDROID {
|
||||
hover_health: int = 0
|
||||
if StyledButton(x, *y, w, data_button_h,
|
||||
GetLocaleText("export_health_connect_button"),
|
||||
ButtonStyleSecondary, 0, &hover_health) {
|
||||
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(data_button_h)},
|
||||
.label = GetLocaleText("export_health_connect_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
export_health_connect(app)
|
||||
}
|
||||
*y += data_button_h + Scale(12)
|
||||
}
|
||||
|
||||
if !has_account {
|
||||
if StyledButton(x, *y, w, data_button_h,
|
||||
GetLocaleText("clear_local_data_button"),
|
||||
ButtonStyleDanger, 0, &hover_delete) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(data_button_h)},
|
||||
.label = GetLocaleText("clear_local_data_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneDanger,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
request_delete_all_data(app)
|
||||
}
|
||||
*y += data_button_h + Scale(12)
|
||||
@@ -761,7 +786,7 @@ draw_import_choice_modal :: (app: InnerBreeze*) -> int {
|
||||
msg_y: int
|
||||
btn_y: int
|
||||
btn_w: int
|
||||
hover: int = 0
|
||||
|
||||
|
||||
unused app
|
||||
|
||||
@@ -784,36 +809,36 @@ draw_import_choice_modal :: (app: InnerBreeze*) -> int {
|
||||
btn_y = frame.y + frame.h - Scale(24) - btn_h * 2 - row_gap
|
||||
btn_w = (frame.content_w - row_gap) / 2
|
||||
|
||||
if StyledButton(frame.content_x,
|
||||
btn_y,
|
||||
btn_w,
|
||||
btn_h,
|
||||
GetLocaleText("cancel_button"),
|
||||
ButtonStyleSecondary,
|
||||
0,
|
||||
&hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(frame.content_x), (float)(btn_y), (float)(btn_w), (float)(btn_h)},
|
||||
.label = GetLocaleText("cancel_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
return 1
|
||||
}
|
||||
|
||||
if StyledButton(frame.content_x + btn_w + row_gap,
|
||||
btn_y,
|
||||
btn_w,
|
||||
btn_h,
|
||||
GetLocaleText("import_data_only_button"),
|
||||
ButtonStylePrimary,
|
||||
0,
|
||||
&hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(frame.content_x + btn_w + row_gap), (float)(btn_y), (float)(btn_w), (float)(btn_h)},
|
||||
.label = GetLocaleText("import_data_only_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
return 2
|
||||
}
|
||||
|
||||
if StyledButton(frame.content_x,
|
||||
btn_y + btn_h + row_gap,
|
||||
frame.content_w,
|
||||
btn_h,
|
||||
GetLocaleText("import_data_settings_button"),
|
||||
ButtonStylePrimary,
|
||||
0,
|
||||
&hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(frame.content_x), (float)(btn_y + btn_h + row_gap), (float)(frame.content_w), (float)(btn_h)},
|
||||
.label = GetLocaleText("import_data_settings_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
return 3
|
||||
}
|
||||
|
||||
@@ -834,7 +859,7 @@ draw_sync_review_modal :: (app: InnerBreeze*) -> int {
|
||||
diff_y: int
|
||||
diff_h: int
|
||||
legend_y: int
|
||||
hover: int = 0
|
||||
|
||||
diff_content_h: int = Scale(40)
|
||||
p: const char* = nil
|
||||
diff_view: UIScrollView
|
||||
@@ -954,26 +979,26 @@ draw_sync_review_modal :: (app: InnerBreeze*) -> int {
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
|
||||
if StyledButton(frame.content_x,
|
||||
btn_y,
|
||||
(frame.content_w - gap) / 2,
|
||||
btn_h,
|
||||
GetLocaleText("sync_review_keep_local_button"),
|
||||
ButtonStyleSecondary,
|
||||
0,
|
||||
&hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(frame.content_x), (float)(btn_y), (float)((frame.content_w - gap) / 2), (float)(btn_h)},
|
||||
.label = GetLocaleText("sync_review_keep_local_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
free(diff_detail)
|
||||
return 1
|
||||
}
|
||||
|
||||
if StyledButton(frame.content_x + (frame.content_w + gap) / 2,
|
||||
btn_y,
|
||||
(frame.content_w - gap) / 2,
|
||||
btn_h,
|
||||
GetLocaleText("sync_review_use_remote_button"),
|
||||
ButtonStylePrimary,
|
||||
0,
|
||||
&hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(frame.content_x + (frame.content_w + gap) / 2), (float)(btn_y), (float)((frame.content_w - gap) / 2), (float)(btn_h)},
|
||||
.label = GetLocaleText("sync_review_use_remote_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
free(diff_detail)
|
||||
return 2
|
||||
}
|
||||
|
||||
@@ -72,13 +72,17 @@ draw_entry :: (app: InnerBreeze*, index: int, x: int, w: int, y: int*) -> int #p
|
||||
app->settings_dirty = 1
|
||||
save_settings(app)
|
||||
}
|
||||
if IconButton((IconButtonProps){
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x + w - del),
|
||||
(float)(*y + (row_h - del) / 2),
|
||||
(float)del, (float)del},
|
||||
.icon = app->icons[UI_ICON_TYPE_X],
|
||||
.icon_size = Scale(14),
|
||||
.icon_padding = Scale(8)
|
||||
.icon_only = 1, .circle = 0,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft,
|
||||
.style = {.normal = {
|
||||
.fields = StyleIconSize,
|
||||
.icon_size = (float)(Scale(14)) * 1000.0f / Scale(1000)
|
||||
}}
|
||||
}) {
|
||||
remove_reminder(app, index)
|
||||
return 1
|
||||
@@ -182,8 +186,8 @@ handle_overlays :: (app: InnerBreeze*) {
|
||||
}
|
||||
|
||||
draw :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
test_hover := 0
|
||||
add_hover := 0
|
||||
|
||||
|
||||
friend_toggle := 0
|
||||
i := 0
|
||||
|
||||
@@ -192,7 +196,7 @@ draw :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
}
|
||||
|
||||
#if ANDROID {
|
||||
push_hover := 0
|
||||
|
||||
|
||||
Text((TextProps){
|
||||
.bounds={(x), (*y), 0, 0},
|
||||
@@ -220,9 +224,14 @@ draw :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
})
|
||||
}
|
||||
*y += Scale(44)
|
||||
if StyledButton(x, *y, w, Scale(34),
|
||||
GetLocaleText("notifications_push_setup"),
|
||||
ButtonStyleSecondary, 0, &push_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(Scale(34))},
|
||||
.label = GetLocaleText("notifications_push_setup"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
platform_android_push_refresh_distributors(app)
|
||||
if app->push_distributor_count > 0 {
|
||||
app->push_picker_open = 1
|
||||
@@ -256,9 +265,14 @@ draw :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
}
|
||||
*y += Scale(16)
|
||||
|
||||
if StyledButton(x, *y, w, Scale(34),
|
||||
GetLocaleText("notifications_test"),
|
||||
ButtonStyleSecondary, 0, &test_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(Scale(34))},
|
||||
.label = GetLocaleText("notifications_test"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
app_notifications_send_test_notification(app)
|
||||
}
|
||||
*y += Scale(50)
|
||||
@@ -279,9 +293,14 @@ draw :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
}
|
||||
|
||||
if app->reminder_count < APP_REMINDER_MAX {
|
||||
if StyledButton(x, *y, w, Scale(34),
|
||||
GetLocaleText("reminder_add"),
|
||||
ButtonStyleSecondary, 0, &add_hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(Scale(34))},
|
||||
.label = GetLocaleText("reminder_add"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
r: AppReminder* = &app->reminders[app->reminder_count]
|
||||
r->practice = 0
|
||||
r->hour = 8
|
||||
|
||||
@@ -265,8 +265,6 @@ settings_mobile_hub_row :: (app: InnerBreeze*, row: SettingsMobileHubRow,
|
||||
x: int, y: int, w: int, id: int) -> int #private {
|
||||
h := Scale(56)
|
||||
bounds := (Rectangle){(float)x, (float)y, (float)w, (float)h}
|
||||
mouse := GetMousePosition()
|
||||
hover := CheckCollisionPointRec(mouse, bounds) && !UIInputCapturesClick(mouse)
|
||||
icon_size := Scale(24)
|
||||
icon_x := x + Scale(14)
|
||||
text_x := icon_x + icon_size + Scale(14)
|
||||
@@ -274,11 +272,12 @@ settings_mobile_hub_row :: (app: InnerBreeze*, row: SettingsMobileHubRow,
|
||||
value_w := TextWidth(row.value, Text14)
|
||||
title_w := w - (text_x - x) - value_w - chevron_w - Scale(30)
|
||||
|
||||
DrawRectangleRounded(bounds, 0.05f, 10,
|
||||
hover ? Fade(GetThemeSurface(), 0.34f)
|
||||
: Fade(GetThemeSurface(), 0.14f))
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.05f, 10, 1.0f,
|
||||
Fade(GetThemeText(), hover ? 0.13f : 0.06f))
|
||||
clicked := Button((ButtonProps){
|
||||
.bounds = bounds, .id = id,
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = app->modal.active
|
||||
})
|
||||
Icon(0, icon_x, y + (h - icon_size) / 2, icon_size,
|
||||
row.icon, LightenUIColor(GetThemeButtonHover(), 54))
|
||||
Text((TextProps){
|
||||
@@ -310,7 +309,7 @@ settings_mobile_hub_row :: (app: InnerBreeze*, row: SettingsMobileHubRow,
|
||||
.color=(Fade(GetThemeText(), 0.66f)),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if InvisibleButton((InvisibleButtonProps){.bounds = bounds, .id = id}) {
|
||||
if clicked {
|
||||
if row.route != APP_NAV_ROUTE_NONE {
|
||||
app_apply_nav_route(app, row.route)
|
||||
} else {
|
||||
@@ -329,18 +328,17 @@ settings_mobile_profile_strip :: (app: InnerBreeze*, x: int, y: int, w: int) ->
|
||||
h := Scale(76)
|
||||
avatar := Scale(52)
|
||||
bounds := (Rectangle){(float)x, (float)y, (float)w, (float)h}
|
||||
mouse := GetMousePosition()
|
||||
hover := CheckCollisionPointRec(mouse, bounds) && !UIInputCapturesClick(mouse)
|
||||
avatar_x := x + Scale(12)
|
||||
avatar_y := y + (h - avatar) / 2
|
||||
text_x := avatar_x + avatar + Scale(14)
|
||||
|
||||
app_nav_profile_identity(app, label, sizeof(label), subtitle, sizeof(subtitle))
|
||||
DrawRectangleRounded(bounds, 0.06f, 10,
|
||||
hover ? Fade(GetThemeSurface(), 0.36f)
|
||||
: Fade(GetThemeSurface(), 0.18f))
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.06f, 10, 1.0f,
|
||||
Fade(GetThemeText(), hover ? 0.14f : 0.07f))
|
||||
clicked := Button((ButtonProps){
|
||||
.bounds = bounds, .id = 7350,
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = app->modal.active
|
||||
})
|
||||
DrawCircle(avatar_x + avatar / 2, avatar_y + avatar / 2, avatar / 2,
|
||||
LightenUIColor(GetThemeButton(), 30))
|
||||
DrawTexturePro(app->icons[app->profile_picture_icon],
|
||||
@@ -368,7 +366,7 @@ settings_mobile_profile_strip :: (app: InnerBreeze*, x: int, y: int, w: int) ->
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
}
|
||||
if InvisibleButton((InvisibleButtonProps){.bounds = bounds, .id = 7350}) {
|
||||
if clicked {
|
||||
app_apply_nav_route(app, APP_NAV_ROUTE_PROFILE)
|
||||
return 1
|
||||
}
|
||||
@@ -468,13 +466,7 @@ settings_draw_tab_content :: (app: InnerBreeze*, tab: int, x: int, w: int,
|
||||
settings_desktop_category_button :: (app: InnerBreeze*, tab: int, x: int, y: int,
|
||||
w: int, h: int, id: int) -> int #private {
|
||||
active := app != NULL && app->settings_tab == tab
|
||||
mouse := GetMousePosition()
|
||||
bounds := (Rectangle){(float)x, (float)y, (float)w, (float)h}
|
||||
hover := CheckCollisionPointRec(mouse, bounds) && !UIInputCapturesClick(mouse)
|
||||
fill := active ? Fade(GetThemeButton(), 0.38f) :
|
||||
(hover ? Fade(GetThemeSurface(), 0.58f) : Fade(GetThemeSurface(), 0.10f))
|
||||
border := active ? Fade(GetThemeButtonHover(), 0.52f) :
|
||||
Fade(GetThemeText(), hover ? 0.12f : 0.04f)
|
||||
text_color := active ? WHITE : GetThemeText()
|
||||
icon_color := active ? LightenUIColor(GetThemeButtonHover(), 64) : GetThemeText()
|
||||
subtitle_color := active ? Fade(WHITE, 0.72f) : Fade(GetThemeText(), 0.62f)
|
||||
@@ -484,8 +476,13 @@ settings_desktop_category_button :: (app: InnerBreeze*, tab: int, x: int, y: int
|
||||
title_y := y + Scale(16)
|
||||
subtitle_y := y + Scale(40)
|
||||
|
||||
DrawRectangleRounded(bounds, 0.055f, 10, fill)
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.055f, 10, 1.0f, border)
|
||||
clicked := Button((ButtonProps){
|
||||
.bounds = bounds, .id = id,
|
||||
.tone = active ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.selected = active,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = app->modal.active
|
||||
})
|
||||
Icon(0, icon_x, y + (h - icon_size) / 2, icon_size,
|
||||
tab == SETTINGS_TAB_ABOUT ? UI_ICON_TYPE_TEXT :
|
||||
tab == SETTINGS_TAB_AUDIO ? UI_ICON_TYPE_SOUND :
|
||||
@@ -512,7 +509,7 @@ settings_desktop_category_button :: (app: InnerBreeze*, tab: int, x: int, y: int
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
}
|
||||
if InvisibleButton((InvisibleButtonProps){.bounds = bounds, .id = id}) {
|
||||
if clicked {
|
||||
if app != NULL && app->settings_tab != tab {
|
||||
app->settings_tab = tab
|
||||
app->settings_scroll = 0
|
||||
|
||||
@@ -639,7 +639,7 @@ draw :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
small_font := GetSmallFontSize()
|
||||
btn_h := Scale(36)
|
||||
gap := Scale(10)
|
||||
hover := 0
|
||||
|
||||
|
||||
Text((TextProps){
|
||||
.bounds={(x), (*y), 0, 0},
|
||||
@@ -651,9 +651,14 @@ draw :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
*y += Scale(26)
|
||||
|
||||
if !has_account {
|
||||
if StyledButton(x, *y, w, btn_h,
|
||||
GetLocaleText("sync_create_account_button"),
|
||||
ButtonStylePrimary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(btn_h)},
|
||||
.label = GetLocaleText("sync_create_account_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
create_account(app, &account)
|
||||
}
|
||||
*y += btn_h + Scale(18)
|
||||
@@ -707,7 +712,7 @@ draw_config :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
small_font := GetSmallFontSize()
|
||||
btn_h := Scale(36)
|
||||
gap := Scale(10)
|
||||
hover := 0
|
||||
|
||||
commit := 0
|
||||
input_style := text_style()
|
||||
|
||||
@@ -794,11 +799,16 @@ draw_config :: (app: InnerBreeze*, x: int, w: int, y: int*) {
|
||||
}
|
||||
*y += btn_h + Scale(12)
|
||||
|
||||
if StyledButton(x, *y, w, btn_h,
|
||||
server_connected(app)
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(btn_h)},
|
||||
.label = server_connected(app)
|
||||
? GetLocaleText("sync_connected_button")
|
||||
: GetLocaleText("sync_connect_button"),
|
||||
ButtonStylePrimary, 0, &hover) {
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
run_connect(app)
|
||||
}
|
||||
*y += btn_h + Scale(12)
|
||||
@@ -864,7 +874,7 @@ draw_backup_modal :: (app: InnerBreeze*) -> int {
|
||||
gap := Scale(10)
|
||||
pad_bottom := Scale(24)
|
||||
text_button_gap := Scale(40)
|
||||
hover := 0
|
||||
|
||||
y: int
|
||||
modal_h: int
|
||||
button_y: int
|
||||
@@ -897,15 +907,24 @@ draw_backup_modal :: (app: InnerBreeze*) -> int {
|
||||
if button_y + btn_h * 2 + gap + pad_bottom > frame.y + frame.h {
|
||||
button_y = frame.y + frame.h - pad_bottom - btn_h * 2 - gap
|
||||
}
|
||||
if StyledButton(frame.content_x, button_y, frame.content_w, btn_h,
|
||||
GetLocaleText("sync_save_key_file_button"),
|
||||
ButtonStylePrimary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(frame.content_x), (float)(button_y), (float)(frame.content_w), (float)(btn_h)},
|
||||
.label = GetLocaleText("sync_save_key_file_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
return start_sync_key_export(app, &account)
|
||||
}
|
||||
if StyledButton(frame.content_x, button_y + btn_h + gap,
|
||||
frame.content_w, btn_h,
|
||||
GetLocaleText("close_button"),
|
||||
ButtonStyleSecondary, 0, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(frame.content_x), (float)(button_y + btn_h + gap), (float)(frame.content_w), (float)(btn_h)},
|
||||
.label = GetLocaleText("close_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -990,14 +1009,14 @@ draw_alias_modal :: (app: InnerBreeze*) -> int {
|
||||
buttons: [2] ButtonRowItem = {
|
||||
{
|
||||
GetLocaleText(app->sync_alias_then_backup ? "skip_button" : "close_button"),
|
||||
ButtonStyleSecondary,
|
||||
ButtonToneNeutral,
|
||||
0,
|
||||
},
|
||||
{
|
||||
GetLocaleText(has_alias
|
||||
? "sync_alias_save_button"
|
||||
: "sync_alias_register_button"),
|
||||
ButtonStylePrimary,
|
||||
ButtonToneAccent,
|
||||
!alias_valid(app->sync_alias_input) || unchanged_alias,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -62,9 +62,14 @@ draw :: (app: InnerBreeze*, x: int, w: int, y: int*, state: SettingsThemeState*)
|
||||
*y += GetNodeHeight(NodeThemeSettings(settings))
|
||||
*y += Scale(24)
|
||||
|
||||
hover := 0
|
||||
if StyledButton(x, *y, w, Scale(44), GetLocaleText("customize_nav_button"),
|
||||
ButtonStylePrimary, app->modal.active, &hover) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(*y), (float)(w), (float)(Scale(44))},
|
||||
.label = GetLocaleText("customize_nav_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = app->modal.active
|
||||
}) {
|
||||
app_open_customize_nav(app)
|
||||
}
|
||||
*y += Scale(58)
|
||||
@@ -80,12 +85,17 @@ draw_scale_row :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
step_y := *y + Scale(28) - Scale(14)
|
||||
slider_x := x + step_w + step_gap
|
||||
slider_w := w - (step_w + step_gap) * 2
|
||||
minus_hover := 0
|
||||
plus_hover := 0
|
||||
|
||||
|
||||
step_changed := 0
|
||||
slider_changed := 0
|
||||
snprintf(scale_text, sizeof(scale_text), "%.1fx", effective)
|
||||
if TextButton(141, x + step_w / 2, step_y, "-", &minus_hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 141, .label = "-", .font = GetFontSize(),
|
||||
.bounds = {(x + step_w / 2) - fmaxf(TextWidth("-", GetFontSize()) + Scale(16), Scale(34)) / 2.0f,
|
||||
(float)(step_y), fmaxf(TextWidth("-", GetFontSize()) + Scale(16), Scale(34)), fmaxf(TextLineHeight(GetFontSize()) + Scale(8), Scale(34))},
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
if scale_value > 5 {
|
||||
scale_value = scale_value - 1
|
||||
step_changed = 1
|
||||
@@ -110,7 +120,12 @@ draw_scale_row :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
}
|
||||
}
|
||||
if slider_w < w {
|
||||
if TextButton(142, x + w - step_w / 2, step_y, "+", &plus_hover) {
|
||||
if Button((ButtonProps){
|
||||
.id = 142, .label = "+", .font = GetFontSize(),
|
||||
.bounds = {(x + w - step_w / 2) - fmaxf(TextWidth("+", GetFontSize()) + Scale(16), Scale(34)) / 2.0f,
|
||||
(float)(step_y), fmaxf(TextWidth("+", GetFontSize()) + Scale(16), Scale(34)), fmaxf(TextLineHeight(GetFontSize()) + Scale(8), Scale(34))},
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
if scale_value < 25 {
|
||||
scale_value = scale_value + 1
|
||||
step_changed = 1
|
||||
|
||||
@@ -11,33 +11,7 @@ toggle_switch_width :: () -> int {
|
||||
}
|
||||
|
||||
toggle_switch :: (id: int, x: int, y: int, value: int*) -> int {
|
||||
w := toggle_switch_width()
|
||||
h := Scale(28)
|
||||
knob := Scale(22)
|
||||
pad := (h - knob) / 2
|
||||
on := value != NULL && *value != 0
|
||||
bounds := (Rectangle){(float)x, (float)y, (float)w, (float)h}
|
||||
hot := CheckCollisionPointRec(GetMousePosition(), bounds) &&
|
||||
!UIInputCapturesClick(GetMousePosition())
|
||||
fill := on ? LightenUIColor(GetThemeButton(), 18) : DarkenUIColor(GetThemeBackground(), 10)
|
||||
border := on ? Fade(GetThemeButtonHover(), 0.82f) : Fade(GetThemeText(), 0.16f)
|
||||
knob_x := x + (on ? w - knob - pad : pad)
|
||||
|
||||
if hot {
|
||||
fill = on ? LightenUIColor(fill, 12) : LightenUIColor(fill, 8)
|
||||
border = on ? GetThemeButtonHover() : Fade(GetThemeText(), 0.28f)
|
||||
}
|
||||
DrawRectangleRounded(bounds, 0.5f, 16, fill)
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.5f, 16, 1.0f, border)
|
||||
DrawCircle(knob_x + knob / 2, y + h / 2, knob / 2,
|
||||
on ? WHITE : Fade(GetThemeText(), 0.72f))
|
||||
if InvisibleButton((InvisibleButtonProps){.bounds = bounds, .id = id}) {
|
||||
if value != NULL {
|
||||
*value = !*value
|
||||
return 1
|
||||
}
|
||||
}
|
||||
return 0
|
||||
return Toggle(id, x, y, toggle_switch_width(), Scale(28), value, "", "")
|
||||
}
|
||||
|
||||
toggle_row_height :: (label: const char*, w: int) -> int {
|
||||
|
||||
@@ -259,46 +259,21 @@ statistics_draw_hold_range_selector :: (app: InnerBreeze*, x: int, y: int, w: in
|
||||
h := Scale(34)
|
||||
segment_w := w / 2
|
||||
clicked := 0
|
||||
mouse_world := GetScreenToWorld2D(GetMousePosition(), app->camera)
|
||||
|
||||
for int i = 0; i < 2; i++ {
|
||||
segment_x := x + i * segment_w
|
||||
current_w := i == 1 ? x + w - segment_x : segment_w
|
||||
rect := (Rectangle){segment_x, y, current_w, h}
|
||||
active_hit := CheckCollisionPointRec(mouse_world, rect) && !UIInputCapturesClick(mouse_world)
|
||||
hovered := active_hit && UIHoverEffectsEnabled()
|
||||
active := i == selected
|
||||
fill := active ? GetThemeButton() : DarkenUIColor(GetThemeBackground(), 10)
|
||||
top := LightenUIColor(fill, 35)
|
||||
bottom := DarkenUIColor(fill, 45)
|
||||
font := GetFontSize()
|
||||
text_w := 0
|
||||
|
||||
if active_hit {
|
||||
MarkUIClickable()
|
||||
if hovered && !active {
|
||||
fill = GetThemeButtonHover()
|
||||
top = DarkenUIColor(GetThemeButtonHover(), 40)
|
||||
bottom = LightenUIColor(GetThemeButtonHover(), 40)
|
||||
}
|
||||
}
|
||||
|
||||
DrawRectangle(segment_x, y, current_w, h, fill)
|
||||
Bevel(segment_x, y, current_w, h, top, bottom)
|
||||
text_w = TextWidth(labels[i], font)
|
||||
Text((TextProps){
|
||||
.bounds={(segment_x + (current_w - text_w) / 2), (GetUIControlTextY(labels[i], y, h, font)), 0, 0},
|
||||
.text=(labels[i]),
|
||||
.font=(font),
|
||||
.color=(GetThemeText()),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if active_hit && IsMouseButtonReleased(MOUSE_BUTTON_LEFT) && !UIInputCapturesClick(mouse_world) && selected != i {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)segment_x, (float)y, (float)current_w, (float)h},
|
||||
.id = 24700 + i, .label = labels[i], .font = GetFontSize(),
|
||||
.tone = i == selected ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft, .selected = i == selected,
|
||||
.disabled = app->modal.active
|
||||
}) && selected != i {
|
||||
app->habits.hold_stats_range_days = values[i]
|
||||
clicked = 1
|
||||
}
|
||||
}
|
||||
|
||||
return clicked
|
||||
}
|
||||
|
||||
|
||||
+35
-51
@@ -112,61 +112,49 @@ desktop_rail_route_label :: (route: int) -> const char* #private {
|
||||
return app_nav_route_label(route)
|
||||
}
|
||||
|
||||
desktop_rail_button :: (app: InnerBreeze*, route: int, rail_x: int, y: int) -> int #private {
|
||||
desktop_rail_button :: (app: InnerBreeze*, route: int, rail_x: int, y: int, item_h: int) -> int #private {
|
||||
rail_w := app_nav_desktop_rail_width()
|
||||
margin := Scale(6)
|
||||
item_w := rail_w - margin * 2
|
||||
item_h := Scale(106)
|
||||
icon_size := Scale(42)
|
||||
if item_h < Scale(106) {
|
||||
icon_size = Scale(32)
|
||||
}
|
||||
icon := bottom_nav_route_icon(app, route)
|
||||
label := desktop_rail_route_label(route)
|
||||
mouse := GetScreenToWorld2D(GetMousePosition(), app->camera)
|
||||
bounds := (Rectangle){(float)(rail_x + margin), (float)y, (float)item_w, (float)item_h}
|
||||
active := desktop_rail_route_active(app, route)
|
||||
hover := CheckCollisionPointRec(mouse, bounds)
|
||||
fill := Fade(GetThemeSurface(), 0.0f)
|
||||
border := Fade(GetThemeText(), 0.0f)
|
||||
tint := Fade(GetThemeText(), 0.82f)
|
||||
label_font := Text18
|
||||
label_w := TextWidth(label, label_font)
|
||||
icon_x := rail_x + margin + (item_w - icon_size) / 2
|
||||
icon_y := y + Scale(23)
|
||||
|
||||
if active {
|
||||
fill = Fade(GetThemeButton(), 0.34f)
|
||||
border = Fade(GetThemeButtonHover(), 0.88f)
|
||||
tint = GetThemeText()
|
||||
} else if hover {
|
||||
fill = Fade(GetThemeSurface(), 0.46f)
|
||||
border = Fade(GetThemeText(), 0.24f)
|
||||
tint = GetThemeText()
|
||||
if item_h < Scale(106) {
|
||||
icon_y = y + Scale(8)
|
||||
}
|
||||
|
||||
if active || hover {
|
||||
DrawRectangleRounded(bounds, 0.07f, 10, fill)
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.07f, 10,
|
||||
active ? 2.0f : 1.0f, border)
|
||||
}
|
||||
clicked := Button((ButtonProps){
|
||||
.bounds = bounds, .id = 6600 + route,
|
||||
.tone = active ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = active ? ButtonEmphasisSoft : ButtonEmphasisGhost,
|
||||
.selected = active, .disabled = app->modal.active
|
||||
})
|
||||
bottom_nav_draw_icon(icon,
|
||||
(Rectangle){(float)icon_x, (float)icon_y,
|
||||
(float)icon_size, (float)icon_size},
|
||||
tint)
|
||||
Text((TextProps){
|
||||
.bounds = {(float)(rail_x + margin + (item_w - label_w) / 2),
|
||||
(float)(y + Scale(70)), 0, 0},
|
||||
(float)(icon_y + icon_size + Scale(5)), 0, 0},
|
||||
.text = label,
|
||||
.font = label_font,
|
||||
.color = tint,
|
||||
.wrap = TextWrapNone
|
||||
})
|
||||
|
||||
if hover {
|
||||
MarkUIClickable()
|
||||
if !app->modal.active && IsMouseButtonReleased(MOUSE_BUTTON_LEFT) {
|
||||
UIConsumeRelease()
|
||||
app_apply_nav_route(app, route)
|
||||
return 1
|
||||
}
|
||||
if clicked {
|
||||
app_apply_nav_route(app, route)
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
@@ -181,16 +169,10 @@ desktop_rail_profile_button :: (app: InnerBreeze*, rail_x: int, y: int,
|
||||
avatar_y: int
|
||||
label: [96] char
|
||||
subtitle: [96] char
|
||||
mouse := GetScreenToWorld2D(GetMousePosition(), app->camera)
|
||||
bounds := (Rectangle){(float)(rail_x + margin), (float)y,
|
||||
(float)item_w, (float)item_h}
|
||||
active := app != NULL && app->breathing.screen == ScreenProfile &&
|
||||
app->profile_view == PROFILE_VIEW_MAIN
|
||||
hover := CheckCollisionPointRec(mouse, bounds)
|
||||
fill := active ? Fade(GetThemeButton(), 0.26f) :
|
||||
(hover ? Fade(GetThemeSurface(), 0.34f) : Fade(GetThemeSurface(), 0.0f))
|
||||
border := active ? Fade(GetThemeButtonHover(), 0.72f) :
|
||||
(hover ? Fade(GetThemeText(), 0.18f) : Fade(GetThemeText(), 0.0f))
|
||||
tint := GetThemeText()
|
||||
label_font := Text14
|
||||
sub_font := Text12
|
||||
@@ -225,11 +207,12 @@ desktop_rail_profile_button :: (app: InnerBreeze*, rail_x: int, y: int,
|
||||
label_y = avatar_y + avatar_size + label_gap
|
||||
sub_y = label_y + label_h + sub_gap
|
||||
|
||||
if active || hover {
|
||||
DrawRectangleRounded(bounds, 0.07f, 10, fill)
|
||||
DrawRectangleRoundedLinesEx(bounds, 0.07f, 10,
|
||||
active ? 2.0f : 1.0f, border)
|
||||
}
|
||||
clicked := Button((ButtonProps){
|
||||
.bounds = bounds, .id = 6690,
|
||||
.tone = active ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = active ? ButtonEmphasisSoft : ButtonEmphasisGhost,
|
||||
.selected = active, .disabled = app->modal.active
|
||||
})
|
||||
DrawCircle(rail_x + rail_w / 2, avatar_y + avatar_size / 2,
|
||||
avatar_size / 2, LightenUIColor(GetThemeButton(), 30))
|
||||
bottom_nav_draw_icon(app->icons[app->profile_picture_icon],
|
||||
@@ -257,13 +240,9 @@ desktop_rail_profile_button :: (app: InnerBreeze*, rail_x: int, y: int,
|
||||
})
|
||||
}
|
||||
|
||||
if hover {
|
||||
MarkUIClickable()
|
||||
if !app->modal.active && IsMouseButtonReleased(MOUSE_BUTTON_LEFT) {
|
||||
UIConsumeRelease()
|
||||
app_apply_nav_route(app, APP_NAV_ROUTE_PROFILE)
|
||||
return 1
|
||||
}
|
||||
if clicked {
|
||||
app_apply_nav_route(app, APP_NAV_ROUTE_PROFILE)
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
}
|
||||
@@ -274,7 +253,12 @@ app_draw_desktop_nav_rail :: (app: InnerBreeze*) #private {
|
||||
route_y := Scale(210)
|
||||
gap := Scale(18)
|
||||
footer_y := view_height - Scale(116)
|
||||
routes: [2] int = {
|
||||
item_h := (footer_y - route_y - gap * 2) / 3
|
||||
if item_h > Scale(106) {
|
||||
item_h = Scale(106)
|
||||
}
|
||||
routes: [3] int = {
|
||||
APP_NAV_ROUTE_ELIST,
|
||||
APP_NAV_ROUTE_HABITS,
|
||||
APP_NAV_ROUTE_PRACTICE
|
||||
}
|
||||
@@ -292,14 +276,14 @@ app_draw_desktop_nav_rail :: (app: InnerBreeze*) #private {
|
||||
return
|
||||
}
|
||||
|
||||
for int i = 0; i < 2; i++ {
|
||||
if desktop_rail_button(app, routes[i], rail_x, route_y) {
|
||||
for int i = 0; i < 3; i++ {
|
||||
if desktop_rail_button(app, routes[i], rail_x, route_y, item_h) {
|
||||
return
|
||||
}
|
||||
route_y += Scale(104) + gap
|
||||
route_y += item_h + gap
|
||||
}
|
||||
|
||||
desktop_rail_button(app, APP_NAV_ROUTE_SETTINGS, rail_x, footer_y)
|
||||
desktop_rail_button(app, APP_NAV_ROUTE_SETTINGS, rail_x, footer_y, Scale(106))
|
||||
}
|
||||
|
||||
app_draw_bottom_nav :: (app: InnerBreeze*) {
|
||||
|
||||
+115
-46
@@ -12,6 +12,8 @@ int view_width = 320;
|
||||
int view_height = 560;
|
||||
|
||||
static int failures = 0;
|
||||
static int desktop_mode = 0;
|
||||
static int elist_label_count = 0;
|
||||
static int mouse_released = 0;
|
||||
static int bottom_nav_draw_count = 0;
|
||||
static int bottom_nav_clicked_route = APP_NAV_ROUTE_NONE;
|
||||
@@ -22,8 +24,8 @@ static int reset_settings_preview_count = 0;
|
||||
static int settings_status_clear_count = 0;
|
||||
static const char *generic_button_clicked_label = NULL;
|
||||
static int invisible_button_clicked_id = -1;
|
||||
static int padded_icon_click_index = -1;
|
||||
static int padded_icon_draw_count = 0;
|
||||
static int icon_button_click_index = -1;
|
||||
static int icon_button_draw_count = 0;
|
||||
static int scroll_page_content_w_override = 0;
|
||||
static int pointer_release_consumed = 0;
|
||||
static Vector2 mouse_position = {0};
|
||||
@@ -42,6 +44,8 @@ expect(int condition, const char *message)
|
||||
static void
|
||||
reset_state(void)
|
||||
{
|
||||
desktop_mode = 0;
|
||||
elist_label_count = 0;
|
||||
mouse_released = 0;
|
||||
bottom_nav_draw_count = 0;
|
||||
bottom_nav_clicked_route = APP_NAV_ROUTE_NONE;
|
||||
@@ -52,8 +56,8 @@ reset_state(void)
|
||||
settings_status_clear_count = 0;
|
||||
generic_button_clicked_label = NULL;
|
||||
invisible_button_clicked_id = -1;
|
||||
padded_icon_click_index = -1;
|
||||
padded_icon_draw_count = 0;
|
||||
icon_button_click_index = -1;
|
||||
icon_button_draw_count = 0;
|
||||
scroll_page_content_w_override = 0;
|
||||
pointer_release_consumed = 0;
|
||||
mouse_position = (Vector2){0};
|
||||
@@ -302,7 +306,9 @@ void TestText(TextProps props) __asm__("Text");
|
||||
void
|
||||
TestText(TextProps props)
|
||||
{
|
||||
(void)props;
|
||||
if(props.text != NULL && strcmp(props.text, "tab_elist") == 0) {
|
||||
elist_label_count++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@@ -377,7 +383,7 @@ IsMouseButtonPressed(int button)
|
||||
int
|
||||
IsUIDesktopMode(void)
|
||||
{
|
||||
return 0;
|
||||
return desktop_mode;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -458,21 +464,28 @@ EndUIScrollContainer(UIScrollArea area, UIScrollView view)
|
||||
}
|
||||
|
||||
int
|
||||
StyledButton(int x, int y, int w, int h, const char *label,
|
||||
ButtonStyle style, int disabled, int *hover)
|
||||
Button(ButtonProps props)
|
||||
{
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)w;
|
||||
(void)h;
|
||||
(void)style;
|
||||
if(hover != NULL)
|
||||
*hover = 0;
|
||||
if(!disabled && generic_button_clicked_label != NULL &&
|
||||
label != NULL && strcmp(label, generic_button_clicked_label) == 0) {
|
||||
if(props.disabled)
|
||||
return 0;
|
||||
if(props.icon_only && icon_button_draw_count++ == icon_button_click_index) {
|
||||
icon_button_click_index = -1;
|
||||
return 1;
|
||||
}
|
||||
if((int)props.id == invisible_button_clicked_id) {
|
||||
invisible_button_clicked_id = -1;
|
||||
return 1;
|
||||
}
|
||||
if(generic_button_clicked_label != NULL && props.label != NULL &&
|
||||
strcmp(props.label, generic_button_clicked_label) == 0) {
|
||||
generic_button_clicked_label = NULL;
|
||||
return 1;
|
||||
}
|
||||
if(mouse_released && !pointer_release_consumed &&
|
||||
CheckCollisionPointRec(mouse_position, props.bounds)) {
|
||||
UIConsumeRelease();
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -635,25 +648,6 @@ SetUIDropdownClipBottom(int y)
|
||||
(void)y;
|
||||
}
|
||||
|
||||
int
|
||||
PaddedIconBtn(int id, int x, int y, int size, int padding,
|
||||
Texture2D icon, int *hover)
|
||||
{
|
||||
(void)id;
|
||||
(void)x;
|
||||
(void)y;
|
||||
(void)size;
|
||||
(void)padding;
|
||||
(void)icon;
|
||||
if(hover != NULL)
|
||||
*hover = 0;
|
||||
if(padded_icon_draw_count++ == padded_icon_click_index) {
|
||||
padded_icon_click_index = -1;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
Icon(int id, int x, int y, int size, UIIconType icon, Color tint)
|
||||
{
|
||||
@@ -875,10 +869,10 @@ test_default_bottom_nav_routes_include_elist(void)
|
||||
"default bottom nav should draw");
|
||||
expect(bottom_nav_last.count == 4,
|
||||
"default bottom nav should have four items");
|
||||
expect(bottom_nav_last.items[0].route == APP_NAV_ROUTE_HABITS,
|
||||
"default first bottom nav item should be habits");
|
||||
expect(bottom_nav_last.items[1].route == APP_NAV_ROUTE_ELIST,
|
||||
"default second bottom nav item should be EList");
|
||||
expect(bottom_nav_last.items[0].route == APP_NAV_ROUTE_ELIST,
|
||||
"default first bottom nav item should be EList");
|
||||
expect(bottom_nav_last.items[1].route == APP_NAV_ROUTE_HABITS,
|
||||
"default second bottom nav item should be habits");
|
||||
expect(bottom_nav_last.items[2].route == APP_NAV_ROUTE_PRACTICE,
|
||||
"default third bottom nav item should be practice");
|
||||
expect(bottom_nav_last.items[3].route == APP_NAV_ROUTE_SETTINGS,
|
||||
@@ -961,10 +955,10 @@ test_profile_draws_mobile_nav_without_profile_item(void)
|
||||
"profile should keep mobile bottom nav available");
|
||||
expect(bottom_nav_last.count == 4,
|
||||
"profile mobile bottom nav should have four items");
|
||||
expect(bottom_nav_last.items[0].route == APP_NAV_ROUTE_HABITS,
|
||||
"profile mobile nav first item should be habits");
|
||||
expect(bottom_nav_last.items[1].route == APP_NAV_ROUTE_ELIST,
|
||||
"profile mobile nav second item should be EList");
|
||||
expect(bottom_nav_last.items[0].route == APP_NAV_ROUTE_ELIST,
|
||||
"profile mobile nav first item should be EList");
|
||||
expect(bottom_nav_last.items[1].route == APP_NAV_ROUTE_HABITS,
|
||||
"profile mobile nav second item should be habits");
|
||||
expect(bottom_nav_last.items[2].route == APP_NAV_ROUTE_PRACTICE,
|
||||
"profile mobile nav third item should be practice");
|
||||
expect(bottom_nav_last.items[3].route == APP_NAV_ROUTE_SETTINGS,
|
||||
@@ -1076,7 +1070,7 @@ test_customize_nav_delete_last_does_not_add_same_frame(void)
|
||||
app.bottom_nav_routes[0] = APP_NAV_ROUTE_HABITS;
|
||||
app.bottom_nav_config_route_count = 1;
|
||||
app.bottom_nav_config_routes[0] = APP_NAV_ROUTE_HABITS;
|
||||
padded_icon_click_index = 0;
|
||||
icon_button_click_index = 0;
|
||||
generic_button_clicked_label = "customize_nav_add";
|
||||
|
||||
app_draw_customize_nav_page(&app);
|
||||
@@ -1106,7 +1100,7 @@ test_customize_nav_delete_icon_draws_on_narrow_rows(void)
|
||||
|
||||
app_draw_customize_nav_page(&app);
|
||||
|
||||
expect(padded_icon_draw_count == 1,
|
||||
expect(icon_button_draw_count == 1,
|
||||
"customize nav should draw delete icon on narrow rows");
|
||||
}
|
||||
|
||||
@@ -1260,6 +1254,79 @@ test_sidebar_screen_closes_when_width_expands(void)
|
||||
"expanded sidebar should return to home screen");
|
||||
}
|
||||
|
||||
static void
|
||||
test_habit_editor_preserves_desktop_rail(void)
|
||||
{
|
||||
InnerBreeze app = {0};
|
||||
|
||||
reset_state();
|
||||
desktop_mode = 1;
|
||||
app.breathing.screen = ScreenHabits;
|
||||
expect(app_nav_desktop_rail_enabled(&app), "habits should show desktop rail");
|
||||
app.breathing.screen = ScreenHabitEdit;
|
||||
app.habit_edit.active = 1;
|
||||
for(int is_new = 0; is_new <= 1; is_new++) {
|
||||
app.habit_edit.is_new = is_new;
|
||||
expect(app_nav_desktop_rail_enabled(&app),
|
||||
"new and edit habit should retain desktop rail");
|
||||
expect(app_content_bottom_reserved(&app) == 0,
|
||||
"desktop habit editor should not reserve mobile navigation");
|
||||
}
|
||||
desktop_mode = 0;
|
||||
expect(!app_nav_desktop_rail_enabled(&app),
|
||||
"mobile habit editor must not gain a desktop rail");
|
||||
desktop_mode = 1;
|
||||
app.file_dialog_active = 1;
|
||||
expect(!app_nav_desktop_rail_enabled(&app),
|
||||
"file dialog should still hide desktop rail");
|
||||
app.file_dialog_active = 0;
|
||||
app.breathing.screen = ScreenHabitSessionEdit;
|
||||
expect(!app_nav_desktop_rail_enabled(&app),
|
||||
"session editor should retain its fullscreen behavior");
|
||||
reset_state();
|
||||
}
|
||||
|
||||
static void
|
||||
test_elist_navigation_migration_and_desktop_route(void)
|
||||
{
|
||||
const int old_routes[][4] = {
|
||||
{APP_NAV_ROUTE_HABITS, APP_NAV_ROUTE_PRACTICE, APP_NAV_ROUTE_SETTINGS, 0},
|
||||
{APP_NAV_ROUTE_HABITS, APP_NAV_ROUTE_PRACTICE, APP_NAV_ROUTE_SETTINGS, APP_NAV_ROUTE_ELIST},
|
||||
{APP_NAV_ROUTE_HABITS, APP_NAV_ROUTE_ELIST, APP_NAV_ROUTE_PRACTICE, APP_NAV_ROUTE_SETTINGS}
|
||||
};
|
||||
InnerBreeze app = test_app();
|
||||
|
||||
for(int layout = 0; layout < 3; layout++) {
|
||||
memcpy(app.bottom_nav_routes, old_routes[layout], sizeof(old_routes[layout]));
|
||||
app.bottom_nav_route_count = layout == 0 ? 3 : 4;
|
||||
app_sanitize_bottom_nav_routes(&app);
|
||||
expect(app.bottom_nav_route_count == 4 &&
|
||||
app.bottom_nav_routes[0] == APP_NAV_ROUTE_ELIST &&
|
||||
app.bottom_nav_routes[1] == APP_NAV_ROUTE_HABITS &&
|
||||
app.bottom_nav_routes[2] == APP_NAV_ROUTE_PRACTICE &&
|
||||
app.bottom_nav_routes[3] == APP_NAV_ROUTE_SETTINGS,
|
||||
"old default navigation should migrate to EList first");
|
||||
}
|
||||
app.bottom_nav_routes[0] = APP_NAV_ROUTE_SETTINGS;
|
||||
app.bottom_nav_routes[1] = APP_NAV_ROUTE_ELIST;
|
||||
app.bottom_nav_routes[2] = APP_NAV_ROUTE_HABITS;
|
||||
app.bottom_nav_route_count = 3;
|
||||
app_sanitize_bottom_nav_routes(&app);
|
||||
expect(app.bottom_nav_routes[0] == APP_NAV_ROUTE_SETTINGS,
|
||||
"migration should preserve unrelated custom navigation orders");
|
||||
|
||||
reset_state();
|
||||
desktop_mode = 1;
|
||||
app_draw_bottom_nav(&app);
|
||||
expect(elist_label_count == 1, "desktop rail should display EList");
|
||||
mouse_position = (Vector2){-60, 220};
|
||||
mouse_released = 1;
|
||||
app_draw_bottom_nav(&app);
|
||||
expect(app.main_tab == APP_MAIN_TAB_ELIST && app.breathing.screen == ScreenEList,
|
||||
"first desktop rail item should open EList");
|
||||
reset_state();
|
||||
}
|
||||
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
@@ -1281,6 +1348,8 @@ main(void)
|
||||
test_consumed_pfp_release_does_not_close_sidebar();
|
||||
test_sidebar_child_back_returns_to_compact_sidebar();
|
||||
test_sidebar_screen_closes_when_width_expands();
|
||||
test_habit_editor_preserves_desktop_rail();
|
||||
test_elist_navigation_migration_and_desktop_route();
|
||||
|
||||
if(failures > 0) {
|
||||
fprintf(stderr, "%d app bottom nav test failure(s)\n", failures);
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../build/kryon/generated/src/screens/elist_screen.c"
|
||||
|
||||
int view_width = 768;
|
||||
int view_height = 720;
|
||||
static int focused_id;
|
||||
static int save_succeeds = 1;
|
||||
static int sync_calls;
|
||||
|
||||
void PushUIInspectSource(const char *path, int line)
|
||||
{
|
||||
(void)path;
|
||||
(void)line;
|
||||
}
|
||||
|
||||
void PopUIInspectSource(void)
|
||||
{
|
||||
}
|
||||
|
||||
int Scale(int value)
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
void SetUIFocus(int id)
|
||||
{
|
||||
focused_id = id;
|
||||
}
|
||||
|
||||
int app_auto_sync(InnerBreeze *app)
|
||||
{
|
||||
(void)app;
|
||||
sync_calls++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int storage_elist_create_list(const char *title, char *out_id)
|
||||
{
|
||||
assert(strcmp(title, "Shopping") == 0);
|
||||
if(save_succeeds) {
|
||||
snprintf(out_id, 37, "created-list");
|
||||
}
|
||||
return save_succeeds;
|
||||
}
|
||||
|
||||
int storage_elist_load(void *value)
|
||||
{
|
||||
EListState *state = value;
|
||||
state->list_count = 2;
|
||||
snprintf(state->lists[0].id, sizeof(state->lists[0].id), "old-list");
|
||||
snprintf(state->lists[1].id, sizeof(state->lists[1].id), "created-list");
|
||||
return 1;
|
||||
}
|
||||
|
||||
int storage_elist_update_list(const char *id, const char *title, int order)
|
||||
{
|
||||
(void)id;
|
||||
(void)title;
|
||||
(void)order;
|
||||
return save_succeeds;
|
||||
}
|
||||
|
||||
int storage_elist_create_item(const char *list_id, const char *title,
|
||||
const char *comment, char *out_id)
|
||||
{
|
||||
(void)list_id;
|
||||
(void)title;
|
||||
(void)comment;
|
||||
(void)out_id;
|
||||
return save_succeeds;
|
||||
}
|
||||
|
||||
int storage_elist_update_item(const char *id, const char *title,
|
||||
const char *comment, int done, int order)
|
||||
{
|
||||
(void)id;
|
||||
(void)title;
|
||||
(void)comment;
|
||||
(void)done;
|
||||
(void)order;
|
||||
return save_succeeds;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
InnerBreeze app = {0};
|
||||
Rectangle bounds = elist_content_bounds();
|
||||
assert(bounds.x == 16 && bounds.width == 736);
|
||||
view_width = 360;
|
||||
bounds = elist_content_bounds();
|
||||
assert(bounds.x == 16 && bounds.width == 328);
|
||||
|
||||
elist_begin_input(&app, -2, "Shopping");
|
||||
assert(focused_id == 6501 && app.elist.input_focused);
|
||||
save_succeeds = 0;
|
||||
elist_commit_input(&app);
|
||||
assert(app.elist.input_error && app.elist.editing_item == -2);
|
||||
assert(strcmp(app.elist.input, "Shopping") == 0 && sync_calls == 0);
|
||||
save_succeeds = 1;
|
||||
elist_commit_input(&app);
|
||||
assert(!app.elist.input_error && app.elist.editing_item == -1);
|
||||
assert(app.elist.input[0] == '\0' && app.elist.selected_list == 1);
|
||||
assert(sync_calls == 1);
|
||||
elist_begin_input(&app, 0, "Editing task");
|
||||
snprintf(app.elist.comment_input, sizeof(app.elist.comment_input), "Note");
|
||||
elist_select_list(&app, -1);
|
||||
assert(app.elist.selected_list == 1 && app.elist.editing_item == 0);
|
||||
elist_select_list(&app, 1);
|
||||
assert(strcmp(app.elist.input, "Editing task") == 0);
|
||||
elist_select_list(&app, 0);
|
||||
assert(app.elist.selected_list == 0 && app.elist.editing_item == -1);
|
||||
assert(app.elist.input[0] == '\0' && app.elist.comment_input[0] == '\0');
|
||||
assert(!app.elist.input_focused && focused_id == 0 && sync_calls == 1);
|
||||
puts("Lists layout, creation focus, save failure, and selection tests passed");
|
||||
return 0;
|
||||
}
|
||||
@@ -36,43 +36,29 @@ baseline="$(order)"
|
||||
expect "$baseline" 'Meditation|Yoga|Sit ups|Push ups|Cold Shower|Jumping Rope' 'initial order'
|
||||
import -window "$window" "$test_dir/overview.png"
|
||||
before="$(day_count)"
|
||||
tap 65 438
|
||||
# The current focus layout starts with Meditation expanded and Yoga collapsed.
|
||||
tap 160 520
|
||||
expect "$(sql "SELECT name FROM habits WHERE id=(SELECT value FROM settings WHERE key='habits_selected_id')")" 'Yoga' 'collapsed card opens correct habit'
|
||||
import -window "$window" "$test_dir/yoga-expanded.png"
|
||||
# Yoga is now the second card: the first collapsed card occupies 152 units.
|
||||
tap 50 508
|
||||
expect "$(day_count)" "$((before+1))" 'today check-in'
|
||||
expect "$(sql "SELECT local_date FROM habit_days WHERE habit_id=(SELECT id FROM habits WHERE name='Yoga') AND completed=1")" "$(date +%Y%m%d)" 'leftmost circle marks today'
|
||||
tap 65 438
|
||||
tap 50 508
|
||||
expect "$(day_count)" "$before" 'today undo'
|
||||
tap 149 438
|
||||
tap 99 508
|
||||
expect "$(day_count)" "$((before+1))" 'past-day check-in'
|
||||
expect "$(sql "SELECT local_date FROM habit_days WHERE habit_id=(SELECT id FROM habits WHERE name='Yoga') AND completed=1")" "$(date -d yesterday +%Y%m%d)" 'second circle marks yesterday'
|
||||
tap 149 438
|
||||
tap 99 508
|
||||
expect "$(day_count)" "$before" 'past-day undo'
|
||||
# A horizontal drag that ends on another circle must not check that day.
|
||||
drag 65 438 317 438
|
||||
drag 50 508 294 508
|
||||
expect "$(day_count)" "$before" 'drag does not check a day'
|
||||
# Title drag reorders and preserves day state, even though the page can scroll.
|
||||
drag 160 173 160 540
|
||||
tap 160 260
|
||||
expect "$(sql "SELECT value FROM settings WHERE key='habits_selected_id'")" '' 'selected card header collapses'
|
||||
import -window "$window" "$test_dir/collapsed.png"
|
||||
# Card title dragging is still owned by the reorder controller.
|
||||
drag 160 110 160 390
|
||||
expect "$(order)" 'Yoga|Meditation|Sit ups|Push ups|Cold Shower|Jumping Rope' 'card reorder'
|
||||
expect "$(day_count)" "$before" 'reorder does not mark days'
|
||||
expect "$(day_count)" "$before" 'reorder preserves check-ins'
|
||||
import -window "$window" "$test_dir/reordered.png"
|
||||
# Scrolling from a day row must not reorder or mark anything.
|
||||
drag 200 438 200 260
|
||||
expect "$(order)" 'Yoga|Meditation|Sit ups|Push ups|Cold Shower|Jumping Rope' 'scroll preserves order'
|
||||
expect "$(day_count)" "$before" 'scroll does not mark days'
|
||||
xdotool mousemove --window "$window" 200 400 click --repeat 8 --delay 30 4
|
||||
sleep 0.3
|
||||
# Tiny title movements remain taps and open the former ellipsis destination.
|
||||
tap 160 173
|
||||
expect "$(sql "SELECT value FROM settings WHERE key='habits_screen_mode'")" '1' 'card opens details'
|
||||
expect "$(sql "SELECT name FROM habits WHERE id=(SELECT value FROM settings WHERE key='habits_selected_id')")" 'Yoga' 'correct card details'
|
||||
import -window "$window" "$test_dir/details.png"
|
||||
tap 130 186
|
||||
sleep 0.3
|
||||
expect "$(sql "SELECT value FROM settings WHERE key='habits_screen_mode'")" '0' 'selected card header collapses focus card'
|
||||
xdotool mousemove --window "$window" 160 173 mousedown 1 sleep 0.1 \
|
||||
mousemove --window "$window" 160 690 sleep 1 mouseup 1
|
||||
sleep 0.4
|
||||
expect "$(order)" 'Meditation|Sit ups|Push ups|Cold Shower|Jumping Rope|Yoga' 'edge auto-scroll reorder'
|
||||
expect "$(day_count)" "$before" 'edge drag does not mark days'
|
||||
import -window "$window" "$test_dir/edge-reorder.png"
|
||||
echo "PASS habit day taps, undo, drag cancellation, persisted reorder and card navigation"
|
||||
echo "PASS shared habit buttons: selection, day taps, undo, drag cancellation, collapse and reorder"
|
||||
echo "Screenshots and isolated database: $test_dir ; $db"
|
||||
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
binary="${1:?native binary required}"
|
||||
test_dir="$(mktemp -d /tmp/inbe-lists-ui.XXXXXX)"
|
||||
APP_SHOT_WINDOW=1 "$binary" --screenshot "$test_dir/start.png" \
|
||||
--screenshot-scene lists --screenshot-width 900 --screenshot-height 720 \
|
||||
--screenshot-dark 1 > "$test_dir/app.log" 2>&1 &
|
||||
app_pid=$!
|
||||
trap 'kill "$app_pid" 2>/dev/null || true' EXIT
|
||||
db="/tmp/breathing-screenshot-$app_pid/breathing.db"
|
||||
window=""
|
||||
for attempt in {1..80}; do
|
||||
window="$(xdotool search --onlyvisible --pid "$app_pid" 2>/dev/null | head -1 || true)"
|
||||
if [[ -n "$window" && -f "$db" ]]; then break; fi
|
||||
sleep 0.1
|
||||
done
|
||||
[[ -n "$window" && -f "$db" ]]
|
||||
sleep 1
|
||||
xdotool windowfocus --sync "$window"
|
||||
tap() {
|
||||
xdotool mousemove --window "$window" "$1" "$2" mousedown 1 sleep 0.08 mouseup 1
|
||||
sleep 0.3
|
||||
}
|
||||
sql() { sqlite3 -cmd '.timeout 2000' "$db" "$1"; }
|
||||
expect() {
|
||||
[[ "$1" == "$2" ]] || { echo "FAIL $3: got '$1', expected '$2' ($test_dir)"; exit 1; }
|
||||
}
|
||||
tap 600 34
|
||||
tap 300 90
|
||||
xdotool type --clearmodifiers 'Weekend task'
|
||||
xdotool keydown Return sleep 0.15 keyup Return
|
||||
sleep 0.5
|
||||
import -window "$window" "$test_dir/after-task.png"
|
||||
expect "$(sql "SELECT l.title FROM elist_items i JOIN elist_lists l ON i.list_id=l.id WHERE i.title='Weekend task'")" 'Weekend' 'tab selects destination list'
|
||||
tap 740 34
|
||||
tap 300 90
|
||||
xdotool type --clearmodifiers 'Travel'
|
||||
xdotool keydown Return sleep 0.15 keyup Return
|
||||
sleep 0.5
|
||||
expect "$(sql "SELECT COUNT(*) FROM elist_lists WHERE title='Travel'")" '1' 'create list with Enter'
|
||||
tap 300 90
|
||||
xdotool type --clearmodifiers 'Pack bag'
|
||||
xdotool keydown Return sleep 0.15 keyup Return
|
||||
sleep 0.5
|
||||
expect "$(sql "SELECT l.title FROM elist_items i JOIN elist_lists l ON i.list_id=l.id WHERE i.title='Pack bag'")" 'Travel' 'new list is selected'
|
||||
import -window "$window" "$test_dir/tabs.png"
|
||||
echo "PASS list tabs, task destination and new-list selection ($test_dir)"
|
||||
Vendored
+1
-1
Submodule vendor/kryon updated: 00f44f2d04...d723435f18.
Reference in new issue
Block a user