From 9dfd4f949cf337f8fc077352b49a1034695d59a8 Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Fri, 13 Sep 2024 01:13:11 +0200 Subject: [PATCH] CREOptions: Simplify a few name_text_hold_callback calls when we want to display a size unit Rely on `name_text_unit` instead of wrapping `optionsutil.showValues` --- frontend/ui/data/creoptions.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/ui/data/creoptions.lua b/frontend/ui/data/creoptions.lua index 636b71078..f9b773b2a 100644 --- a/frontend/ui/data/creoptions.lua +++ b/frontend/ui/data/creoptions.lua @@ -221,9 +221,8 @@ In the top menu → Settings → Status bar, you can choose whether the bottom m G_defaults:readSetting("DCREREADER_CONFIG_T_MARGIN_SIZES_XX_HUGE"), }, hide_on_apply = true, - name_text_hold_callback = function(configurable, opt, prefix) - optionsutil.showValues(configurable, opt, prefix, nil, "mm") - end, + name_text_hold_callback = optionsutil.showValues, + name_text_unit = true, more_options = true, more_options_param = { -- Allow this to tune both top and bottom margins, handling @@ -275,9 +274,8 @@ In the top menu → Settings → Status bar, you can choose whether the bottom m G_defaults:readSetting("DCREREADER_CONFIG_B_MARGIN_SIZES_XX_HUGE"), }, hide_on_apply = true, - name_text_hold_callback = function(configurable, opt, prefix) - optionsutil.showValues(configurable, opt, prefix, nil, "mm") - end, + name_text_hold_callback = optionsutil.showValues, + name_text_unit = true, help_text = _([[In the top menu → Settings → Status bar, you can choose whether the bottom margin applies from the bottom of the screen, or from above the status bar.]]), more_options = true, more_options_param = { @@ -450,8 +448,9 @@ Note that your selected font size is not affected by this setting.]]), local opt = { name = "font_size", name_text = _("Font Size"), + name_text_unit = "pt", } - optionsutil.showValues(configurable, opt, prefix, nil, "pt") + optionsutil.showValues(configurable, opt, prefix) end, }, { -- ReaderFont