Skip to content

Commit 9c2f4e3

Browse files
gmarullclaude
andcommitted
fw/applib/ui: honor preferred content size in option menus
Radio-list option menus, including the Text Size chooser itself, kept rendering their titles and cell geometry at the platform default size after the rest of the system menus started following the user's Text Size setting. Route the option menu style and title font through the preferred content size. The option menu is system-only, so no per-process gating is needed. Add an ExtraLarge style with a 56 px single-line cell, ten pixels taller than Large like the ExtraLarge small menu cell, so the Gothic 28 bold title fits; the default and double-line content types already scale through menu_cell_basic_cell_height(). Add goldens at Medium and ExtraLarge on the rect and round test platforms; the existing goldens at the platform default are unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
1 parent e61d29f commit 9c2f4e3

8 files changed

Lines changed: 37 additions & 3 deletions

src/fw/applib/ui/option_menu_window.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,26 @@ static const OptionMenuStyle s_style_large = {
3737
.right_text_inset_with_icon = 4,
3838
};
3939

40+
static const OptionMenuStyle s_style_extra_large = {
41+
#if PBL_RECT
42+
.cell_heights[OptionMenuContentType_SingleLine] = 56,
43+
#endif
44+
.top_inset = 1,
45+
.right_icon_spacing = PBL_IF_RECT_ELSE(10, 35),
46+
.text_inset_single = -1,
47+
.text_inset_multi = -3,
48+
.right_text_inset_with_icon = 4,
49+
};
50+
4051
static const OptionMenuStyle *const s_styles[NumPreferredContentSizes] = {
4152
[PreferredContentSizeSmall] = &s_style_medium,
4253
[PreferredContentSizeMedium] = &s_style_medium,
4354
[PreferredContentSizeLarge] = &s_style_large,
44-
[PreferredContentSizeExtraLarge] = &s_style_large,
55+
[PreferredContentSizeExtraLarge] = &s_style_extra_large,
4556
};
4657

4758
static const OptionMenuStyle *prv_get_style(void) {
48-
return s_styles[PreferredContentSizeDefault];
59+
return s_styles[system_theme_get_content_size()];
4960
}
5061

5162
static uint16_t prv_get_num_rows_callback(MenuLayer *menu_layer, uint16_t section_index,
@@ -245,7 +256,7 @@ void option_menu_configure(OptionMenu *option_menu, const OptionMenuConfig *conf
245256
void option_menu_init(OptionMenu *option_menu) {
246257
*option_menu = (OptionMenu){
247258
.choice = OPTION_MENU_CHOICE_NONE,
248-
.title_font = system_theme_get_font_for_default_size(TextStyleFont_MenuCellTitle),
259+
.title_font = system_theme_get_font(TextStyleFont_MenuCellTitle),
249260
};
250261

251262
// radio button icons are enabled by default

tests/fw/ui/test_option_menu_window.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/* SPDX-License-Identifier: Apache-2.0 */
33

44
#include "applib/ui/option_menu_window.h"
5+
#include "shell/system_theme.h"
56
#include "resource/resource.h"
67
#include "resource/resource_ids.auto.h"
78
#include "pbl/services/timeline/timeline_resources.h"
@@ -67,6 +68,7 @@ void test_option_menu_window__initialize(void) {
6768
}
6869

6970
void test_option_menu_window__cleanup(void) {
71+
system_theme_set_content_size(PreferredContentSizeDefault);
7072
}
7173

7274
// Helpers
@@ -220,3 +222,24 @@ void test_option_menu_window__short_title_special_height_icons(void) {
220222
true /* special_height */);
221223
FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE();
222224
}
225+
226+
void test_option_menu_window__short_title_default_height_icons_medium(void) {
227+
system_theme_set_content_size(PreferredContentSizeMedium);
228+
prv_create_menu_and_render_short_title(true /* icons_enabled */, "Default Height",
229+
false /* special_height */);
230+
FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE();
231+
}
232+
233+
void test_option_menu_window__short_title_default_height_icons_extra_large(void) {
234+
system_theme_set_content_size(PreferredContentSizeExtraLarge);
235+
prv_create_menu_and_render_short_title(true /* icons_enabled */, "Default Height",
236+
false /* special_height */);
237+
FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE();
238+
}
239+
240+
void test_option_menu_window__long_title_special_height_icons_extra_large(void) {
241+
system_theme_set_content_size(PreferredContentSizeExtraLarge);
242+
prv_create_menu_and_render_long_title(true /* icons_enabled */, "Special Height",
243+
true /* special_height */);
244+
FAKE_GRAPHICS_CONTEXT_CHECK_DEST_BITMAP_FILE();
245+
}
3.67 KB
Loading
2.42 KB
Loading
3.08 KB
Loading
1.73 KB
Loading
3.02 KB
Loading
1.81 KB
Loading

0 commit comments

Comments
 (0)