mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-29 17:55:45 +01:00
A Save on macOS that offers two or more file types showed rfd's panel,
which allows every type's extension but has no menu to pick one, and
answered without a picked type. A document saved from such a panel kept
the suggested extension unless the user typed another one.
- macos.rs: such a Save is a sheet made with a Format menu (the panel's
accessory view, set before the sheet begins). The menu lists each type
by name with the suggested name's type chosen. Choosing a type puts its
extensions first in the allowed types and changes the extension in the
name field. The answer is `Saved` with the chosen type in `filter`, so
the save flow's picked-type rules apply as they do for the portal.
- format_menu.rs: the rules, tested on every platform: which types the
menu lists, distinct item titles, the renamed name, the allowed
extensions, and the type an answer reports (an extension the user typed
for another listed type wins; a name the panel kept with the suggested
extension keeps the chosen type).
- craft-appkit: `save_panel::new_save_panel` (nil from AppKit is `None`)
and `save_panel::on_choose` (a pop-up menu's action as a closure).
- `FileDialog::format_label` and `FilePanels::set_format_label` set the
menu's label in the app's language ("Format:" when unset).