Compare commits

..
Author SHA1 Message Date
Martin BallandClaude Opus 5.5 676bd3637b Equation tab: the Tools group keeps its labels (#7975)
Wrap the Tools group in labelled() so Unicode, LaTeX, Convert and Normal Text keep their labels instead of the group compacting to icons, as the View tab does (#8156).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FypgCWNarDG3QfXK2YMzdx
2026-11-30 12:44:40 +00:00
+38 -36
View File
@@ -22,7 +22,7 @@ use wordcraft_engine::math_gallery::{BUILT_INS, STRUCTURES, SYMBOL_SETS};
use crate::WordApp;
use crate::previews::{MathSource, math_key, math_painter, math_picture, math_thumbnails};
use crate::ribbon::common::menu_button;
use crate::ribbon::common::{labelled, menu_button};
/// What each structure button shows.
pub(crate) fn button_picture(id: &str) -> &'static str {
@@ -286,42 +286,44 @@ pub fn show(row: &mut RibbonRow<'_>, app: &mut WordApp) {
let latex = app.session.math_latex;
let normal_text = app.session.math_normal_text;
row.group(RibbonGroup::new("tools", tl!("Tools").to_string(), crate::icons::spec("equation")), |ui| {
math_menu_button(ui, EQUATION_PICTURE, "Equation", |ui, cx| builtin_menu(ui, cx, app));
Stack::new().gap(Gap::Tight).show(ui, |ui, _| {
ToggleButton::command(CommandRef::with_params("equation.inputFormat", json!({"format": "unicode"})))
.label(tl!("Unicode").to_string())
.icon(crate::icons::spec("equation"))
.tooltip(tl!("Type equations in the linear format (UnicodeMath)").to_string())
.selected(!latex)
.show(ui);
ToggleButton::command(CommandRef::with_params("equation.inputFormat", json!({"format": "latex"})))
.label(tl!("LaTeX").to_string())
.icon(crate::icons::spec("formula"))
.tooltip(tl!("Type equations in LaTeX").to_string())
.selected(latex)
.show(ui);
let face = Button::new(tl!("Convert").to_string()).icon(crate::icons::spec("replace"));
let _ = menu_button(ui, face, tl!("Convert").to_string(), None, |ui, _| {
for (label, to, all) in [
("Current - Professional", "professional", false),
("Current - Linear", "linear", false),
("All - Professional", "professional", true),
("All - Linear", "linear", true),
] {
MenuItem::command(CommandRef::with_params("equation.convert", json!({"to": to, "all": all})))
.label(tl!(label).to_string())
.show(ui);
}
labelled(ui, |ui| {
math_menu_button(ui, EQUATION_PICTURE, "Equation", |ui, cx| builtin_menu(ui, cx, app));
Stack::new().gap(Gap::Tight).show(ui, |ui, _| {
ToggleButton::command(CommandRef::with_params("equation.inputFormat", json!({"format": "unicode"})))
.label(tl!("Unicode").to_string())
.icon(crate::icons::spec("equation"))
.tooltip(tl!("Type equations in the linear format (UnicodeMath)").to_string())
.selected(!latex)
.show(ui);
ToggleButton::command(CommandRef::with_params("equation.inputFormat", json!({"format": "latex"})))
.label(tl!("LaTeX").to_string())
.icon(crate::icons::spec("formula"))
.tooltip(tl!("Type equations in LaTeX").to_string())
.selected(latex)
.show(ui);
let face = Button::new(tl!("Convert").to_string()).icon(crate::icons::spec("replace"));
let _ = menu_button(ui, face, tl!("Convert").to_string(), None, |ui, _| {
for (label, to, all) in [
("Current - Professional", "professional", false),
("Current - Linear", "linear", false),
("All - Professional", "professional", true),
("All - Linear", "linear", true),
] {
MenuItem::command(CommandRef::with_params("equation.convert", json!({"to": to, "all": all})))
.label(tl!(label).to_string())
.show(ui);
}
});
});
});
Stack::new().gap(Gap::Tight).show(ui, |ui, _| {
ToggleButton::command(CommandRef::new("equation.normalText"))
.label(tl!("Normal Text").to_string())
.icon(crate::icons::spec("case"))
.tooltip(tl!("Type normal (non-math) text in the equation").to_string())
.selected(normal_text)
.show(ui);
});
Stack::new().gap(Gap::Tight).show(ui, |ui, _| {
ToggleButton::command(CommandRef::new("equation.normalText"))
.label(tl!("Normal Text").to_string())
.icon(crate::icons::spec("case"))
.tooltip(tl!("Type normal (non-math) text in the equation").to_string())
.selected(normal_text)
.show(ui);
});
})
});
row.group(RibbonGroup::new("symbols", tl!("Symbols").to_string(), crate::icons::spec("symbol")), |ui| symbols(ui, app));
row.group(RibbonGroup::new("structures", tl!("Structures").to_string(), crate::icons::spec("equation")), |ui| {