Inline thin button and toggle forwarding helpers
This commit is contained in:
1 parent
ee3cf84e8d
commit
54b0144903
10 files changed
+139
-127
No files matched your search
@@ -45,6 +45,9 @@
|
||||
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`.
|
||||
- Do not add thin forwarding helpers around `Button`, even with screen-specific
|
||||
names. Put `ButtonProps` directly at the call site. Keep composed widgets only
|
||||
when they own meaningful layout, content, or behavior beyond forwarding props.
|
||||
- The Lists screen starts with list tabs; do not restore a separate Lists
|
||||
title bar or replace the tabs with a dropdown.
|
||||
|
||||
|
||||
@@ -2,10 +2,18 @@
|
||||
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
|
||||
if rg -n '\b(StyledButton|TextButton|RenderTextButton|IconButton|PaddedIconBtn|IconBtn|OverlayButton|InvisibleButton|app_sidebar_clean_button|practice_home_action_button|practice_home_quiet_action_button|habit_session_keyboard_key|draw_duration_button|draw_audio_preview_button)\s*\(' src --glob '*.kry' --glob '*.c' --glob '*.h'; then
|
||||
echo 'Use Button(ButtonProps) for buttons; use standard Checkbox/Toggle for their own controls.' >&2
|
||||
exit 1
|
||||
fi
|
||||
if rg -n -U '(?s:\b\w+\s*::[^{}]*\{\s*return\s+Button\(\(ButtonProps\)\{.*?\}\)\s*\})' src --glob '*.kry'; then
|
||||
echo 'Inline thin Button forwarding helpers at their call sites.' >&2
|
||||
exit 1
|
||||
fi
|
||||
if rg -n -U '\b\w+\s*::[^{}]*\{\s*return\s+(Toggle|Checkbox)\([^{}]*\)\s*\}' src --glob '*.kry'; then
|
||||
echo 'Inline thin toggle and checkbox forwarding helpers at their call sites.' >&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
|
||||
|
||||
+12
-15
@@ -643,23 +643,17 @@ app_open_settings_tab :: (app: InnerBreeze*, tab: int) #private {
|
||||
app_switch_route(app, route)
|
||||
}
|
||||
|
||||
app_sidebar_clean_button :: (x: int, y: int, w: int, h: int,
|
||||
label: const char*, id: int, disabled: int) -> int #private {
|
||||
return Button((ButtonProps){
|
||||
.bounds = {(float)x, (float)y, (float)w, (float)h},
|
||||
.id = id, .label = label, .font = Text16,
|
||||
.disabled = disabled,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
})
|
||||
}
|
||||
|
||||
app_sidebar_settings_button :: (app: InnerBreeze*, x: int, y: int*, w: int,
|
||||
tab: int) -> int #private {
|
||||
h := Scale(38)
|
||||
disabled := app != NULL && app->modal.active
|
||||
|
||||
if app_sidebar_clean_button(x, *y, w, h, settings_screen_tab_label(tab),
|
||||
9100 + tab, disabled) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)x, (float)(*y), (float)w, (float)h},
|
||||
.id = (9100 + tab), .label = (settings_screen_tab_label(tab)), .font = Text16,
|
||||
.disabled = disabled,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
app_open_settings_tab(app, tab)
|
||||
return 1
|
||||
}
|
||||
@@ -962,9 +956,12 @@ app_draw_nav_sidebar :: (app: InnerBreeze*) {
|
||||
|
||||
DrawRectangle(sidebar_x, footer_y, sidebar_w, view_height - footer_y,
|
||||
DarkenUIColor(GetThemeBackground(), 10))
|
||||
if app_sidebar_clean_button(sidebar_x + pad, close_y, sidebar_w - pad * 2,
|
||||
close_h, GetLocaleText("close_button"),
|
||||
9199, app->modal.active) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(sidebar_x + pad), (float)close_y, (float)(sidebar_w - pad * 2), (float)close_h},
|
||||
.id = 9199, .label = GetLocaleText("close_button"), .font = Text16,
|
||||
.disabled = (app->modal.active),
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
app_close_nav_sidebar(app)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,19 +288,6 @@ 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 {
|
||||
|
||||
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 {
|
||||
was_complete: int
|
||||
|
||||
@@ -341,7 +328,6 @@ meditation_draw_setup_modal :: (app: InnerBreeze*) {
|
||||
cancel_x: int
|
||||
cancel_y: int
|
||||
|
||||
|
||||
if modal_w > view_width - Scale(24) {
|
||||
modal_w = view_width - Scale(24)
|
||||
}
|
||||
@@ -386,7 +372,14 @@ meditation_draw_setup_modal :: (app: InnerBreeze*) {
|
||||
for int i = 0; i < 3; i++ {
|
||||
x := modal_x + side + i * (btn_w + gap)
|
||||
|
||||
if draw_duration_button(x, row_y, btn_w, btn_h, labels[i]) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(row_y), (float)(btn_w), (float)(btn_h)},
|
||||
.label = (labels[i]),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
meditation_start_seconds(app, duration_presets[i])
|
||||
}
|
||||
}
|
||||
@@ -396,7 +389,14 @@ meditation_draw_setup_modal :: (app: InnerBreeze*) {
|
||||
two_w := (modal_w - side * 2 - gap) / 2
|
||||
x := modal_x + side + (i - 3) * (two_w + gap)
|
||||
|
||||
if draw_duration_button(x, row_y, two_w, btn_h, labels[i]) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(row_y), (float)(two_w), (float)(btn_h)},
|
||||
.label = (labels[i]),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled,
|
||||
.disabled = 0
|
||||
}) {
|
||||
meditation_start_seconds(app, duration_presets[i])
|
||||
}
|
||||
}
|
||||
@@ -425,7 +425,6 @@ draw_extend_controls :: (app: InnerBreeze*, center_x: int, y: int) #private {
|
||||
total_w := btn_w * 3 + gap * 2
|
||||
x := center_x - total_w / 2
|
||||
|
||||
|
||||
if app == nil || !app->meditation.show_extend_controls {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -316,7 +316,6 @@ draw_edit_content :: (app: InnerBreeze*, ctx: HabitLinkedContext*,
|
||||
row_font := GetSmallFontSize()
|
||||
summary_x := 0
|
||||
|
||||
|
||||
if ctx->entries[i].activity != activity {
|
||||
continue
|
||||
}
|
||||
@@ -398,8 +397,6 @@ draw_edit_content :: (app: InnerBreeze*, ctx: HabitLinkedContext*,
|
||||
strcmp(app->habit_session_edit.path,
|
||||
ctx->entries[i].path) == 0
|
||||
|
||||
|
||||
|
||||
FormatLocaleText(round_line, sizeof(round_line),
|
||||
"round_result_label", r + 1,
|
||||
ctx->entries[i].rounds[r])
|
||||
@@ -586,7 +583,14 @@ draw_keyboard :: (app: InnerBreeze*, entry: const HabitLinkedEntry*) -> int {
|
||||
key_x := x + col * (key_w + gap)
|
||||
key_y := y + pad + row * (key_h + gap)
|
||||
|
||||
if habit_session_keyboard_key(key_x, key_y, key_w, key_h, labels[i]) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)(key_x), (float)(key_y), (float)(key_w), (float)(key_h)},
|
||||
.label = (labels[i]),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = 0
|
||||
}) {
|
||||
if i == 9 {
|
||||
habit_session_delete_before_cursor(app)
|
||||
} else if i == 11 {
|
||||
@@ -602,20 +606,6 @@ draw_keyboard :: (app: InnerBreeze*, entry: const HabitLinkedEntry*) -> int {
|
||||
return 0
|
||||
}
|
||||
|
||||
keyboard_key :: (x: int, y: int, w: int, h: int,
|
||||
label: const char*) -> int {
|
||||
|
||||
|
||||
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*) {
|
||||
len := 0
|
||||
|
||||
|
||||
@@ -217,7 +217,6 @@ void habit_session_cancel_edit(InnerBreeze*app);
|
||||
/* Habit session keyboard functions */
|
||||
int habit_session_keyboard_height(InnerBreeze*app);
|
||||
int habit_session_draw_keyboard(InnerBreeze*app, const HabitLinkedEntry *entry);
|
||||
int habit_session_keyboard_key(int x, int y, int w, int h, const char *label);
|
||||
void habit_session_delete_before_cursor(InnerBreeze*app);
|
||||
void habit_session_insert_char(InnerBreeze*app, char c);
|
||||
int habit_session_commit_edit(InnerBreeze*app, const HabitLinkedEntry *entry);
|
||||
|
||||
@@ -207,7 +207,6 @@ practice_select_home_card :: (app: InnerBreeze*, exercise: int) #private {
|
||||
app_switch_route(app, route)
|
||||
}
|
||||
|
||||
|
||||
practice_home_below_card_height :: (app: const InnerBreeze*, content_w: int) -> int #private {
|
||||
practice := practice_get(app != NULL ? app->exercise_type : 0)
|
||||
tokens := GetThemeMetrics()
|
||||
@@ -254,28 +253,6 @@ practice_home_action_gap :: (content_w: int) -> int #private {
|
||||
return content_w < Scale(340) ? Scale(8) : Scale(12)
|
||||
}
|
||||
|
||||
practice_home_action_button :: (app: InnerBreeze*, bounds: Rectangle,
|
||||
label: const char*, primary: int) -> int #private {
|
||||
return Button((ButtonProps){
|
||||
.bounds = bounds,
|
||||
.label = label,
|
||||
.font = GetFontSize(),
|
||||
.disabled = app != NULL && app->modal.active,
|
||||
.tone = primary ? ButtonToneAccent : ButtonToneNeutral,
|
||||
.emphasis = primary ? ButtonEmphasisFilled : ButtonEmphasisSoft
|
||||
})
|
||||
}
|
||||
|
||||
practice_home_quiet_action_button :: (bounds: Rectangle, label: const char*) -> int #private {
|
||||
return Button((ButtonProps){
|
||||
.bounds = bounds,
|
||||
.label = label,
|
||||
.font = GetFontSize(),
|
||||
.id = 7100 + (int)bounds.x,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
})
|
||||
}
|
||||
|
||||
practice_home_subtitle :: (exercise: int) -> const char* #private {
|
||||
unused exercise
|
||||
return NULL
|
||||
@@ -560,8 +537,14 @@ practice_screen_draw_desktop_home :: (app: InnerBreeze*) -> int #private {
|
||||
|
||||
app->practice_home_bounds_start = (Rectangle){(float)action_x, (float)button_y,
|
||||
(float)primary_w, (float)button_h}
|
||||
if practice_home_action_button(app, app->practice_home_bounds_start,
|
||||
GetLocaleText("practice_start_button"), 1) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = app->practice_home_bounds_start,
|
||||
.label = GetLocaleText("practice_start_button"),
|
||||
.font = GetFontSize(),
|
||||
.disabled = app != NULL && app->modal.active,
|
||||
.tone = ButtonToneAccent,
|
||||
.emphasis = ButtonEmphasisFilled
|
||||
}) {
|
||||
if practice != NULL && practice->start != NULL {
|
||||
practice->start(app)
|
||||
}
|
||||
@@ -571,8 +554,14 @@ practice_screen_draw_desktop_home :: (app: InnerBreeze*) -> int #private {
|
||||
if practice != NULL && practice->draw_manual != NULL {
|
||||
app->practice_home_bounds_manual = (Rectangle){(float)action_x, (float)button_y,
|
||||
(float)secondary_w, (float)button_h}
|
||||
if practice_home_action_button(app, app->practice_home_bounds_manual,
|
||||
GetLocaleText("practice_manual_button"), 0) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = app->practice_home_bounds_manual,
|
||||
.label = GetLocaleText("practice_manual_button"),
|
||||
.font = GetFontSize(),
|
||||
.disabled = app != NULL && app->modal.active,
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
practice_screen_open_tab(app, PRACTICE_TAB_MANUAL)
|
||||
}
|
||||
action_x += secondary_w + action_gap
|
||||
@@ -581,8 +570,14 @@ practice_screen_draw_desktop_home :: (app: InnerBreeze*) -> int #private {
|
||||
if practice != NULL && practice->draw_config != NULL {
|
||||
app->practice_home_bounds_config = (Rectangle){(float)action_x, (float)button_y,
|
||||
(float)secondary_w, (float)button_h}
|
||||
if practice_home_action_button(app, app->practice_home_bounds_config,
|
||||
GetLocaleText("practice_configure_button"), 0) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = app->practice_home_bounds_config,
|
||||
.label = GetLocaleText("practice_configure_button"),
|
||||
.font = GetFontSize(),
|
||||
.disabled = app != NULL && app->modal.active,
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
practice_screen_open_tab(app, PRACTICE_TAB_CONFIG)
|
||||
}
|
||||
}
|
||||
@@ -1082,15 +1077,25 @@ start :: (app: InnerBreeze*) #ui {
|
||||
practice_home_action_row_widths(content_w, &manual_w, &config_w)
|
||||
app->practice_home_bounds_manual = (Rectangle){(float)x, (float)y,
|
||||
(float)manual_w, (float)btn_h}
|
||||
if practice_home_quiet_action_button(app->practice_home_bounds_manual,
|
||||
GetLocaleText("practice_manual_button")) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = app->practice_home_bounds_manual,
|
||||
.label = GetLocaleText("practice_manual_button"),
|
||||
.font = GetFontSize(),
|
||||
.id = 7100 + (int)app->practice_home_bounds_manual.x,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
practice_screen_open_tab(app, PRACTICE_TAB_MANUAL)
|
||||
}
|
||||
|
||||
app->practice_home_bounds_config = (Rectangle){(float)(x + manual_w + row_gap), (float)y,
|
||||
(float)config_w, (float)btn_h}
|
||||
if practice_home_quiet_action_button(app->practice_home_bounds_config,
|
||||
GetLocaleText("practice_configure_button")) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = app->practice_home_bounds_config,
|
||||
.label = GetLocaleText("practice_configure_button"),
|
||||
.font = GetFontSize(),
|
||||
.id = 7100 + (int)app->practice_home_bounds_config.x,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
practice_screen_open_tab(app, PRACTICE_TAB_CONFIG)
|
||||
}
|
||||
y += btn_h + gap
|
||||
@@ -1098,8 +1103,13 @@ start :: (app: InnerBreeze*) #ui {
|
||||
if practice->draw_manual != NULL {
|
||||
app->practice_home_bounds_manual = (Rectangle){(float)x, (float)y,
|
||||
(float)content_w, (float)btn_h}
|
||||
if practice_home_quiet_action_button(app->practice_home_bounds_manual,
|
||||
GetLocaleText("practice_manual_button")) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = app->practice_home_bounds_manual,
|
||||
.label = GetLocaleText("practice_manual_button"),
|
||||
.font = GetFontSize(),
|
||||
.id = 7100 + (int)app->practice_home_bounds_manual.x,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
practice_screen_open_tab(app, PRACTICE_TAB_MANUAL)
|
||||
}
|
||||
y += btn_h + gap
|
||||
@@ -1107,8 +1117,13 @@ start :: (app: InnerBreeze*) #ui {
|
||||
if practice->draw_config != NULL {
|
||||
app->practice_home_bounds_config = (Rectangle){(float)x, (float)y,
|
||||
(float)content_w, (float)btn_h}
|
||||
if practice_home_quiet_action_button(app->practice_home_bounds_config,
|
||||
GetLocaleText("practice_configure_button")) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = app->practice_home_bounds_config,
|
||||
.label = GetLocaleText("practice_configure_button"),
|
||||
.font = GetFontSize(),
|
||||
.id = 7100 + (int)app->practice_home_bounds_config.x,
|
||||
.tone = ButtonToneNeutral, .emphasis = ButtonEmphasisSoft
|
||||
}) {
|
||||
practice_screen_open_tab(app, PRACTICE_TAB_CONFIG)
|
||||
}
|
||||
y += btn_h + gap
|
||||
|
||||
@@ -325,20 +325,6 @@ settings_audio_toggle_music_preview :: (app: InnerBreeze*, index: int) #private
|
||||
PlayMusicStream(audio_preview_music)
|
||||
}
|
||||
|
||||
draw_audio_preview_button :: (x: int, y: int, w: int, playing: int,
|
||||
disabled: int) -> int #private {
|
||||
|
||||
return Button((ButtonProps){
|
||||
.bounds = {(float)(x), (float)(y), (float)(w), (float)(Scale(32))},
|
||||
.label = playing ? GetLocaleText("pause_button")
|
||||
: GetLocaleText("play_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = disabled
|
||||
})
|
||||
}
|
||||
|
||||
audio_action_to_cue :: (action: int) -> int #private {
|
||||
if action == SETTINGS_AUDIO_ACTION_SOUND_IN {
|
||||
return AUDIO_CUE_BREATH_IN
|
||||
@@ -722,10 +708,15 @@ draw_cue_selector :: (app: InnerBreeze*, x: int, w: int, y: int*, cue: int,
|
||||
save_settings(app)
|
||||
}
|
||||
if preview_w < w {
|
||||
if draw_audio_preview_button(x + dropdown_w + control_gap,
|
||||
*y + Scale(28), preview_w,
|
||||
settings_audio_preview_cue_playing(app, cue),
|
||||
app == nil || !app->audio_ready) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)((x + dropdown_w + control_gap)), (float)((*y + Scale(28))), (float)(preview_w), (float)(Scale(32))},
|
||||
.label = (settings_audio_preview_cue_playing(app, cue)) ? GetLocaleText("pause_button")
|
||||
: GetLocaleText("play_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = (app == nil || !app->audio_ready)
|
||||
}) {
|
||||
settings_audio_toggle_cue_preview(app, cue)
|
||||
}
|
||||
}
|
||||
@@ -764,10 +755,15 @@ draw_custom_sound_list :: (app: InnerBreeze*, x: int, w: int, y: int*) #private
|
||||
.color=(GetThemeText()),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if draw_audio_preview_button(x + w - button_w - preview_w - gap, *y,
|
||||
preview_w,
|
||||
settings_audio_preview_custom_sound_playing(i),
|
||||
app == nil || !app->audio_ready) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)((x + w - button_w - preview_w - gap)), (float)((*y)), (float)(preview_w), (float)(Scale(32))},
|
||||
.label = (settings_audio_preview_custom_sound_playing(i)) ? GetLocaleText("pause_button")
|
||||
: GetLocaleText("play_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = (app == nil || !app->audio_ready)
|
||||
}) {
|
||||
settings_audio_toggle_custom_sound_preview(app, i)
|
||||
}
|
||||
if Button((ButtonProps){
|
||||
@@ -859,10 +855,15 @@ draw_music_list :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
.color=(DarkenUIColor(GetThemeText(), 28)),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if draw_audio_preview_button(x + w - button_w - preview_w - gap, *y,
|
||||
preview_w,
|
||||
settings_audio_preview_music_playing(current),
|
||||
app == nil || !app->audio_ready) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)((x + w - button_w - preview_w - gap)), (float)((*y)), (float)(preview_w), (float)(Scale(32))},
|
||||
.label = (settings_audio_preview_music_playing(current)) ? GetLocaleText("pause_button")
|
||||
: GetLocaleText("play_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = (app == nil || !app->audio_ready)
|
||||
}) {
|
||||
settings_audio_toggle_music_preview(app, current)
|
||||
}
|
||||
if Button((ButtonProps){
|
||||
@@ -925,10 +926,15 @@ draw_music_list :: (app: InnerBreeze*, x: int, w: int, y: int*) #private {
|
||||
.color=(GetThemeText()),
|
||||
.wrap=TextWrapNone
|
||||
})
|
||||
if draw_audio_preview_button(x + w - button_w - preview_w - gap, *y,
|
||||
preview_w,
|
||||
settings_audio_preview_music_playing(track_index),
|
||||
app == nil || !app->audio_ready) {
|
||||
if Button((ButtonProps){
|
||||
.bounds = {(float)((x + w - button_w - preview_w - gap)), (float)((*y)), (float)(preview_w), (float)(Scale(32))},
|
||||
.label = (settings_audio_preview_music_playing(track_index)) ? GetLocaleText("pause_button")
|
||||
: GetLocaleText("play_button"),
|
||||
.font = GetFontSize(),
|
||||
.tone = ButtonToneNeutral,
|
||||
.emphasis = ButtonEmphasisSoft,
|
||||
.disabled = (app == nil || !app->audio_ready)
|
||||
}) {
|
||||
settings_audio_toggle_music_preview(app, track_index)
|
||||
}
|
||||
if Button((ButtonProps){
|
||||
|
||||
@@ -102,9 +102,8 @@ draw_entry :: (app: InnerBreeze*, index: int, x: int, w: int, y: int*) -> int #p
|
||||
stepper_w := btn * 2 + TextWidth(time_buf, GetFontSize()) + Scale(24)
|
||||
enabled := r->enabled
|
||||
|
||||
if settings_ui_toggle_switch(4010 + index,
|
||||
x, *y + (btn - Scale(28)) / 2,
|
||||
&enabled) {
|
||||
if Toggle(4010 + index, x, *y + (btn - Scale(28)) / 2,
|
||||
settings_ui_toggle_switch_width(), Scale(28), &enabled, "", "") {
|
||||
r->enabled = enabled
|
||||
app->settings_dirty = 1
|
||||
save_settings(app)
|
||||
|
||||
@@ -10,10 +10,6 @@ toggle_switch_width :: () -> int {
|
||||
return Scale(50)
|
||||
}
|
||||
|
||||
toggle_switch :: (id: int, x: int, y: int, value: int*) -> int {
|
||||
return Toggle(id, x, y, toggle_switch_width(), Scale(28), value, "", "")
|
||||
}
|
||||
|
||||
toggle_row_height :: (label: const char*, w: int) -> int {
|
||||
if w <= 0 {
|
||||
w = Scale(160)
|
||||
@@ -78,7 +74,7 @@ draw_toggle_row :: (x: int, w: int, y: int*, label: const char*, value: int*) ->
|
||||
}
|
||||
Paragraph(label_paragraph(label, label_w), x, &label_y)
|
||||
|
||||
if toggle_switch(62000 + *y, toggle_x, toggle_y, value) {
|
||||
if Toggle(62000 + *y, toggle_x, toggle_y, toggle_w, toggle_h, value, "", "") {
|
||||
*y += row_h
|
||||
return 1
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user