mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-29 21:26:48 -06:00
Resolve James's real-Excel checks: drop QAT/Backstage and nonexistent View sequences; arrow navigation in the colour palette
- Side-by-side and synchronous-scrolling keytips removed (do not exist in James's Excel); Copy H,C / Spelling R,S / Fill H,H / Sparklines N,Z,K confirmed already correct - QAT digits 0-9 and Backstage account/home/options + legacy Share Workbook sequences dropped (no meaningful GridCraft target; not left as trash) - Colour palette (H,H fill and F,C font colour): arrow keys move a highlight through the swatches, Enter applies; key events are stripped so the grid behind the popup does not react
This commit is contained in:
@@ -27,18 +27,12 @@ pub const SEQUENCES: &[(&str, Entry)] = &[
|
||||
("HOI", Entry::Finish(Action::Command("home.autofitColumnWidth"))),
|
||||
("OCA", Entry::Finish(Action::Command("home.autofitColumnWidth"))), // Legacy Format menu.
|
||||
("WVG", Entry::Finish(Action::Command("view.gridlines"))),
|
||||
("0", Entry::Finish(Action::Pending("qat.10"))), // pending; Excel: Quick Access Toolbar position 10; QAT navigation does not exist yet
|
||||
("1", Entry::Finish(Action::Pending("qat.1"))), // pending; Excel: Quick Access Toolbar position 1; QAT navigation does not exist yet
|
||||
("2", Entry::Finish(Action::Pending("qat.2"))), // pending; Excel: Quick Access Toolbar position 2; QAT navigation does not exist yet
|
||||
("3", Entry::Finish(Action::Pending("qat.3"))), // pending; Excel: Quick Access Toolbar position 3; QAT navigation does not exist yet
|
||||
("4", Entry::Finish(Action::Pending("qat.4"))), // pending; Excel: Quick Access Toolbar position 4; QAT navigation does not exist yet
|
||||
("5", Entry::Finish(Action::Pending("qat.5"))), // pending; Excel: Quick Access Toolbar position 5; QAT navigation does not exist yet
|
||||
("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::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
|
||||
("H1", Entry::Finish(Action::Command("home.bold"))), // Excel: Bold
|
||||
("H2", Entry::Finish(Action::Command("home.italic"))), // Excel: Italic
|
||||
("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)
|
||||
("HAN", Entry::Finish(Action::Command("home.accounting"))), // Excel: Accounting Format; fires immediately in Excel; deeper aliases dropped as unreachable
|
||||
("HAS", Entry::Finish(Action::Command("home.addIns"))), // Excel: Add-ins; containment(Add-ins)
|
||||
@@ -335,9 +329,7 @@ pub const SEQUENCES: &[(&str, Entry)] = &[
|
||||
("RS", Entry::Finish(Action::Dialog("spelling"))), // Excel: Spelling
|
||||
("RTN", Entry::Finish(Action::Command("review.newNote"))), // Excel: New Note
|
||||
("RV", Entry::Finish(Action::Pending("review.previousComment"))), // pending; Excel: Previous Comment; Previous Comment; reserved until the command lands
|
||||
("RW", Entry::Finish(Action::Pending("review.shareWorkbook"))), // pending; Excel: Share Workbook; reserved until the command lands
|
||||
("WA", Entry::Finish(Action::Command("view.arrangeAll"))), // Excel: Arrange All
|
||||
("WB", Entry::Finish(Action::Pending("view.sideBySide"))), // pending; Excel: View Side by Side; reserved until the command lands
|
||||
("WC", Entry::Finish(Action::Command("view.customViews"))), // Excel: Custom Views
|
||||
("WF", Entry::Continue), // Excel: Freeze Panes Menu; group level:
|
||||
("WFC", Entry::Finish(Action::Command("view.freezeFirstColumn"))), // Excel: Freeze First Column
|
||||
@@ -361,30 +353,21 @@ pub const SEQUENCES: &[(&str, Entry)] = &[
|
||||
("WVC", Entry::Finish(Action::Pending("view.focusCell"))), // pending; Excel: Focus Cell Menu; Focus Cell; reserved until the command lands
|
||||
("WVF", Entry::Finish(Action::Control("view.formulaBar"))), // Excel: Toggle Formula Bar; toggles the formula bar
|
||||
("WVH", Entry::Finish(Action::Command("view.headings"))), // Excel: Toggle Headings; containment(Headings)
|
||||
("WVL", Entry::Finish(Action::Pending("view.synchronousScrolling"))), // pending; Excel: Synchronous Scrolling; Synchronous Scrolling; reserved until the command lands
|
||||
("WVN", Entry::Finish(Action::Pending("view.navigation"))), // pending; Excel: Navigation; Navigation pane; reserved until the command lands
|
||||
("WVR", Entry::Finish(Action::Command("view.ruler"))), // Excel: Ruler
|
||||
("WVV", Entry::Finish(Action::Pending("view.sideBySide"))), // pending; Excel: View Side by Side; reserved until the command lands
|
||||
("WW", Entry::Finish(Action::Command("view.switchWindows"))), // Excel: Switch Windows
|
||||
("WVN", Entry::Finish(Action::Pending("view.navigation"))), // pending; Excel: Navigation; Navigation pane; reserved until the command lands
|
||||
("WVR", Entry::Finish(Action::Command("view.ruler"))), // Excel: Ruler
|
||||
("WW", Entry::Finish(Action::Command("view.switchWindows"))), // Excel: Switch Windows
|
||||
("JAM", Entry::Finish(Action::Command("chart.formatSelection"))), // Excel: Chart format: Format Selection pane; containment(Format Selection)
|
||||
("JCA", Entry::Finish(Action::Command("chart.addElement"))), // Excel: Chart: Add Chart Element; containment(Add Chart Element)
|
||||
("JCC", Entry::Finish(Action::Command("chart.changeType"))), // Excel: Chart: Change Chart Type; containment(Change Chart Type)
|
||||
("JTS", Entry::Finish(Action::Command("table.style"))), // Excel: Table: table style
|
||||
("JCA", Entry::Finish(Action::Command("chart.addElement"))), // Excel: Chart: Add Chart Element; containment(Add Chart Element)
|
||||
("JCC", Entry::Finish(Action::Command("chart.changeType"))), // Excel: Chart: Change Chart Type; containment(Change Chart Type)
|
||||
("JTS", Entry::Finish(Action::Command("table.style"))), // Excel: Table: table style
|
||||
("JTV", Entry::Finish(Action::Command("table.summarizePivot"))), // Excel: Table: Summarize with PivotTable; containment(Summarize with PivotTable)
|
||||
("FA", Entry::Finish(Action::Command("file.saveAs"))), // Excel: Save / Save As page; fires immediately in Excel; deeper aliases dropped as unreachable
|
||||
("FC", Entry::Finish(Action::Command("file.close"))), // Excel: Close workbook
|
||||
("FD", Entry::Finish(Action::Pending("file.account"))), // pending; Excel: Account page; Account page; reserved until the command lands
|
||||
("FEA", Entry::Finish(Action::Command("file.exportPdf"))), // Excel: Export: create PDF/XPS; Export: create PDF/XPS
|
||||
("FEC", Entry::Finish(Action::Command("file.saveAs"))), // Excel: Export: change file type; Export: change file type
|
||||
("FH", Entry::Finish(Action::Pending("file.home"))), // pending; Excel: File Home page (recent/pinned/shared/new blank); File Home page; reserved until the command lands
|
||||
("FI", Entry::Finish(Action::Command("file.properties"))), // Excel: Info page; fires immediately in Excel; deeper aliases dropped as unreachable
|
||||
("FN", Entry::Finish(Action::Command("file.new"))), // Excel: New page; New page
|
||||
("FO", Entry::Finish(Action::Command("file.open"))), // Excel: Open page; fires immediately in Excel; deeper aliases dropped as unreachable
|
||||
("FP", Entry::Finish(Action::Command("file.print"))), // Excel: Print page; containment(Print)
|
||||
("FT", Entry::Finish(Action::Pending("file.options"))), // pending; Excel: Options dialog; Options dialog; reserved until the command lands
|
||||
("Q", Entry::Finish(Action::Pending("ui.search"))), // pending; Excel: Search / Tell Me; Alt+Q search box does not exist yet (issue #49)
|
||||
("6", Entry::Finish(Action::Pending("qat.6"))), // pending; Excel: Quick Access Toolbar position 6; QAT navigation does not exist yet
|
||||
("7", Entry::Finish(Action::Pending("qat.7"))), // pending; Excel: Quick Access Toolbar position 7; QAT navigation does not exist yet
|
||||
("8", Entry::Finish(Action::Pending("qat.8"))), // pending; Excel: Quick Access Toolbar position 8; QAT navigation does not exist yet
|
||||
("9", Entry::Finish(Action::Pending("qat.9"))), // pending; Excel: Quick Access Toolbar position 9; QAT navigation does not exist yet
|
||||
("FN", Entry::Finish(Action::Command("file.new"))), // Excel: New page; New page
|
||||
("FO", Entry::Finish(Action::Command("file.open"))), // Excel: Open page; fires immediately in Excel; deeper aliases dropped as unreachable
|
||||
("FP", Entry::Finish(Action::Command("file.print"))), // Excel: Print page; containment(Print)
|
||||
("Q", Entry::Finish(Action::Pending("ui.search"))), // pending; Excel: Search / Tell Me; Alt+Q search box does not exist yet (issue #49)
|
||||
];
|
||||
|
||||
@@ -124,54 +124,6 @@
|
||||
"kind": "command",
|
||||
"target": "view.gridlines"
|
||||
},
|
||||
{
|
||||
"seq": "0",
|
||||
"kind": "command",
|
||||
"target": "qat.10",
|
||||
"pending": true,
|
||||
"excel": "Quick Access Toolbar position 10",
|
||||
"note": "QAT navigation does not exist yet"
|
||||
},
|
||||
{
|
||||
"seq": "1",
|
||||
"kind": "command",
|
||||
"target": "qat.1",
|
||||
"pending": true,
|
||||
"excel": "Quick Access Toolbar position 1",
|
||||
"note": "QAT navigation does not exist yet"
|
||||
},
|
||||
{
|
||||
"seq": "2",
|
||||
"kind": "command",
|
||||
"target": "qat.2",
|
||||
"pending": true,
|
||||
"excel": "Quick Access Toolbar position 2",
|
||||
"note": "QAT navigation does not exist yet"
|
||||
},
|
||||
{
|
||||
"seq": "3",
|
||||
"kind": "command",
|
||||
"target": "qat.3",
|
||||
"pending": true,
|
||||
"excel": "Quick Access Toolbar position 3",
|
||||
"note": "QAT navigation does not exist yet"
|
||||
},
|
||||
{
|
||||
"seq": "4",
|
||||
"kind": "command",
|
||||
"target": "qat.4",
|
||||
"pending": true,
|
||||
"excel": "Quick Access Toolbar position 4",
|
||||
"note": "QAT navigation does not exist yet"
|
||||
},
|
||||
{
|
||||
"seq": "5",
|
||||
"kind": "command",
|
||||
"target": "qat.5",
|
||||
"pending": true,
|
||||
"excel": "Quick Access Toolbar position 5",
|
||||
"note": "QAT navigation does not exist yet"
|
||||
},
|
||||
{
|
||||
"seq": "H0",
|
||||
"kind": "command",
|
||||
@@ -2282,14 +2234,6 @@
|
||||
"excel": "Previous Comment",
|
||||
"note": "Previous Comment; reserved until the command lands"
|
||||
},
|
||||
{
|
||||
"seq": "RW",
|
||||
"kind": "command",
|
||||
"target": "review.shareWorkbook",
|
||||
"pending": true,
|
||||
"excel": "Share Workbook",
|
||||
"note": "reserved until the command lands"
|
||||
},
|
||||
{
|
||||
"seq": "WA",
|
||||
"kind": "command",
|
||||
@@ -2297,14 +2241,6 @@
|
||||
"excel": "Arrange All",
|
||||
"note": ""
|
||||
},
|
||||
{
|
||||
"seq": "WB",
|
||||
"kind": "command",
|
||||
"target": "view.sideBySide",
|
||||
"pending": true,
|
||||
"excel": "View Side by Side",
|
||||
"note": "reserved until the command lands"
|
||||
},
|
||||
{
|
||||
"seq": "WC",
|
||||
"kind": "command",
|
||||
@@ -2466,14 +2402,6 @@
|
||||
"excel": "Toggle Headings",
|
||||
"note": "containment(Headings)"
|
||||
},
|
||||
{
|
||||
"seq": "WVL",
|
||||
"kind": "command",
|
||||
"target": "view.synchronousScrolling",
|
||||
"pending": true,
|
||||
"excel": "Synchronous Scrolling",
|
||||
"note": "Synchronous Scrolling; reserved until the command lands"
|
||||
},
|
||||
{
|
||||
"seq": "WVN",
|
||||
"kind": "command",
|
||||
@@ -2489,14 +2417,6 @@
|
||||
"excel": "Ruler",
|
||||
"note": ""
|
||||
},
|
||||
{
|
||||
"seq": "WVV",
|
||||
"kind": "command",
|
||||
"target": "view.sideBySide",
|
||||
"pending": true,
|
||||
"excel": "View Side by Side",
|
||||
"note": "reserved until the command lands"
|
||||
},
|
||||
{
|
||||
"seq": "WW",
|
||||
"kind": "command",
|
||||
@@ -2552,14 +2472,6 @@
|
||||
"target": "file.close",
|
||||
"excel": "Close workbook"
|
||||
},
|
||||
{
|
||||
"seq": "FD",
|
||||
"kind": "command",
|
||||
"target": "file.account",
|
||||
"pending": true,
|
||||
"excel": "Account page",
|
||||
"note": "Account page; reserved until the command lands"
|
||||
},
|
||||
{
|
||||
"seq": "FEA",
|
||||
"kind": "command",
|
||||
@@ -2574,14 +2486,6 @@
|
||||
"excel": "Export: change file type",
|
||||
"note": "Export: change file type"
|
||||
},
|
||||
{
|
||||
"seq": "FH",
|
||||
"kind": "command",
|
||||
"target": "file.home",
|
||||
"pending": true,
|
||||
"excel": "File Home page (recent/pinned/shared/new blank)",
|
||||
"note": "File Home page; reserved until the command lands"
|
||||
},
|
||||
{
|
||||
"seq": "FI",
|
||||
"kind": "command",
|
||||
@@ -2610,14 +2514,6 @@
|
||||
"excel": "Print page",
|
||||
"note": "containment(Print)"
|
||||
},
|
||||
{
|
||||
"seq": "FT",
|
||||
"kind": "command",
|
||||
"target": "file.options",
|
||||
"pending": true,
|
||||
"excel": "Options dialog",
|
||||
"note": "Options dialog; reserved until the command lands"
|
||||
},
|
||||
{
|
||||
"seq": "Q",
|
||||
"kind": "command",
|
||||
@@ -2625,38 +2521,6 @@
|
||||
"pending": true,
|
||||
"excel": "Search / Tell Me",
|
||||
"note": "Alt+Q search box does not exist yet (issue #49)"
|
||||
},
|
||||
{
|
||||
"seq": "6",
|
||||
"kind": "command",
|
||||
"target": "qat.6",
|
||||
"pending": true,
|
||||
"excel": "Quick Access Toolbar position 6",
|
||||
"note": "QAT navigation does not exist yet"
|
||||
},
|
||||
{
|
||||
"seq": "7",
|
||||
"kind": "command",
|
||||
"target": "qat.7",
|
||||
"pending": true,
|
||||
"excel": "Quick Access Toolbar position 7",
|
||||
"note": "QAT navigation does not exist yet"
|
||||
},
|
||||
{
|
||||
"seq": "8",
|
||||
"kind": "command",
|
||||
"target": "qat.8",
|
||||
"pending": true,
|
||||
"excel": "Quick Access Toolbar position 8",
|
||||
"note": "QAT navigation does not exist yet"
|
||||
},
|
||||
{
|
||||
"seq": "9",
|
||||
"kind": "command",
|
||||
"target": "qat.9",
|
||||
"pending": true,
|
||||
"excel": "Quick Access Toolbar position 9",
|
||||
"note": "QAT navigation does not exist yet"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -145,9 +145,83 @@ pub fn committed_text(ui: &mut Ui, id: egui::Id, current: &str, width: Option<f3
|
||||
}
|
||||
|
||||
/// Our colour palette (theme row + tints + standard colours), returns a picked hex colour,
|
||||
/// `Some("none")` for No Fill/Automatic.
|
||||
/// `Some("none")` for No Fill/Automatic. Arrow keys move a highlight through the swatches and
|
||||
/// Enter applies; the key events are stripped so the grid behind the popup does not also react.
|
||||
pub fn color_palette(ui: &mut Ui, theme_colors: &[u32; 12], none_label: &str) -> Option<String> {
|
||||
let mut picked = None;
|
||||
const ROWS: usize = 7; // 6 tint rows + 1 standard row
|
||||
const COLS: usize = 10;
|
||||
let pal_id = ui.id().with("__color_palette");
|
||||
let mut cur: Option<(usize, usize)> = ui.data_mut(|d| d.get_temp(pal_id)).unwrap_or(None);
|
||||
let (mut dl, mut dr, mut du, mut dd, mut ent) = (false, false, false, false, false);
|
||||
ui.input(|i| {
|
||||
dl = i.key_pressed(egui::Key::ArrowLeft);
|
||||
dr = i.key_pressed(egui::Key::ArrowRight);
|
||||
du = i.key_pressed(egui::Key::ArrowUp);
|
||||
dd = i.key_pressed(egui::Key::ArrowDown);
|
||||
ent = i.key_pressed(egui::Key::Enter);
|
||||
});
|
||||
if dl || dr || du || dd {
|
||||
cur = match cur {
|
||||
None => Some((
|
||||
0,
|
||||
if dr {
|
||||
1
|
||||
} else if dl {
|
||||
COLS - 1
|
||||
} else {
|
||||
0
|
||||
},
|
||||
)),
|
||||
Some((r, c)) => {
|
||||
let r2 = if du {
|
||||
r.saturating_sub(1)
|
||||
} else if dd {
|
||||
(r + 1).min(ROWS - 1)
|
||||
} else {
|
||||
r
|
||||
};
|
||||
let c2 = if dl {
|
||||
(c + COLS - 1) % COLS
|
||||
} else if dr {
|
||||
(c + 1) % COLS
|
||||
} else {
|
||||
c
|
||||
};
|
||||
Some((r2, c2))
|
||||
}
|
||||
};
|
||||
}
|
||||
if dl || dr || du || dd || ent {
|
||||
ui.ctx().input_mut(|i| {
|
||||
i.events.retain(|e| {
|
||||
!matches!(
|
||||
e,
|
||||
egui::Event::Key {
|
||||
key: egui::Key::ArrowLeft | egui::Key::ArrowRight | egui::Key::ArrowUp | egui::Key::ArrowDown | egui::Key::Enter,
|
||||
pressed: true,
|
||||
..
|
||||
}
|
||||
)
|
||||
});
|
||||
});
|
||||
}
|
||||
let theme_hex = |base: u32, tint: f64| -> String {
|
||||
let rgb = [(base >> 16) as u8, (base >> 8) as u8, base as u8];
|
||||
let c = gridcraft_engine::model::style::apply_tint(rgb, tint);
|
||||
let (r0, r1, r2) = (c[0], c[1], c[2]);
|
||||
format!("#{r0:02X}{r1:02X}{r2:02X}")
|
||||
};
|
||||
let std_hex = ["#C00000", "#FF0000", "#FFC000", "#FFFF00", "#92D050", "#00B050", "#00B0F0", "#0070C0", "#002060", "#7030A0"];
|
||||
if ent && let Some((r, c)) = cur {
|
||||
picked = Some(if r < ROWS - 1 {
|
||||
let base = theme_colors.get(c).copied().unwrap_or(0);
|
||||
theme_hex(base, [0.0f64, 0.8, 0.6, 0.4, -0.25, -0.5][r])
|
||||
} else {
|
||||
std_hex[c].to_string()
|
||||
});
|
||||
ui.data_mut(|d| d.remove_temp::<Option<(usize, usize)>>(pal_id));
|
||||
}
|
||||
if ui.button(none_label).clicked() {
|
||||
picked = Some("none".to_string());
|
||||
}
|
||||
@@ -155,20 +229,20 @@ pub fn color_palette(ui: &mut Ui, theme_colors: &[u32; 12], none_label: &str) ->
|
||||
let order = [0usize, 1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||
let tints = [0.0f64, 0.8, 0.6, 0.4, -0.25, -0.5];
|
||||
egui::Grid::new(ui.id().with("theme_grid")).spacing(vec2(2.0, 2.0)).show(ui, |ui| {
|
||||
for tint in tints {
|
||||
for &i in &order {
|
||||
for (row, tint) in tints.iter().enumerate() {
|
||||
for (col, &i) in order.iter().enumerate() {
|
||||
let base = theme_colors.get(i).copied().unwrap_or(0);
|
||||
let rgb = [(base >> 16) as u8, (base >> 8) as u8, base as u8];
|
||||
let c = gridcraft_engine::model::style::apply_tint(rgb, tint);
|
||||
let col = Color32::from_rgb(c[0], c[1], c[2]);
|
||||
let c = gridcraft_engine::model::style::apply_tint(rgb, *tint);
|
||||
let col32 = Color32::from_rgb(c[0], c[1], c[2]);
|
||||
let (r, resp) = ui.allocate_exact_size(vec2(16.0, 14.0), Sense::click());
|
||||
ui.painter().rect_filled(r, 1.0, col);
|
||||
ui.painter().rect_filled(r, 1.0, col32);
|
||||
ui.painter().rect_stroke(r, 1.0, Stroke::new(1.0, Color32::from_gray(200)), StrokeKind::Inside);
|
||||
if resp.hovered() {
|
||||
if resp.hovered() || cur == Some((row, col)) {
|
||||
ui.painter().rect_stroke(r.expand(1.0), 1.0, Stroke::new(1.5, Color32::from_rgb(0xE8, 0x7D, 0x2B)), StrokeKind::Outside);
|
||||
}
|
||||
if resp.clicked() {
|
||||
picked = Some(format!("#{:02X}{:02X}{:02X}", c[0], c[1], c[2]));
|
||||
picked = Some(theme_hex(base, *tint));
|
||||
}
|
||||
}
|
||||
ui.end_row();
|
||||
@@ -177,18 +251,22 @@ pub fn color_palette(ui: &mut Ui, theme_colors: &[u32; 12], none_label: &str) ->
|
||||
ui.label(egui::RichText::new("Standard Colors").small());
|
||||
ui.horizontal(|ui| {
|
||||
ui.spacing_mut().item_spacing.x = 2.0;
|
||||
for hex in ["#C00000", "#FF0000", "#FFC000", "#FFFF00", "#92D050", "#00B050", "#00B0F0", "#0070C0", "#002060", "#7030A0"] {
|
||||
let col = gridcraft_engine::model::Color::from_hex(hex)
|
||||
for (col, hex) in std_hex.iter().enumerate() {
|
||||
let c = gridcraft_engine::model::Color::from_hex(hex)
|
||||
.and_then(|c| c.resolve(&Default::default()))
|
||||
.map(theme::color32)
|
||||
.unwrap_or(Color32::BLACK);
|
||||
let (r, resp) = ui.allocate_exact_size(vec2(16.0, 14.0), Sense::click());
|
||||
ui.painter().rect_filled(r, 1.0, col);
|
||||
ui.painter().rect_filled(r, 1.0, c);
|
||||
if resp.hovered() || cur == Some((ROWS - 1, col)) {
|
||||
ui.painter().rect_stroke(r.expand(1.0), 1.0, Stroke::new(1.5, Color32::from_rgb(0xE8, 0x7D, 0x2B)), StrokeKind::Outside);
|
||||
}
|
||||
if resp.clicked() {
|
||||
picked = Some(hex.to_string());
|
||||
}
|
||||
}
|
||||
});
|
||||
ui.data_mut(|d| d.insert_temp(pal_id, cur));
|
||||
picked
|
||||
}
|
||||
|
||||
|
||||
@@ -520,6 +520,21 @@ fn editable_combos_filter_by_typing_and_move_by_arrows() {
|
||||
assert_eq!(h.query_all_by_label("Candara").count(), 1, "filtered Enter must apply the filtered row");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn color_palette_navigates_with_arrows_and_enter_applies() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, &[Key::H, Key::H], false); // H,H opens the fill palette
|
||||
h.run_steps(3);
|
||||
key(&mut h, Key::ArrowDown); // highlight starts at theme row 0
|
||||
key(&mut h, Key::ArrowRight); // -> row 0, col 1 = Craft theme dk1 (#000000)
|
||||
key(&mut h, Key::Enter);
|
||||
h.run_steps(3);
|
||||
assert!(h.state().message.is_none() && h.state().toast.is_none(), "arrow+Enter must not error");
|
||||
assert_eq!(h.state().session.journal.iter().filter(|(id, _)| id == "home.fillColor").count(), 1, "Enter applies the highlighted swatch");
|
||||
assert_eq!(h.state().grid.last_fill, "#000000", "the applied fill is the highlighted colour");
|
||||
assert_eq!(h.query_all_by_label("Theme Colors").count(), 0, "the palette closes after applying");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn every_sequence_terminates_without_panicking() {
|
||||
use gridcraft_ui_egui::keytips::keytip_table::SEQUENCES;
|
||||
|
||||
@@ -206,66 +206,6 @@ fn keytip_wvg_() {
|
||||
assert!(h.state().session.journal.iter().any(|(id, _)| id == "view.gridlines"), "WVG must journal view.gridlines");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_0_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "0", false);
|
||||
assert!(h.state().dialog.is_none(), "0 must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "0 must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "0 must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "0 must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_1_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "1", false);
|
||||
assert!(h.state().dialog.is_none(), "1 must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "1 must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "1 must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "1 must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_2_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "2", false);
|
||||
assert!(h.state().dialog.is_none(), "2 must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "2 must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "2 must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "2 must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_3_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "3", false);
|
||||
assert!(h.state().dialog.is_none(), "3 must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "3 must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "3 must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "3 must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_4_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "4", false);
|
||||
assert!(h.state().dialog.is_none(), "4 must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "4 must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "4 must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "4 must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_5_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "5", false);
|
||||
assert!(h.state().dialog.is_none(), "5 must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "5 must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "5 must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "5 must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_h0_() {
|
||||
let mut h = harness(blank());
|
||||
@@ -2516,16 +2456,6 @@ fn keytip_rv_() {
|
||||
assert!(h.state().session.journal.is_empty(), "RV must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_rw_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "RW", false);
|
||||
assert!(h.state().dialog.is_none(), "RW must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "RW must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "RW must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "RW must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_wa_() {
|
||||
let mut h = harness(blank());
|
||||
@@ -2533,16 +2463,6 @@ fn keytip_wa_() {
|
||||
assert!(h.state().session.journal.iter().any(|(id, _)| id == "view.arrangeAll"), "WA must journal view.arrangeAll");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_wb_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "WB", false);
|
||||
assert!(h.state().dialog.is_none(), "WB must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "WB must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "WB must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "WB must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_wc_() {
|
||||
let mut h = harness(blank());
|
||||
@@ -2712,16 +2632,6 @@ fn keytip_wvh_() {
|
||||
assert!(h.state().session.journal.iter().any(|(id, _)| id == "view.headings"), "WVH must journal view.headings");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_wvl_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "WVL", false);
|
||||
assert!(h.state().dialog.is_none(), "WVL must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "WVL must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "WVL must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "WVL must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_wvn_() {
|
||||
let mut h = harness(blank());
|
||||
@@ -2739,16 +2649,6 @@ fn keytip_wvr_() {
|
||||
assert!(h.state().session.journal.iter().any(|(id, _)| id == "view.ruler"), "WVR must journal view.ruler");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_wvv_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "WVV", false);
|
||||
assert!(h.state().dialog.is_none(), "WVV must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "WVV must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "WVV must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "WVV must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_ww_() {
|
||||
let mut h = harness(blank());
|
||||
@@ -2805,16 +2705,6 @@ fn keytip_fc_() {
|
||||
assert!(h.state().session.journal.iter().any(|(id, _)| id == "file.close"), "FC must journal file.close");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_fd_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "FD", false);
|
||||
assert!(h.state().dialog.is_none(), "FD must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "FD must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "FD must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "FD must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_fea_() {
|
||||
let mut h = harness(blank());
|
||||
@@ -2829,16 +2719,6 @@ fn keytip_fec_() {
|
||||
assert!(h.state().session.journal.iter().any(|(id, _)| id == "file.saveAs"), "FEC must journal file.saveAs");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_fh_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "FH", false);
|
||||
assert!(h.state().dialog.is_none(), "FH must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "FH must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "FH must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "FH must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_fi_() {
|
||||
let mut h = harness(blank());
|
||||
@@ -2867,16 +2747,6 @@ fn keytip_fp_() {
|
||||
assert!(h.state().session.journal.iter().any(|(id, _)| id == "file.print"), "FP must journal file.print");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_ft_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "FT", false);
|
||||
assert!(h.state().dialog.is_none(), "FT must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "FT must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "FT must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "FT must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_q_() {
|
||||
let mut h = harness(blank());
|
||||
@@ -2887,49 +2757,9 @@ fn keytip_q_() {
|
||||
assert!(h.state().session.journal.is_empty(), "Q must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_6_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "6", false);
|
||||
assert!(h.state().dialog.is_none(), "6 must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "6 must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "6 must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "6 must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_7_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "7", false);
|
||||
assert!(h.state().dialog.is_none(), "7 must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "7 must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "7 must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "7 must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_8_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "8", false);
|
||||
assert!(h.state().dialog.is_none(), "8 must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "8 must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "8 must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "8 must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keytip_9_() {
|
||||
let mut h = harness(blank());
|
||||
sequence(&mut h, "9", false);
|
||||
assert!(h.state().dialog.is_none(), "9 must not open a dialog");
|
||||
assert!(h.state().message.is_none(), "9 must not open a message box");
|
||||
assert!(h.state().toast.is_none(), "9 must not raise a toast");
|
||||
assert!(h.state().session.journal.is_empty(), "9 must not journal");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn generated_test_count_matches_the_table() {
|
||||
const EXPECTED: usize = 381;
|
||||
const EXPECTED: usize = 364;
|
||||
assert_eq!(gridcraft_ui_egui::keytips::keytip_table::SEQUENCES.len(), EXPECTED);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user