M5.7: the Fill & Sign button follows the active tool and names it

Tools restored without a command (leaving full screen, the temporary
tool, the control channel) left the remembered Fill & Sign tool stale,
so the button could show Checkmark while a click placed a signature. The
bar now takes the remembered tool from the active one, which replaces the
dialog's and control channel's own updates. While a Fill & Sign tool is
active the button opens the flyout, so its label names the tool instead
of describing placing or adding a signature.
This commit is contained in:
Andrew committed 2026-11-03 05:51:32 -07:00
1 parent e90c92124c
commit edee301ebf
4 files changed
+18 -11

No files matched your search

+3 -6
View File
@@ -333,12 +333,9 @@ impl PdfCraftApp {
field if field.starts_with("field-") => QuickTool::Field(
prepare::FieldTool::from_command(&format!("form.add.{}", &field[6..])).ok_or_else(|| format!("unknown tool {field}"))?,
),
fill if fill.starts_with("fill-") => {
let f =
fill_sign::FillTool::from_command(&format!("sign.fill.{}", &fill[5..])).ok_or_else(|| format!("unknown tool {fill}"))?;
self.fill_tool = f;
QuickTool::Fill(f)
}
fill if fill.starts_with("fill-") => QuickTool::Fill(
fill_sign::FillTool::from_command(&format!("sign.fill.{}", &fill[5..])).ok_or_else(|| format!("unknown tool {fill}"))?,
),
other => {
let t = comments::CommentTool::from_command(&format!("comment.{other}")).ok_or_else(|| format!("unknown tool {other}"))?;
self.comment_prefs.group_tool[t.group()] = t;
-1
View File
@@ -1349,7 +1349,6 @@ fn dialog_signature(ui: &mut egui::Ui, app: &mut PdfCraftApp, req: &mut Pending)
app.signature = d.saved();
crate::fill_sign::FillTool::Signature
};
app.fill_tool = tool;
app.quick_tool = crate::QuickTool::Fill(tool);
app.toast = None;
}
+4 -1
View File
@@ -239,9 +239,12 @@ fn core_tool_buttons(ui: &mut egui::Ui, app: &mut PdfCraftApp, cell: f32, popup_
QuickTool::Fill(f) => Some(f),
_ => None,
};
if let Some(f) = current_fill {
app.fill_tool = f;
}
let shown = app.fill_tool;
let tip = match shown {
crate::fill_sign::FillTool::Signature | crate::fill_sign::FillTool::Initials => {
crate::fill_sign::FillTool::Signature | crate::fill_sign::FillTool::Initials if current_fill.is_none() => {
let initials = shown == crate::fill_sign::FillTool::Initials;
let saved = if initials { app.initials.is_some() } else { app.signature.is_some() };
crate::i18n::fmt(
+11 -3
View File
@@ -425,7 +425,7 @@ fn changing_saved_signatures_and_initials_preserves_placed_marks() {
// The quick toolbar exposes replacement without changing the normal placement action.
h.get_by_label("Fill & Sign: Place saved signature").click();
h.run_steps(2);
h.get_by_label("Fill & Sign: Place saved signature").click();
h.get_by_label("Fill & Sign: Sign").click();
h.run_steps(2);
h.get_by_label("Change signature").click();
h.run_steps(2);
@@ -447,7 +447,7 @@ fn changing_saved_signatures_and_initials_preserves_placed_marks() {
h.get_by_label("Fill & Sign: Place saved signature").click();
h.run_steps(2);
h.get_by_label("Fill & Sign: Place saved signature").click();
h.get_by_label("Fill & Sign: Sign").click();
h.run_steps(2);
h.get_by_label("Change initials").click();
h.run_steps(2);
@@ -1829,7 +1829,7 @@ fn the_quick_bar_fill_button_shows_the_tool_it_picks() {
h.run_steps(2);
assert_eq!(h.state().quick_tool, QuickTool::Fill(FillTool::Signature));
assert_eq!(h.state().dialog, None);
h.get_by_label("Fill & Sign: Place saved signature").click();
h.get_by_label("Fill & Sign: Sign").click();
h.run_steps(2);
assert_eq!(h.get_by_label("Use signature").accesskit_node().toggled(), Some(egui::accesskit::Toggled::True), "the active tool's card is marked");
h.key_press(egui::Key::Escape);
@@ -1841,4 +1841,12 @@ fn the_quick_bar_fill_button_shows_the_tool_it_picks() {
h.get_by_label("Fill & Sign: Checkmark").click();
h.run_steps(2);
assert_eq!(h.state().quick_tool, QuickTool::Fill(FillTool::Check), "the button keeps the last Fill & Sign tool");
h.state_mut().quick_tool = QuickTool::Fill(FillTool::Initials);
h.run_steps(2);
h.state_mut().quick_tool = QuickTool::Select;
h.run_steps(2);
h.get_by_label("Fill & Sign: Add initials").click();
h.run_steps(2);
assert_eq!(h.state().quick_tool, QuickTool::Fill(FillTool::Initials), "a tool restored without a command still updates the button");
}