mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 20:48:11 +08:00
Auto-generate enum type widget boilerplate for radio buttons and dropdown menus (#2589)
* First draft of factoring out the dropdown boilerplate * Add proc macro for enum boilerplate * Detect whether to say `crate` or the name * Clean up the input and naming of the enum macro * Rename a file * Do the rename of code too * Use the attribute-driven selection of radio vs dropdown * Add a metadata struct and tooltips * Move the new traits to a better place. * Use ChoiceType, part 1 * Use ChoiceType, part 2 * Introduce a builder API for choice widgets * Start using the new new API * DomainWarpType should be a dropdown still * Handle the case where a node property can never have a socket * Rustfmt * Code review * Update stable node IDs in test --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
co-authored by
Keavon Chambers
parent
9303953cf8
commit
9ef9b205d9
@@ -414,16 +414,15 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
action: MenuBarEntry::no_action(),
|
||||
disabled: no_active_document || !has_selected_layers,
|
||||
children: MenuBarEntryChildren(vec![{
|
||||
let operations = BooleanOperation::list();
|
||||
let icons = BooleanOperation::icons();
|
||||
operations
|
||||
.into_iter()
|
||||
.zip(icons)
|
||||
.map(move |(operation, icon)| MenuBarEntry {
|
||||
label: operation.to_string(),
|
||||
icon: Some(icon.into()),
|
||||
let list = <BooleanOperation as graphene_core::registry::ChoiceTypeStatic>::list();
|
||||
list.into_iter()
|
||||
.map(|i| i.into_iter())
|
||||
.flatten()
|
||||
.map(move |(operation, info)| MenuBarEntry {
|
||||
label: info.label.to_string(),
|
||||
icon: info.icon.as_ref().map(|i| i.to_string()),
|
||||
action: MenuBarEntry::create_action(move |_| {
|
||||
let group_folder_type = GroupFolderType::BooleanOperation(operation);
|
||||
let group_folder_type = GroupFolderType::BooleanOperation(*operation);
|
||||
DocumentMessage::GroupSelectedLayers { group_folder_type }.into()
|
||||
}),
|
||||
disabled: no_active_document || !has_selected_layers,
|
||||
|
||||
Reference in New Issue
Block a user