style(settings): format independent font controls
This commit is contained in:
1 parent
28c071185b
commit
7d48b6a4fd
3 files changed
+31
-23
No files matched your search
@@ -91,7 +91,8 @@ impl SettingsPane {
|
||||
pub(super) fn font_size_row(&self, ui: bool, cx: &Context<Self>) -> gpui::AnyElement {
|
||||
let language = crate::gpui_shell::config::ui_language(cx);
|
||||
let size = if ui { self.font_size_px(cx) } else { self.terminal_font_size_px(cx) };
|
||||
let (key, min, max) = if ui { ("ui_font_size", 10.0, 24.0) } else { ("font_size", 4.0, 96.0) };
|
||||
let (key, min, max) =
|
||||
if ui { ("ui_font_size", 10.0, 24.0) } else { ("font_size", 4.0, 96.0) };
|
||||
let stepper = h_flex()
|
||||
.w(px(142.0))
|
||||
.h(px(36.0))
|
||||
@@ -122,10 +123,14 @@ impl SettingsPane {
|
||||
})),
|
||||
);
|
||||
self.row(
|
||||
if ui { language.text(crate::i18n::Message::SettingsFontUiSize) } else {
|
||||
if ui {
|
||||
language.text(crate::i18n::Message::SettingsFontUiSize)
|
||||
} else {
|
||||
language.pick("终端字号(Ctrl+滚轮缩放)", "Terminal font size (Ctrl+wheel)")
|
||||
},
|
||||
if ui { language.text(crate::i18n::Message::SettingsFontUiSizeDescription) } else {
|
||||
if ui {
|
||||
language.text(crate::i18n::Message::SettingsFontUiSizeDescription)
|
||||
} else {
|
||||
language.pick("只调整终端文字大小。", "Changes only the terminal text size.")
|
||||
},
|
||||
stepper,
|
||||
|
||||
@@ -61,14 +61,16 @@ impl SettingsPane {
|
||||
));
|
||||
let interface = self
|
||||
.group(language.pick("界面", "Interface"), cx)
|
||||
.child(self.row(
|
||||
language.text(crate::i18n::Message::SettingsFontUiFamily),
|
||||
language.text(crate::i18n::Message::SettingsFontUiFamilyDescription),
|
||||
Input::new(&self.ui_font_family_input)
|
||||
.w(px(SETTINGS_SELECT_WIDTH))
|
||||
.aria_label(language.text(crate::i18n::Message::SettingsFontUiFamily)),
|
||||
cx,
|
||||
))
|
||||
.child(
|
||||
self.row(
|
||||
language.text(crate::i18n::Message::SettingsFontUiFamily),
|
||||
language.text(crate::i18n::Message::SettingsFontUiFamilyDescription),
|
||||
Input::new(&self.ui_font_family_input)
|
||||
.w(px(SETTINGS_SELECT_WIDTH))
|
||||
.aria_label(language.text(crate::i18n::Message::SettingsFontUiFamily)),
|
||||
cx,
|
||||
),
|
||||
)
|
||||
.child(self.font_size_row(true, cx))
|
||||
.child(self.switch_row(
|
||||
"tab_close_visible",
|
||||
@@ -110,14 +112,16 @@ impl SettingsPane {
|
||||
font_picker,
|
||||
cx,
|
||||
))
|
||||
.child(self.row(
|
||||
language.text(crate::i18n::Message::SettingsFontChinese),
|
||||
language.text(crate::i18n::Message::SettingsFontChineseDescription),
|
||||
Input::new(&self.font_family_cjk_input)
|
||||
.w(px(SETTINGS_SELECT_WIDTH))
|
||||
.aria_label(language.text(crate::i18n::Message::SettingsFontChinese)),
|
||||
cx,
|
||||
))
|
||||
.child(
|
||||
self.row(
|
||||
language.text(crate::i18n::Message::SettingsFontChinese),
|
||||
language.text(crate::i18n::Message::SettingsFontChineseDescription),
|
||||
Input::new(&self.font_family_cjk_input)
|
||||
.w(px(SETTINGS_SELECT_WIDTH))
|
||||
.aria_label(language.text(crate::i18n::Message::SettingsFontChinese)),
|
||||
cx,
|
||||
),
|
||||
)
|
||||
.child(self.font_size_row(false, cx))
|
||||
.child(self.select_row(
|
||||
"cell_width_mode",
|
||||
|
||||
@@ -447,10 +447,9 @@ impl SettingsPane {
|
||||
InputState::new(window, cx)
|
||||
.default_value(runtime.ui_font_family.clone().unwrap_or_default())
|
||||
});
|
||||
for (key, input) in [
|
||||
("font_family_cjk", &font_family_cjk_input),
|
||||
("ui_font_family", &ui_font_family_input),
|
||||
] {
|
||||
for (key, input) in
|
||||
[("font_family_cjk", &font_family_cjk_input), ("ui_font_family", &ui_font_family_input)]
|
||||
{
|
||||
subscriptions.push(cx.subscribe_in(
|
||||
input,
|
||||
window,
|
||||
|
||||
Reference in new issue
Block a user