mirror of
https://github.com/storytold/wordcraft.git
synced 2026-11-30 09:45:15 -06:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
676bd3637b |
@@ -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| {
|
||||
|
||||
Reference in New Issue
Block a user