Repository navigation
M6: keep field defaults in range; disable the item without a look - #2844
Open
marcoarnulfo wants to merge 2 commits into
Open
marcoarnulfo wants to merge 2 commits into
marcoarnulfo wants to merge 2 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prepare a form: Use Current Properties as New Defaults for form fields
In Acrobat's Prepare Form you can right-click a field and choose Use Current Properties as New Defaults. Fields you add afterwards with the same tool get that field's properties, and fields that already exist stay as they are. This PR adds that item to the field's context menu in Prepare a form. It saves the right-clicked widget's Appearance tab (border and fill colour or none, line width and style, text colour, font) and its font size. Each field tool keeps its own defaults, so an image field and a button stay separate even though both are push buttons, and so do a date field and a text field. The defaults are saved with the settings and survive a restart. Check boxes, radio buttons and signatures take only the border and fill properties, and their
/DAis left alone, so the ZapfDingbats mark is unaffected. A radio button that joins a group changes only its own widget. Choosing the item doesn't change the document, and a short notice confirms it. A tool with no saved defaults behaves as before.Edit::AddFieldgets an optionallook, so the field and its look are added in a single Undo step.form_add_fieldtakes the sameappearanceandfont_sizearguments asform_set_props, so the same result is reachable headless. Out of scope: the General and Options properties, which Acrobat may also carry over (I couldn't confirm which ones from its docs), and a "reset to built-in" command. Detected fields and fields added by document JavaScript keep ignoring the user's defaults. Happy to switch the per-tool split, or to have Image share Button's defaults. A default read from a field is clamped to what the Appearance tab accepts, so a file with/BS /W 15can't leave a tool unable to make fields. The two new strings are in all 22 catalogs; a native speaker's glance at the non-Latin ones (Arabic, Bulgarian, Greek, Japanese, Kazakh, Russian, Telugu, Ukrainian, Chinese) would be welcome.This is the second half of #2831. #2840 covers the first half (detected fields get no border or fill). The two PRs touch the same lines in two places:
auto_detect_fieldsinjs.rs, and theEdit::AddFieldconstructor in #2840's engine test. Whichever PR lands second needs one morelook: None,line, and I'll rebase promptly if #2840 merges first.Validation:
a_new_field_starts_with_the_saved_look,a_bad_saved_look_is_refused(forms): with the look ignored, they fail (the field gets the grey border and white fill, and an out-of-range width is accepted); they pass herecurrent_properties_become_the_new_defaults_of_that_tool(ui-egui prepare),field_defaults_are_saved_with_the_settings,a_field_added_with_a_look_starts_with_it(automation): fail to compile on main (nolook, nofield_defaults), pass hereout_of_range_properties_are_clamped_as_defaults: a field read with/BS /W 15and/MK /BC [2 0 0]becomes a default of width 12 and red; without the clamp the next new field is refusedcargo clippy -p pdfcraft-forms -p pdfcraft-engine -p pdfcraft-automation -p pdfcraft-ui-egui --all-targets -- -D warnings,cargo fmt --all -- --check,cargo xtask parity