diff --git a/crates/ui-egui/src/keytips/keytip_table/generated.rs b/crates/ui-egui/src/keytips/keytip_table/generated.rs index c078e77b0..c080cd530 100644 --- a/crates/ui-egui/src/keytips/keytip_table/generated.rs +++ b/crates/ui-egui/src/keytips/keytip_table/generated.rs @@ -17,6 +17,9 @@ pub const SEQUENCES: &[(&str, Entry)] = &[ ("E", Entry::Tab("Home")), // Legacy Edit-menu path (Excel 2003); leads to the same Home menus. ("O", Entry::Tab("Home")), // Legacy Format-menu path (Excel 2003); leads to the same Home menus. ("HAR", Entry::Finish(Action::Command("home.alignRight"))), + ("HAT", Entry::Finish(Action::Command("home.alignTop"))), // Excel: Excel: Top Align + ("HAM", Entry::Finish(Action::Command("home.alignMiddle"))), // Excel: Excel: Middle Align + ("HAB", Entry::Finish(Action::Command("home.alignBottom"))), // Excel: Excel: Bottom Align ("HAL", Entry::Finish(Action::Command("home.alignLeft"))), ("HAC", Entry::Finish(Action::Command("home.alignCenter"))), ("HVS", Entry::Finish(Action::Dialog("pasteSpecial"))), @@ -33,9 +36,7 @@ pub const SEQUENCES: &[(&str, Entry)] = &[ ("H0", Entry::Finish(Action::Command("home.increaseDecimal"))), // Excel: Increase Decimals; containment(Increase Decimal) ("H1", Entry::Finish(Action::Command("home.bold"))), // Excel: Bold ("H2", Entry::Finish(Action::Command("home.italic"))), // Excel: Italic - ("H3", Entry::Continue), // Excel: Underline Menu; group level: - ("H3D", Entry::Finish(Action::Command("home.doubleUnderline"))), // Excel: Double Underline - ("H3U", Entry::Finish(Action::Command("home.underline"))), // Excel: Underline + ("H3", Entry::Finish(Action::Command("home.underline"))), // Excel: Excel: Underline; fires immediately (not a menu) ("H5", Entry::Finish(Action::Command("home.decreaseIndent"))), // Excel: Decrease Indent ("H6", Entry::Finish(Action::Command("home.increaseIndent"))), // Excel: Increase Indent ("H9", Entry::Finish(Action::Command("home.decreaseDecimal"))), // Excel: Decrease Decimals; containment(Decrease Decimal) @@ -140,7 +141,7 @@ pub const SEQUENCES: &[(&str, Entry)] = &[ ("HOUR", Entry::Finish(Action::Command("home.hideRows"))), // Excel: Hide Rows ("HOUS", Entry::Finish(Action::Command("sheet.hide"))), // Excel: Hide Sheet ("HOW", Entry::Finish(Action::Command("home.columnWidth"))), // Excel: Column Width - ("HP", Entry::Finish(Action::Command("home.numberFormat"))), // Excel: Percentage Style; format TBD + ("HP", Entry::Finish(Action::Command("home.percent"))), // Excel: Excel: Percentage Style ("HSC", Entry::Finish(Action::Command("data.clearFilter"))), // Excel: Clear Filter ("HSF", Entry::Finish(Action::Command("data.filter"))), // Excel: Filter ("HSO", Entry::Finish(Action::Command("data.sortDescending"))), // Excel: Sort Z to A @@ -176,6 +177,7 @@ pub const SEQUENCES: &[(&str, Entry)] = &[ ("HX", Entry::Finish(Action::Command("edit.cut"))), // Excel: Cut ("NC1", Entry::Finish(Action::Command("insert.chart"))), // Excel: Column Chart; Column chart (kind TBD) ("NC2", Entry::Finish(Action::Command("review.newComment"))), // Excel: New Comment + ("NCM", Entry::Finish(Action::Command("review.newComment"))), // Excel: Excel: New Comment (modern) ("NCB", Entry::Finish(Action::Command("insert.checkbox"))), // Excel: Checkbox ("ND", Entry::Finish(Action::Command("insert.chart"))), // Excel: Scatter Chart; Scatter (kind TBD) ("NE", Entry::Finish(Action::Pending("insert.equation"))), // pending; Excel: Equations; Equations; reserved until the command lands @@ -209,6 +211,7 @@ pub const SEQUENCES: &[(&str, Entry)] = &[ ("NSZ", Entry::Finish(Action::Pending("insert.pivotChart"))), // pending; Excel: PivotChart; PivotChart; reserved until the command lands ("NT", Entry::Finish(Action::Command("insert.table"))), // Excel: Table ("NU", Entry::Finish(Action::Command("insert.symbol"))), // Excel: Symbols; containment(Symbol) + ("NZS", Entry::Finish(Action::Command("insert.symbol"))), // Excel: Excel: Symbol (modern) ("NV", Entry::Finish(Action::Command("insert.pivotTable"))), // Excel: PivotTable ("NW", Entry::Finish(Action::Pending("insert.wordArt"))), // pending; Excel: WordArt; WordArt; reserved until the command lands ("NX", Entry::Finish(Action::Command("insert.textBox"))), // Excel: Text Box @@ -217,6 +220,7 @@ pub const SEQUENCES: &[(&str, Entry)] = &[ ("NZKSO", Entry::Finish(Action::Command("insert.sparkline"))), // Excel: Column Sparkline ("NZKSW", Entry::Finish(Action::Command("insert.sparkline"))), // Excel: Win/Loss Sparkline ("NZTX", Entry::Finish(Action::Command("insert.textBox"))), // Excel: Text Box + ("NZT", Entry::Finish(Action::Command("insert.textBox"))), // Excel: Excel: Text Box (modern) ("PAE", Entry::Finish(Action::Command("arrange.sendBackward"))), // Excel: Send Backward ("PAF", Entry::Finish(Action::Command("arrange.bringForward"))), // Excel: Bring Forward ("PB", Entry::Continue), // Excel: Breaks; group level: @@ -253,6 +257,7 @@ pub const SEQUENCES: &[(&str, Entry)] = &[ ("MGF", Entry::Finish(Action::Command("formulas.insertFunction"))), // Excel: Math & Trig - Insert Function; containment(Insert Function) ("MH", Entry::Finish(Action::Command("formulas.showFormulas"))), // Excel: Show Formulas ("MI", Entry::Continue), // Excel: Financial Menu; group level: containment(Financial) + ("MI1", Entry::Finish(Action::Command("formulas.insertFunction"))), // Excel: Excel: Financial; first item of the dropdown ("MIF", Entry::Finish(Action::Command("formulas.insertFunction"))), // Excel: Financial - Insert Function; containment(Insert Function) ("MJ", Entry::Finish(Action::Command("formulas.calculateSheet"))), // Excel: Calculate Sheet ("MK", Entry::Continue), // Excel: Error Checking Menu; group level: containment(Error Checking) diff --git a/crates/ui-egui/src/keytips/keytips.json b/crates/ui-egui/src/keytips/keytips.json index 1056d31aa..b3545b6ab 100644 --- a/crates/ui-egui/src/keytips/keytips.json +++ b/crates/ui-egui/src/keytips/keytips.json @@ -69,6 +69,24 @@ "kind": "command", "target": "home.alignRight" }, + { + "seq": "HAT", + "kind": "command", + "target": "home.alignTop", + "excel": "Excel: Top Align" + }, + { + "seq": "HAM", + "kind": "command", + "target": "home.alignMiddle", + "excel": "Excel: Middle Align" + }, + { + "seq": "HAB", + "kind": "command", + "target": "home.alignBottom", + "excel": "Excel: Bottom Align" + }, { "seq": "HAL", "kind": "command", @@ -177,23 +195,9 @@ }, { "seq": "H3", - "kind": "continue", - "excel": "Underline Menu", - "note": "group level:" - }, - { - "seq": "H3D", "kind": "command", - "target": "home.doubleUnderline", - "excel": "Double Underline", - "note": "" - }, - { - "seq": "H3U", - "kind": "command", - "target": "home.underline", - "excel": "Underline", - "note": "" + "excel": "Excel: Underline; fires immediately (not a menu)", + "target": "home.underline" }, { "seq": "H5", @@ -924,9 +928,8 @@ { "seq": "HP", "kind": "command", - "target": "home.numberFormat", - "excel": "Percentage Style", - "note": "format TBD" + "target": "home.percent", + "excel": "Excel: Percentage Style" }, { "seq": "HSC", @@ -1170,6 +1173,12 @@ "excel": "New Comment", "note": "" }, + { + "seq": "NCM", + "kind": "command", + "target": "review.newComment", + "excel": "Excel: New Comment (modern)" + }, { "seq": "NCB", "kind": "command", @@ -1404,6 +1413,12 @@ "excel": "Symbols", "note": "containment(Symbol)" }, + { + "seq": "NZS", + "kind": "command", + "target": "insert.symbol", + "excel": "Excel: Symbol (modern)" + }, { "seq": "NV", "kind": "command", @@ -1460,6 +1475,12 @@ "excel": "Text Box", "note": "" }, + { + "seq": "NZT", + "kind": "command", + "target": "insert.textBox", + "excel": "Excel: Text Box (modern)" + }, { "seq": "PAE", "kind": "command", @@ -1706,6 +1727,12 @@ "excel": "Financial Menu", "note": "group level: containment(Financial)" }, + { + "seq": "MI1", + "kind": "command", + "target": "formulas.insertFunction", + "excel": "Excel: Financial; first item of the dropdown" + }, { "seq": "MIF", "kind": "command", diff --git a/crates/ui-egui/src/ribbon.rs b/crates/ui-egui/src/ribbon.rs index 2b80957ee..0afc33abb 100644 --- a/crates/ui-egui/src/ribbon.rs +++ b/crates/ui-egui/src/ribbon.rs @@ -570,16 +570,9 @@ fn home(app: &mut SheetApp, ui: &mut Ui) { (Icon::AlignMiddle, VAlign::Center, "home.alignMiddle", "Middle Align"), (Icon::AlignBottom, VAlign::Bottom, "home.alignBottom", "Bottom Align"), ] { - let response = toggle_button(ui, icon, st.align.v == v, tip); - if matches!(app.keytips.prefix(), Some("H" | "HA")) { - let sequence = match v { - VAlign::Top => "HAT", - VAlign::Center => "HAM", - _ => "HAB", - }; - keytip(app, ui, sequence, response.rect.center_bottom()); - } - if response.clicked() { + let __k = toggle_button(ui, icon, st.align.v == v, tip); + control_keytip(app, ui, &__k, id); + if __k.clicked() { act(app, id, json!({})); } } @@ -936,12 +929,16 @@ fn home(app: &mut SheetApp, ui: &mut Ui) { fn font_combo(app: &mut SheetApp, ui: &mut Ui, st: &Style) { let mut name = st.font.name.clone(); let before = name.clone(); - egui::ComboBox::from_id_salt("font_name").width(150.0).selected_text(egui::RichText::new(&name).font(theme::ui_font(12.5))).show_ui(ui, |ui| { - for f in crate::fonts::families() { - let fam = theme::cell_family(&f, false, false); - ui.selectable_value(&mut name, f.clone(), egui::RichText::new(&f).font(egui::FontId::new(14.0, fam))); - } - }); + let resp = egui::ComboBox::from_id_salt("font_name").width(150.0).selected_text(egui::RichText::new(&name).font(theme::ui_font(12.5))).show_ui( + ui, + |ui| { + for f in FONTS { + let fam = theme::cell_family(f, false, false); + ui.selectable_value(&mut name, f.to_string(), egui::RichText::new(*f).font(egui::FontId::new(14.0, fam))); + } + }, + ); + control_keytip(app, ui, &resp.response, "home.fontName"); if name != before { act(app, "home.fontName", json!({"name": name})); } @@ -971,11 +968,15 @@ fn size_combo(app: &mut SheetApp, ui: &mut Ui, st: &Style) { let mut size = st.font.size; let before = size; let label = if size.fract() == 0.0 { format!("{}", size as i32) } else { format!("{size}") }; - egui::ComboBox::from_id_salt("font_size").width(52.0).selected_text(egui::RichText::new(label).font(theme::ui_font(12.5))).show_ui(ui, |ui| { - for s in [8.0, 9.0, 10.0, 11.0, 12.0, 14.0, 16.0, 18.0, 20.0, 22.0, 24.0, 26.0, 28.0, 36.0, 48.0, 72.0] { - ui.selectable_value(&mut size, s, format!("{}", s as i32)); - } - }); + let resp = egui::ComboBox::from_id_salt("font_size").width(52.0).selected_text(egui::RichText::new(label).font(theme::ui_font(12.5))).show_ui( + ui, + |ui| { + for s in [8.0, 9.0, 10.0, 11.0, 12.0, 14.0, 16.0, 18.0, 20.0, 22.0, 24.0, 26.0, 28.0, 36.0, 48.0, 72.0] { + ui.selectable_value(&mut size, s, format!("{}", s as i32)); + } + }, + ); + control_keytip(app, ui, &resp.response, "home.fontSize"); if size != before { act(app, "home.fontSize", json!({"size": size})); } @@ -988,7 +989,7 @@ fn number_combo(app: &mut SheetApp, ui: &mut Ui, st: &Style) { let lang = app.ui.language; let sample = app.session.active().and_then(|d| d.wb.active().map(|sh| sh.value(d.selection.active))).unwrap_or_default(); let mut picked: Option<&str> = None; - egui::ComboBox::from_id_salt("number_format") + let resp = egui::ComboBox::from_id_salt("number_format") .width(150.0) .selected_text(egui::RichText::new(lang.tr(¤t)).font(theme::ui_font(12.5))) .show_ui(ui, |ui| { @@ -1007,6 +1008,7 @@ fn number_combo(app: &mut SheetApp, ui: &mut Ui, st: &Style) { picked = Some("__more"); } }); + anchor_keytip(app, ui, &resp.response, &["home.numberFormat"]); match picked { Some("__more") => app.open_dialog("formatCells", json!({"tab": "Number"})), Some(n) => act(app, "home.numberFormat", json!({"format": n})), @@ -1554,7 +1556,7 @@ fn page_layout(app: &mut SheetApp, ui: &mut Ui) { ); }); let __k = big_button(ui, Icon::Sheet, "Print\nTitles", "Print Titles", false); - control_keytip(app, ui, &__k, "pageSetup"); + control_keytip(app, ui, &__k, "pageLayout.printTitles"); if __k.clicked() { app.open_dialog("pageSetup", json!({"tab": "Sheet"})); }