mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-02 08:28:12 +08:00
Restyle and refactor shortcut labels to send hints bar and welcome screen layouts from Rust (#3447)
* Restyle UserInputLabel and refactor its usages to have all input its data sent from Rust * Replace the welcome screen quick buttons with ones sent by backend * Add the ShortcutLabel widget to the backend * Replace hints bar with a backend-controlled layout; show mouse icons in place of mouse labels
This commit is contained in:
@@ -232,7 +232,7 @@ impl<T: TableRowLayout> TableRowLayout for Vec<T> {
|
||||
|
||||
rows.insert(0, column_headings(&["", "element"]));
|
||||
|
||||
vec![LayoutGroup::Table { rows }]
|
||||
vec![LayoutGroup::Table { rows, unstyled: false }]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ impl<T: TableRowLayout> TableRowLayout for Table<T> {
|
||||
|
||||
rows.insert(0, column_headings(&["", "element", "transform", "alpha_blending", "source_node_id"]));
|
||||
|
||||
vec![LayoutGroup::Table { rows }]
|
||||
vec![LayoutGroup::Table { rows, unstyled: false }]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,7 +490,7 @@ impl TableRowLayout for Vector {
|
||||
}
|
||||
}
|
||||
|
||||
vec![LayoutGroup::Row { widgets: table_tabs }, LayoutGroup::Table { rows: table_rows }]
|
||||
vec![LayoutGroup::Row { widgets: table_tabs }, LayoutGroup::Table { rows: table_rows, unstyled: false }]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ use super::utility_types::network_interface::{self, NodeNetworkInterface, Transa
|
||||
use super::utility_types::nodes::{CollapsedLayers, SelectedNodes};
|
||||
use crate::application::{GRAPHITE_GIT_COMMIT_HASH, generate_uuid};
|
||||
use crate::consts::{ASYMPTOTIC_EFFECT, COLOR_OVERLAY_GRAY, DEFAULT_DOCUMENT_NAME, FILE_EXTENSION, SCALE_EFFECT, SCROLLBAR_SPACING, VIEWPORT_ROTATE_SNAP_INTERVAL};
|
||||
use crate::messages::input_mapper::utility_types::macros::action_keys;
|
||||
use crate::messages::input_mapper::utility_types::macros::action_shortcut;
|
||||
use crate::messages::layout::utility_types::widget_prelude::*;
|
||||
use crate::messages::portfolio::document::data_panel::{DataPanelMessageContext, DataPanelMessageHandler};
|
||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
||||
@@ -2212,20 +2212,20 @@ impl DocumentMessageHandler {
|
||||
let mut widgets = vec![
|
||||
IconButton::new("PlaybackToStart", 24)
|
||||
.tooltip_label("Restart Animation")
|
||||
.shortcut_keys(action_keys!(AnimationMessageDiscriminant::RestartAnimation))
|
||||
.tooltip_shortcut(action_shortcut!(AnimationMessageDiscriminant::RestartAnimation))
|
||||
.on_update(|_| AnimationMessage::RestartAnimation.into())
|
||||
.disabled(time == Duration::ZERO)
|
||||
.widget_holder(),
|
||||
IconButton::new(if animation_is_playing { "PlaybackPause" } else { "PlaybackPlay" }, 24)
|
||||
.tooltip_label(if animation_is_playing { "Pause Animation" } else { "Play Animation" })
|
||||
.shortcut_keys(action_keys!(AnimationMessageDiscriminant::ToggleLivePreview))
|
||||
.tooltip_shortcut(action_shortcut!(AnimationMessageDiscriminant::ToggleLivePreview))
|
||||
.on_update(|_| AnimationMessage::ToggleLivePreview.into())
|
||||
.widget_holder(),
|
||||
Separator::new(SeparatorType::Unrelated).widget_holder(),
|
||||
CheckboxInput::new(self.overlays_visibility_settings.all)
|
||||
.icon("Overlays")
|
||||
.tooltip_label("Overlays")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::ToggleOverlaysVisibility))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::ToggleOverlaysVisibility))
|
||||
.on_update(|optional_input: &CheckboxInput| {
|
||||
DocumentMessage::SetOverlaysVisibility {
|
||||
visible: optional_input.checked,
|
||||
@@ -2474,7 +2474,7 @@ impl DocumentMessageHandler {
|
||||
CheckboxInput::new(snapping_state.snapping_enabled)
|
||||
.icon("Snapping")
|
||||
.tooltip_label("Snapping")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::ToggleSnapping))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::ToggleSnapping))
|
||||
.on_update(move |optional_input: &CheckboxInput| {
|
||||
DocumentMessage::SetSnapping {
|
||||
closure: Some(|snapping_state| &mut snapping_state.snapping_enabled),
|
||||
@@ -2544,7 +2544,7 @@ impl DocumentMessageHandler {
|
||||
CheckboxInput::new(self.snapping_state.grid_snapping)
|
||||
.icon("Grid")
|
||||
.tooltip_label("Grid")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::ToggleGridVisibility))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::ToggleGridVisibility))
|
||||
.on_update(|optional_input: &CheckboxInput| DocumentMessage::GridVisibility { visible: optional_input.checked }.into())
|
||||
.widget_holder(),
|
||||
PopoverButton::new()
|
||||
@@ -2626,7 +2626,7 @@ impl DocumentMessageHandler {
|
||||
.icon(Some((if self.graph_view_overlay_open { "GraphViewOpen" } else { "GraphViewClosed" }).into()))
|
||||
.hover_icon(Some((if self.graph_view_overlay_open { "GraphViewClosed" } else { "GraphViewOpen" }).into()))
|
||||
.tooltip_label(if self.graph_view_overlay_open { "Hide Node Graph" } else { "Show Node Graph" })
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::GraphViewOverlayToggle))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::GraphViewOverlayToggle))
|
||||
.on_update(move |_| DocumentMessage::GraphViewOverlayToggle.into())
|
||||
.widget_holder(),
|
||||
]);
|
||||
@@ -2778,14 +2778,14 @@ impl DocumentMessageHandler {
|
||||
IconButton::new(if selection_all_locked { "PadlockLocked" } else { "PadlockUnlocked" }, 24)
|
||||
.hover_icon(Some((if selection_all_locked { "PadlockUnlocked" } else { "PadlockLocked" }).into()))
|
||||
.tooltip_label(if selection_all_locked { "Unlock Selected" } else { "Lock Selected" })
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::ToggleSelectedLocked))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::ToggleSelectedLocked))
|
||||
.on_update(|_| NodeGraphMessage::ToggleSelectedLocked.into())
|
||||
.disabled(!has_selection)
|
||||
.widget_holder(),
|
||||
IconButton::new(if selection_all_visible { "EyeVisible" } else { "EyeHidden" }, 24)
|
||||
.hover_icon(Some((if selection_all_visible { "EyeHide" } else { "EyeShow" }).into()))
|
||||
.tooltip_label(if selection_all_visible { "Hide Selected" } else { "Show Selected" })
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::ToggleSelectedVisibility))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::ToggleSelectedVisibility))
|
||||
.on_update(|_| DocumentMessage::ToggleSelectedVisibility.into())
|
||||
.disabled(!has_selection)
|
||||
.widget_holder(),
|
||||
@@ -2850,7 +2850,7 @@ impl DocumentMessageHandler {
|
||||
Separator::new(SeparatorType::Unrelated).widget_holder(),
|
||||
IconButton::new("Folder", 24)
|
||||
.tooltip_label("Group Selected")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::GroupSelectedLayers))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::GroupSelectedLayers))
|
||||
.on_update(|_| {
|
||||
let group_folder_type = GroupFolderType::Layer;
|
||||
DocumentMessage::GroupSelectedLayers { group_folder_type }.into()
|
||||
@@ -2859,12 +2859,12 @@ impl DocumentMessageHandler {
|
||||
.widget_holder(),
|
||||
IconButton::new("NewLayer", 24)
|
||||
.tooltip_label("New Layer")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::CreateEmptyFolder))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::CreateEmptyFolder))
|
||||
.on_update(|_| DocumentMessage::CreateEmptyFolder.into())
|
||||
.widget_holder(),
|
||||
IconButton::new("Trash", 24)
|
||||
.tooltip_label("Delete Selected")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::DeleteSelectedLayers))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::DeleteSelectedLayers))
|
||||
.on_update(|_| DocumentMessage::DeleteSelectedLayers.into())
|
||||
.disabled(!has_selection)
|
||||
.widget_holder(),
|
||||
@@ -3148,17 +3148,17 @@ pub fn navigation_controls(ptz: &PTZ, navigation_handler: &NavigationMessageHand
|
||||
let mut list = vec![
|
||||
IconButton::new("ZoomIn", 24)
|
||||
.tooltip_label("Zoom In")
|
||||
.shortcut_keys(action_keys!(NavigationMessageDiscriminant::CanvasZoomIncrease))
|
||||
.tooltip_shortcut(action_shortcut!(NavigationMessageDiscriminant::CanvasZoomIncrease))
|
||||
.on_update(|_| NavigationMessage::CanvasZoomIncrease { center_on_mouse: false }.into())
|
||||
.widget_holder(),
|
||||
IconButton::new("ZoomOut", 24)
|
||||
.tooltip_label("Zoom Out")
|
||||
.shortcut_keys(action_keys!(NavigationMessageDiscriminant::CanvasZoomDecrease))
|
||||
.tooltip_shortcut(action_shortcut!(NavigationMessageDiscriminant::CanvasZoomDecrease))
|
||||
.on_update(|_| NavigationMessage::CanvasZoomDecrease { center_on_mouse: false }.into())
|
||||
.widget_holder(),
|
||||
IconButton::new("ZoomReset", 24)
|
||||
.tooltip_label("Reset Tilt and Zoom to 100%")
|
||||
.shortcut_keys(action_keys!(NavigationMessageDiscriminant::CanvasTiltResetAndZoomTo100Percent))
|
||||
.tooltip_shortcut(action_shortcut!(NavigationMessageDiscriminant::CanvasTiltResetAndZoomTo100Percent))
|
||||
.on_update(|_| NavigationMessage::CanvasTiltResetAndZoomTo100Percent.into())
|
||||
.disabled(ptz.tilt().abs() < 1e-4 && (ptz.zoom() - 1.).abs() < 1e-4)
|
||||
.widget_holder(),
|
||||
@@ -3168,7 +3168,7 @@ pub fn navigation_controls(ptz: &PTZ, navigation_handler: &NavigationMessageHand
|
||||
IconButton::new("Reverse", 24)
|
||||
.tooltip_label("Unflip Canvas")
|
||||
.tooltip_description("Flip the canvas back to its standard orientation.")
|
||||
.shortcut_keys(action_keys!(NavigationMessageDiscriminant::CanvasFlip))
|
||||
.tooltip_shortcut(action_shortcut!(NavigationMessageDiscriminant::CanvasFlip))
|
||||
.on_update(|_| NavigationMessage::CanvasFlip.into())
|
||||
.widget_holder(),
|
||||
);
|
||||
|
||||
@@ -77,9 +77,7 @@ impl MessageHandler<NavigationMessage, NavigationMessageContext<'_>> for Navigat
|
||||
NavigationMessage::BeginCanvasPan => {
|
||||
responses.add(FrontendMessage::UpdateMouseCursor { cursor: MouseCursorIcon::Grabbing });
|
||||
|
||||
responses.add(FrontendMessage::UpdateInputHints {
|
||||
hint_data: HintData(vec![HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()])]),
|
||||
});
|
||||
HintData(vec![HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()])]).send_layout(responses);
|
||||
|
||||
self.mouse_position = ipp.mouse.position;
|
||||
let Some(ptz) = get_ptz(document_ptz, network_interface, graph_view_overlay_open, breadcrumb_network_path) else {
|
||||
@@ -96,12 +94,11 @@ impl MessageHandler<NavigationMessage, NavigationMessageContext<'_>> for Navigat
|
||||
responses.add(NavigationMessage::BeginCanvasPan);
|
||||
} else {
|
||||
responses.add(FrontendMessage::UpdateMouseCursor { cursor: MouseCursorIcon::Default });
|
||||
responses.add(FrontendMessage::UpdateInputHints {
|
||||
hint_data: HintData(vec![
|
||||
HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()]),
|
||||
HintGroup(vec![HintInfo::keys([Key::Shift], "15° Increments")]),
|
||||
]),
|
||||
});
|
||||
HintData(vec![
|
||||
HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()]),
|
||||
HintGroup(vec![HintInfo::keys([Key::Shift], "15° Increments")]),
|
||||
])
|
||||
.send_layout(responses);
|
||||
|
||||
self.navigation_operation = NavigationOperation::Tilt {
|
||||
tilt_original_for_abort: ptz.tilt(),
|
||||
@@ -119,12 +116,11 @@ impl MessageHandler<NavigationMessage, NavigationMessageContext<'_>> for Navigat
|
||||
};
|
||||
|
||||
responses.add(FrontendMessage::UpdateMouseCursor { cursor: MouseCursorIcon::ZoomIn });
|
||||
responses.add(FrontendMessage::UpdateInputHints {
|
||||
hint_data: HintData(vec![
|
||||
HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()]),
|
||||
HintGroup(vec![HintInfo::keys([Key::Shift], "Increments")]),
|
||||
]),
|
||||
});
|
||||
HintData(vec![
|
||||
HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()]),
|
||||
HintGroup(vec![HintInfo::keys([Key::Shift], "Increments")]),
|
||||
])
|
||||
.send_layout(responses);
|
||||
|
||||
self.navigation_operation = NavigationOperation::Zoom {
|
||||
zoom_raw_not_snapped: ptz.zoom(),
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
use super::utility_types::{BoxSelection, ContextMenuInformation, DragStart, FrontendNode};
|
||||
use super::{document_node_definitions, node_properties};
|
||||
use crate::consts::GRID_SIZE;
|
||||
use crate::messages::input_mapper::utility_types::input_keyboard::KeysGroup;
|
||||
use crate::messages::input_mapper::utility_types::macros::action_keys;
|
||||
use crate::messages::input_mapper::utility_types::macros::{action_shortcut, action_shortcut_manual};
|
||||
use crate::messages::layout::utility_types::widget_prelude::*;
|
||||
use crate::messages::portfolio::document::document_message_handler::navigation_controls;
|
||||
use crate::messages::portfolio::document::graph_operation::utility_types::ModifyInputsContext;
|
||||
@@ -2108,7 +2107,7 @@ impl NodeGraphMessageHandler {
|
||||
.icon(Some("Node".to_string()))
|
||||
.tooltip_label("New Node")
|
||||
.tooltip_description("To add a node at the pointer location, perform the shortcut in an open area of the graph.")
|
||||
.tooltip_shortcut(Key::MouseRight.to_string())
|
||||
.tooltip_shortcut(action_shortcut_manual!(Key::MouseRight))
|
||||
.popover_layout({
|
||||
// Showing only compatible types
|
||||
let compatible_type = match (selection_includes_layers, has_multiple_selection, selected_layer) {
|
||||
@@ -2154,7 +2153,7 @@ impl NodeGraphMessageHandler {
|
||||
//
|
||||
IconButton::new("Folder", 24)
|
||||
.tooltip_label("Group Selected")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::GroupSelectedLayers))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::GroupSelectedLayers))
|
||||
.on_update(|_| {
|
||||
let group_folder_type = GroupFolderType::Layer;
|
||||
DocumentMessage::GroupSelectedLayers { group_folder_type }.into()
|
||||
@@ -2163,12 +2162,12 @@ impl NodeGraphMessageHandler {
|
||||
.widget_holder(),
|
||||
IconButton::new("NewLayer", 24)
|
||||
.tooltip_label("New Layer")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::CreateEmptyFolder))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::CreateEmptyFolder))
|
||||
.on_update(|_| DocumentMessage::CreateEmptyFolder.into())
|
||||
.widget_holder(),
|
||||
IconButton::new("Trash", 24)
|
||||
.tooltip_label("Delete Selected")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::DeleteSelectedLayers))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::DeleteSelectedLayers))
|
||||
.on_update(|_| DocumentMessage::DeleteSelectedLayers.into())
|
||||
.disabled(!has_selection)
|
||||
.widget_holder(),
|
||||
@@ -2178,14 +2177,14 @@ impl NodeGraphMessageHandler {
|
||||
IconButton::new(if selection_all_locked { "PadlockLocked" } else { "PadlockUnlocked" }, 24)
|
||||
.hover_icon(Some((if selection_all_locked { "PadlockUnlocked" } else { "PadlockLocked" }).into()))
|
||||
.tooltip_label(if selection_all_locked { "Unlock Selected" } else { "Lock Selected" })
|
||||
.shortcut_keys(action_keys!(NodeGraphMessageDiscriminant::ToggleSelectedLocked))
|
||||
.tooltip_shortcut(action_shortcut!(NodeGraphMessageDiscriminant::ToggleSelectedLocked))
|
||||
.on_update(|_| NodeGraphMessage::ToggleSelectedLocked.into())
|
||||
.disabled(!has_selection || !selection_includes_layers)
|
||||
.widget_holder(),
|
||||
IconButton::new(if selection_all_visible { "EyeVisible" } else { "EyeHidden" }, 24)
|
||||
.hover_icon(Some((if selection_all_visible { "EyeHide" } else { "EyeShow" }).into()))
|
||||
.tooltip_label(if selection_all_visible { "Hide Selected" } else { "Show Selected" })
|
||||
.shortcut_keys(action_keys!(NodeGraphMessageDiscriminant::ToggleSelectedVisibility))
|
||||
.tooltip_shortcut(action_shortcut!(NodeGraphMessageDiscriminant::ToggleSelectedVisibility))
|
||||
.on_update(|_| NodeGraphMessage::ToggleSelectedVisibility.into())
|
||||
.disabled(!has_selection)
|
||||
.widget_holder(),
|
||||
@@ -2225,7 +2224,7 @@ impl NodeGraphMessageHandler {
|
||||
.icon(Some("FrameAll".to_string()))
|
||||
.tooltip_label("Preview")
|
||||
.tooltip_description("Temporarily set the graph output to the selected node or layer. Perform the shortcut on a node or layer for quick access.")
|
||||
.tooltip_shortcut(KeysGroup(vec![Key::Alt, Key::MouseLeft]).to_string())
|
||||
.tooltip_shortcut(action_shortcut_manual!(Key::Alt, Key::MouseLeft))
|
||||
.on_update(move |_| NodeGraphMessage::TogglePreview { node_id }.into())
|
||||
.widget_holder();
|
||||
widgets.extend([Separator::new(SeparatorType::Unrelated).widget_holder(), button]);
|
||||
@@ -2284,7 +2283,7 @@ impl NodeGraphMessageHandler {
|
||||
.icon(Some("GraphViewOpen".into()))
|
||||
.hover_icon(Some("GraphViewClosed".into()))
|
||||
.tooltip_label("Hide Node Graph")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::GraphViewOverlayToggle))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::GraphViewOverlayToggle))
|
||||
.on_update(move |_| DocumentMessage::GraphViewOverlayToggle.into())
|
||||
.widget_holder(),
|
||||
]);
|
||||
@@ -2720,8 +2719,7 @@ impl NodeGraphMessageHandler {
|
||||
|
||||
// Cancel the ongoing action
|
||||
if wiring || dragging_nodes || dragging_box_selection {
|
||||
let hint_data = HintData(vec![HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()])]);
|
||||
responses.add(FrontendMessage::UpdateInputHints { hint_data });
|
||||
HintData(vec![HintGroup(vec![HintInfo::mouse(MouseMotion::Rmb, ""), HintInfo::keys([Key::Escape], "Cancel").prepend_slash()])]).send_layout(responses);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2749,7 +2747,7 @@ impl NodeGraphMessageHandler {
|
||||
HintGroup(vec![HintInfo::mouse(MouseMotion::LmbDouble, "Enter Node Subgraph")]),
|
||||
HintGroup(vec![HintInfo::keys_and_mouse([Key::Alt], MouseMotion::Lmb, "Preview Node Output")]),
|
||||
]);
|
||||
responses.add(FrontendMessage::UpdateInputHints { hint_data });
|
||||
hint_data.send_layout(responses);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -452,8 +452,7 @@ impl TransformOperation {
|
||||
}
|
||||
hint_groups.push(HintGroup(typing_hints));
|
||||
|
||||
let hint_data = HintData(hint_groups);
|
||||
responses.add(FrontendMessage::UpdateInputHints { hint_data });
|
||||
HintData(hint_groups).send_layout(responses);
|
||||
}
|
||||
|
||||
pub fn is_constraint_to_axis(&self) -> bool {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::messages::debug::utility_types::MessageLoggingVerbosity;
|
||||
use crate::messages::input_mapper::utility_types::macros::action_keys;
|
||||
use crate::messages::input_mapper::utility_types::macros::action_shortcut;
|
||||
use crate::messages::layout::utility_types::widget_prelude::*;
|
||||
use crate::messages::portfolio::document::utility_types::clipboards::Clipboard;
|
||||
use crate::messages::portfolio::document::utility_types::misc::{AlignAggregate, AlignAxis, FlipAxis, GroupFolderType};
|
||||
@@ -68,7 +68,7 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
let preferences = MenuListEntry::new("Preferences…")
|
||||
.label("Preferences…")
|
||||
.icon("Settings")
|
||||
.shortcut_keys(action_keys!(DialogMessageDiscriminant::RequestPreferencesDialog))
|
||||
.tooltip_shortcut(action_shortcut!(DialogMessageDiscriminant::RequestPreferencesDialog))
|
||||
.on_commit(|_| DialogMessage::RequestPreferencesDialog.into());
|
||||
|
||||
let menu_bar_buttons = vec![
|
||||
@@ -89,21 +89,21 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
vec![
|
||||
MenuListEntry::new("Hide Graphite")
|
||||
.label("Hide Graphite")
|
||||
.shortcut_keys(action_keys!(AppWindowMessageDiscriminant::Hide))
|
||||
.tooltip_shortcut(action_shortcut!(AppWindowMessageDiscriminant::Hide))
|
||||
.on_commit(|_| AppWindowMessage::Hide.into()),
|
||||
MenuListEntry::new("Hide Others")
|
||||
.label("Hide Others")
|
||||
.shortcut_keys(action_keys!(AppWindowMessageDiscriminant::HideOthers))
|
||||
.tooltip_shortcut(action_shortcut!(AppWindowMessageDiscriminant::HideOthers))
|
||||
.on_commit(|_| AppWindowMessage::HideOthers.into()),
|
||||
MenuListEntry::new("Show All")
|
||||
.label("Show All")
|
||||
.shortcut_keys(action_keys!(AppWindowMessageDiscriminant::ShowAll))
|
||||
.tooltip_shortcut(action_shortcut!(AppWindowMessageDiscriminant::ShowAll))
|
||||
.on_commit(|_| AppWindowMessage::ShowAll.into()),
|
||||
],
|
||||
vec![
|
||||
MenuListEntry::new("Quit Graphite")
|
||||
.label("Quit Graphite")
|
||||
.shortcut_keys(action_keys!(AppWindowMessageDiscriminant::Close))
|
||||
.tooltip_shortcut(action_shortcut!(AppWindowMessageDiscriminant::Close))
|
||||
.on_commit(|_| AppWindowMessage::Close.into()),
|
||||
],
|
||||
])
|
||||
@@ -117,11 +117,11 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
.label("New…")
|
||||
.icon("File")
|
||||
.on_commit(|_| DialogMessage::RequestNewDocumentDialog.into())
|
||||
.shortcut_keys(action_keys!(DialogMessageDiscriminant::RequestNewDocumentDialog)),
|
||||
.tooltip_shortcut(action_shortcut!(DialogMessageDiscriminant::RequestNewDocumentDialog)),
|
||||
MenuListEntry::new("Open…")
|
||||
.label("Open…")
|
||||
.icon("Folder")
|
||||
.shortcut_keys(action_keys!(PortfolioMessageDiscriminant::OpenDocument))
|
||||
.tooltip_shortcut(action_shortcut!(PortfolioMessageDiscriminant::OpenDocument))
|
||||
.on_commit(|_| PortfolioMessage::OpenDocument.into()),
|
||||
MenuListEntry::new("Open Demo Artwork…")
|
||||
.label("Open Demo Artwork…")
|
||||
@@ -132,13 +132,13 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Close")
|
||||
.label("Close")
|
||||
.icon("Close")
|
||||
.shortcut_keys(action_keys!(PortfolioMessageDiscriminant::CloseActiveDocumentWithConfirmation))
|
||||
.tooltip_shortcut(action_shortcut!(PortfolioMessageDiscriminant::CloseActiveDocumentWithConfirmation))
|
||||
.on_commit(|_| PortfolioMessage::CloseActiveDocumentWithConfirmation.into())
|
||||
.disabled(no_active_document),
|
||||
MenuListEntry::new("Close All")
|
||||
.label("Close All")
|
||||
.icon("CloseAll")
|
||||
.shortcut_keys(action_keys!(PortfolioMessageDiscriminant::CloseAllDocumentsWithConfirmation))
|
||||
.tooltip_shortcut(action_shortcut!(PortfolioMessageDiscriminant::CloseAllDocumentsWithConfirmation))
|
||||
.on_commit(|_| PortfolioMessage::CloseAllDocumentsWithConfirmation.into())
|
||||
.disabled(no_active_document),
|
||||
],
|
||||
@@ -146,14 +146,14 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Save")
|
||||
.label("Save")
|
||||
.icon("Save")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::SaveDocument))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::SaveDocument))
|
||||
.on_commit(|_| DocumentMessage::SaveDocument.into())
|
||||
.disabled(no_active_document),
|
||||
#[cfg(not(target_family = "wasm"))]
|
||||
MenuListEntry::new("Save As…")
|
||||
.label("Save As…")
|
||||
.icon("Save")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::SaveDocumentAs))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::SaveDocumentAs))
|
||||
.on_commit(|_| DocumentMessage::SaveDocumentAs.into())
|
||||
.disabled(no_active_document),
|
||||
],
|
||||
@@ -161,12 +161,12 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Import…")
|
||||
.label("Import…")
|
||||
.icon("FileImport")
|
||||
.shortcut_keys(action_keys!(PortfolioMessageDiscriminant::Import))
|
||||
.tooltip_shortcut(action_shortcut!(PortfolioMessageDiscriminant::Import))
|
||||
.on_commit(|_| PortfolioMessage::Import.into()),
|
||||
MenuListEntry::new("Export…")
|
||||
.label("Export…")
|
||||
.icon("FileExport")
|
||||
.shortcut_keys(action_keys!(DialogMessageDiscriminant::RequestExportDialog))
|
||||
.tooltip_shortcut(action_shortcut!(DialogMessageDiscriminant::RequestExportDialog))
|
||||
.on_commit(|_| DialogMessage::RequestExportDialog.into())
|
||||
.disabled(no_active_document),
|
||||
],
|
||||
@@ -182,13 +182,13 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Undo")
|
||||
.label("Undo")
|
||||
.icon("HistoryUndo")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::Undo))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::Undo))
|
||||
.on_commit(|_| DocumentMessage::Undo.into())
|
||||
.disabled(no_active_document),
|
||||
MenuListEntry::new("Redo")
|
||||
.label("Redo")
|
||||
.icon("HistoryRedo")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::Redo))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::Redo))
|
||||
.on_commit(|_| DocumentMessage::Redo.into())
|
||||
.disabled(no_active_document),
|
||||
],
|
||||
@@ -196,19 +196,19 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Cut")
|
||||
.label("Cut")
|
||||
.icon("Cut")
|
||||
.shortcut_keys(action_keys!(PortfolioMessageDiscriminant::Cut))
|
||||
.tooltip_shortcut(action_shortcut!(PortfolioMessageDiscriminant::Cut))
|
||||
.on_commit(|_| PortfolioMessage::Cut { clipboard: Clipboard::Device }.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
MenuListEntry::new("Copy")
|
||||
.label("Copy")
|
||||
.icon("Copy")
|
||||
.shortcut_keys(action_keys!(PortfolioMessageDiscriminant::Copy))
|
||||
.tooltip_shortcut(action_shortcut!(PortfolioMessageDiscriminant::Copy))
|
||||
.on_commit(|_| PortfolioMessage::Copy { clipboard: Clipboard::Device }.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
MenuListEntry::new("Paste")
|
||||
.label("Paste")
|
||||
.icon("Paste")
|
||||
.shortcut_keys(action_keys!(FrontendMessageDiscriminant::TriggerPaste))
|
||||
.tooltip_shortcut(action_shortcut!(FrontendMessageDiscriminant::TriggerPaste))
|
||||
.on_commit(|_| FrontendMessage::TriggerPaste.into())
|
||||
.disabled(no_active_document),
|
||||
],
|
||||
@@ -216,13 +216,13 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Duplicate")
|
||||
.label("Duplicate")
|
||||
.icon("Copy")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::DuplicateSelectedLayers))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::DuplicateSelectedLayers))
|
||||
.on_commit(|_| DocumentMessage::DuplicateSelectedLayers.into())
|
||||
.disabled(no_active_document || !has_selected_nodes),
|
||||
MenuListEntry::new("Delete")
|
||||
.label("Delete")
|
||||
.icon("Trash")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::DeleteSelectedLayers))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::DeleteSelectedLayers))
|
||||
.on_commit(|_| DocumentMessage::DeleteSelectedLayers.into())
|
||||
.disabled(no_active_document || !has_selected_nodes),
|
||||
],
|
||||
@@ -238,13 +238,12 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
TextButton::new("Layer")
|
||||
.label("Layer")
|
||||
.flush(true)
|
||||
.disabled(no_active_document)
|
||||
.menu_list_children(vec![
|
||||
vec![
|
||||
MenuListEntry::new("New")
|
||||
.label("New")
|
||||
.icon("NewLayer")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::CreateEmptyFolder))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::CreateEmptyFolder))
|
||||
.on_commit(|_| DocumentMessage::CreateEmptyFolder.into())
|
||||
.disabled(no_active_document),
|
||||
],
|
||||
@@ -252,7 +251,7 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Group")
|
||||
.label("Group")
|
||||
.icon("Folder")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::GroupSelectedLayers))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::GroupSelectedLayers))
|
||||
.on_commit(|_| {
|
||||
DocumentMessage::GroupSelectedLayers {
|
||||
group_folder_type: GroupFolderType::Layer,
|
||||
@@ -263,7 +262,7 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Ungroup")
|
||||
.label("Ungroup")
|
||||
.icon("FolderOpen")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::UngroupSelectedLayers))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::UngroupSelectedLayers))
|
||||
.on_commit(|_| DocumentMessage::UngroupSelectedLayers.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
],
|
||||
@@ -271,13 +270,13 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Hide/Show")
|
||||
.label("Hide/Show")
|
||||
.icon("EyeHide")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::ToggleSelectedVisibility))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::ToggleSelectedVisibility))
|
||||
.on_commit(|_| DocumentMessage::ToggleSelectedVisibility.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
MenuListEntry::new("Lock/Unlock")
|
||||
.label("Lock/Unlock")
|
||||
.icon("PadlockLocked")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::ToggleSelectedLocked))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::ToggleSelectedLocked))
|
||||
.on_commit(|_| DocumentMessage::ToggleSelectedLocked.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
],
|
||||
@@ -285,19 +284,19 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Grab")
|
||||
.label("Grab")
|
||||
.icon("TransformationGrab")
|
||||
.shortcut_keys(action_keys!(TransformLayerMessageDiscriminant::BeginGrab))
|
||||
.tooltip_shortcut(action_shortcut!(TransformLayerMessageDiscriminant::BeginGrab))
|
||||
.on_commit(|_| TransformLayerMessage::BeginGrab.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
MenuListEntry::new("Rotate")
|
||||
.label("Rotate")
|
||||
.icon("TransformationRotate")
|
||||
.shortcut_keys(action_keys!(TransformLayerMessageDiscriminant::BeginRotate))
|
||||
.tooltip_shortcut(action_shortcut!(TransformLayerMessageDiscriminant::BeginRotate))
|
||||
.on_commit(|_| TransformLayerMessage::BeginRotate.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
MenuListEntry::new("Scale")
|
||||
.label("Scale")
|
||||
.icon("TransformationScale")
|
||||
.shortcut_keys(action_keys!(TransformLayerMessageDiscriminant::BeginScale))
|
||||
.tooltip_shortcut(action_shortcut!(TransformLayerMessageDiscriminant::BeginScale))
|
||||
.on_commit(|_| TransformLayerMessage::BeginScale.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
],
|
||||
@@ -311,25 +310,25 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Raise To Front")
|
||||
.label("Raise To Front")
|
||||
.icon("Stack")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::SelectedLayersRaiseToFront))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::SelectedLayersRaiseToFront))
|
||||
.on_commit(|_| DocumentMessage::SelectedLayersRaiseToFront.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
MenuListEntry::new("Raise")
|
||||
.label("Raise")
|
||||
.icon("StackRaise")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::SelectedLayersRaise))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::SelectedLayersRaise))
|
||||
.on_commit(|_| DocumentMessage::SelectedLayersRaise.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
MenuListEntry::new("Lower")
|
||||
.label("Lower")
|
||||
.icon("StackLower")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::SelectedLayersLower))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::SelectedLayersLower))
|
||||
.on_commit(|_| DocumentMessage::SelectedLayersLower.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
MenuListEntry::new("Lower to Back")
|
||||
.label("Lower to Back")
|
||||
.icon("StackBottom")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::SelectedLayersLowerToBack))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::SelectedLayersLowerToBack))
|
||||
.on_commit(|_| DocumentMessage::SelectedLayersLowerToBack.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
],
|
||||
@@ -508,25 +507,24 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
TextButton::new("Select")
|
||||
.label("Select")
|
||||
.flush(true)
|
||||
.disabled(no_active_document)
|
||||
.menu_list_children(vec![
|
||||
vec![
|
||||
MenuListEntry::new("Select All")
|
||||
.label("Select All")
|
||||
.icon("SelectAll")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::SelectAllLayers))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::SelectAllLayers))
|
||||
.on_commit(|_| DocumentMessage::SelectAllLayers.into())
|
||||
.disabled(no_active_document),
|
||||
MenuListEntry::new("Deselect All")
|
||||
.label("Deselect All")
|
||||
.icon("DeselectAll")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::DeselectAllLayers))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::DeselectAllLayers))
|
||||
.on_commit(|_| DocumentMessage::DeselectAllLayers.into())
|
||||
.disabled(no_active_document || !has_selected_nodes),
|
||||
MenuListEntry::new("Select Parent")
|
||||
.label("Select Parent")
|
||||
.icon("SelectParent")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::SelectParentLayer))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::SelectParentLayer))
|
||||
.on_commit(|_| DocumentMessage::SelectParentLayer.into())
|
||||
.disabled(no_active_document || !has_selected_nodes),
|
||||
],
|
||||
@@ -534,13 +532,13 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Previous Selection")
|
||||
.label("Previous Selection")
|
||||
.icon("HistoryUndo")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::SelectionStepBack))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::SelectionStepBack))
|
||||
.on_commit(|_| DocumentMessage::SelectionStepBack.into())
|
||||
.disabled(!has_selection_history.0),
|
||||
MenuListEntry::new("Next Selection")
|
||||
.label("Next Selection")
|
||||
.icon("HistoryRedo")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::SelectionStepForward))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::SelectionStepForward))
|
||||
.on_commit(|_| DocumentMessage::SelectionStepForward.into())
|
||||
.disabled(!has_selection_history.1),
|
||||
],
|
||||
@@ -549,19 +547,18 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
TextButton::new("View")
|
||||
.label("View")
|
||||
.flush(true)
|
||||
.disabled(no_active_document)
|
||||
.menu_list_children(vec![
|
||||
vec![
|
||||
MenuListEntry::new("Tilt")
|
||||
.label("Tilt")
|
||||
.icon("Tilt")
|
||||
.shortcut_keys(action_keys!(NavigationMessageDiscriminant::BeginCanvasTilt))
|
||||
.tooltip_shortcut(action_shortcut!(NavigationMessageDiscriminant::BeginCanvasTilt))
|
||||
.on_commit(|_| NavigationMessage::BeginCanvasTilt { was_dispatched_from_menu: true }.into())
|
||||
.disabled(no_active_document || node_graph_open),
|
||||
MenuListEntry::new("Reset Tilt")
|
||||
.label("Reset Tilt")
|
||||
.icon("TiltReset")
|
||||
.shortcut_keys(action_keys!(NavigationMessageDiscriminant::CanvasTiltSet))
|
||||
.tooltip_shortcut(action_shortcut!(NavigationMessageDiscriminant::CanvasTiltSet))
|
||||
.on_commit(|_| NavigationMessage::CanvasTiltSet { angle_radians: 0.into() }.into())
|
||||
.disabled(no_active_document || node_graph_open || !self.canvas_tilted),
|
||||
],
|
||||
@@ -569,37 +566,37 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Zoom In")
|
||||
.label("Zoom In")
|
||||
.icon("ZoomIn")
|
||||
.shortcut_keys(action_keys!(NavigationMessageDiscriminant::CanvasZoomIncrease))
|
||||
.tooltip_shortcut(action_shortcut!(NavigationMessageDiscriminant::CanvasZoomIncrease))
|
||||
.on_commit(|_| NavigationMessage::CanvasZoomIncrease { center_on_mouse: false }.into())
|
||||
.disabled(no_active_document),
|
||||
MenuListEntry::new("Zoom Out")
|
||||
.label("Zoom Out")
|
||||
.icon("ZoomOut")
|
||||
.shortcut_keys(action_keys!(NavigationMessageDiscriminant::CanvasZoomDecrease))
|
||||
.tooltip_shortcut(action_shortcut!(NavigationMessageDiscriminant::CanvasZoomDecrease))
|
||||
.on_commit(|_| NavigationMessage::CanvasZoomDecrease { center_on_mouse: false }.into())
|
||||
.disabled(no_active_document),
|
||||
MenuListEntry::new("Zoom to Selection")
|
||||
.label("Zoom to Selection")
|
||||
.icon("FrameSelected")
|
||||
.shortcut_keys(action_keys!(NavigationMessageDiscriminant::FitViewportToSelection))
|
||||
.tooltip_shortcut(action_shortcut!(NavigationMessageDiscriminant::FitViewportToSelection))
|
||||
.on_commit(|_| NavigationMessage::FitViewportToSelection.into())
|
||||
.disabled(no_active_document || !has_selected_layers),
|
||||
MenuListEntry::new("Zoom to Fit")
|
||||
.label("Zoom to Fit")
|
||||
.icon("FrameAll")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::ZoomCanvasToFitAll))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::ZoomCanvasToFitAll))
|
||||
.on_commit(|_| DocumentMessage::ZoomCanvasToFitAll.into())
|
||||
.disabled(no_active_document),
|
||||
MenuListEntry::new("Zoom to 100%")
|
||||
.label("Zoom to 100%")
|
||||
.icon("Zoom1x")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::ZoomCanvasTo100Percent))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::ZoomCanvasTo100Percent))
|
||||
.on_commit(|_| DocumentMessage::ZoomCanvasTo100Percent.into())
|
||||
.disabled(no_active_document),
|
||||
MenuListEntry::new("Zoom to 200%")
|
||||
.label("Zoom to 200%")
|
||||
.icon("Zoom2x")
|
||||
.shortcut_keys(action_keys!(DocumentMessageDiscriminant::ZoomCanvasTo200Percent))
|
||||
.tooltip_shortcut(action_shortcut!(DocumentMessageDiscriminant::ZoomCanvasTo200Percent))
|
||||
.on_commit(|_| DocumentMessage::ZoomCanvasTo200Percent.into())
|
||||
.disabled(no_active_document),
|
||||
],
|
||||
@@ -607,7 +604,7 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Flip")
|
||||
.label("Flip")
|
||||
.icon(if self.canvas_flipped { "CheckboxChecked" } else { "CheckboxUnchecked" })
|
||||
.shortcut_keys(action_keys!(NavigationMessageDiscriminant::CanvasFlip))
|
||||
.tooltip_shortcut(action_shortcut!(NavigationMessageDiscriminant::CanvasFlip))
|
||||
.on_commit(|_| NavigationMessage::CanvasFlip.into())
|
||||
.disabled(no_active_document || node_graph_open),
|
||||
],
|
||||
@@ -615,7 +612,7 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Rulers")
|
||||
.label("Rulers")
|
||||
.icon(if self.rulers_visible { "CheckboxChecked" } else { "CheckboxUnchecked" })
|
||||
.shortcut_keys(action_keys!(PortfolioMessageDiscriminant::ToggleRulers))
|
||||
.tooltip_shortcut(action_shortcut!(PortfolioMessageDiscriminant::ToggleRulers))
|
||||
.on_commit(|_| PortfolioMessage::ToggleRulers.into())
|
||||
.disabled(no_active_document),
|
||||
],
|
||||
@@ -629,19 +626,19 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
MenuListEntry::new("Properties")
|
||||
.label("Properties")
|
||||
.icon(if self.properties_panel_open { "CheckboxChecked" } else { "CheckboxUnchecked" })
|
||||
.shortcut_keys(action_keys!(PortfolioMessageDiscriminant::TogglePropertiesPanelOpen))
|
||||
.tooltip_shortcut(action_shortcut!(PortfolioMessageDiscriminant::TogglePropertiesPanelOpen))
|
||||
.on_commit(|_| PortfolioMessage::TogglePropertiesPanelOpen.into()),
|
||||
MenuListEntry::new("Layers")
|
||||
.label("Layers")
|
||||
.icon(if self.layers_panel_open { "CheckboxChecked" } else { "CheckboxUnchecked" })
|
||||
.shortcut_keys(action_keys!(PortfolioMessageDiscriminant::ToggleLayersPanelOpen))
|
||||
.tooltip_shortcut(action_shortcut!(PortfolioMessageDiscriminant::ToggleLayersPanelOpen))
|
||||
.on_commit(|_| PortfolioMessage::ToggleLayersPanelOpen.into()),
|
||||
],
|
||||
vec![
|
||||
MenuListEntry::new("Data")
|
||||
.label("Data")
|
||||
.icon(if self.data_panel_open { "CheckboxChecked" } else { "CheckboxUnchecked" })
|
||||
.shortcut_keys(action_keys!(PortfolioMessageDiscriminant::ToggleDataPanelOpen))
|
||||
.tooltip_shortcut(action_shortcut!(PortfolioMessageDiscriminant::ToggleDataPanelOpen))
|
||||
.on_commit(|_| PortfolioMessage::ToggleDataPanelOpen.into()),
|
||||
],
|
||||
])
|
||||
@@ -702,7 +699,7 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
"CheckboxChecked".to_string()
|
||||
}
|
||||
}).unwrap_or_default())
|
||||
.shortcut_keys(action_keys!(DebugMessageDiscriminant::MessageOff))
|
||||
.tooltip_shortcut(action_shortcut!(DebugMessageDiscriminant::MessageOff))
|
||||
.on_commit(|_| DebugMessage::MessageOff.into()),
|
||||
MenuListEntry::new("Print Messages: Only Names")
|
||||
.label("Print Messages: Only Names")
|
||||
@@ -716,7 +713,7 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
"CheckboxChecked".to_string()
|
||||
}
|
||||
}).unwrap_or_default())
|
||||
.shortcut_keys(action_keys!(DebugMessageDiscriminant::MessageNames))
|
||||
.tooltip_shortcut(action_shortcut!(DebugMessageDiscriminant::MessageNames))
|
||||
.on_commit(|_| DebugMessage::MessageNames.into()),
|
||||
MenuListEntry::new("Print Messages: Full Contents")
|
||||
.label("Print Messages: Full Contents")
|
||||
@@ -730,7 +727,7 @@ impl LayoutHolder for MenuBarMessageHandler {
|
||||
"CheckboxChecked".to_string()
|
||||
}
|
||||
}).unwrap_or_default())
|
||||
.shortcut_keys(action_keys!(DebugMessageDiscriminant::MessageContents))
|
||||
.tooltip_shortcut(action_shortcut!(DebugMessageDiscriminant::MessageContents))
|
||||
.on_commit(|_| DebugMessage::MessageContents.into()),
|
||||
],
|
||||
vec![MenuListEntry::new("Trigger a Crash").label("Trigger a Crash").icon("Warning").on_commit(|_| panic!())],
|
||||
|
||||
@@ -109,6 +109,7 @@ pub enum PortfolioMessage {
|
||||
parent_and_insert_index: Option<(LayerNodeIdentifier, usize)>,
|
||||
},
|
||||
PrevDocument,
|
||||
RequestWelcomeScreenButtonsLayout,
|
||||
SetActivePanel {
|
||||
panel: PanelType,
|
||||
},
|
||||
|
||||
@@ -7,6 +7,7 @@ use crate::messages::animation::TimingInformation;
|
||||
use crate::messages::debug::utility_types::MessageLoggingVerbosity;
|
||||
use crate::messages::dialog::simple_dialogs;
|
||||
use crate::messages::frontend::utility_types::{DocumentDetails, OpenDocument};
|
||||
use crate::messages::input_mapper::utility_types::macros::action_shortcut;
|
||||
use crate::messages::layout::utility_types::widget_prelude::*;
|
||||
use crate::messages::portfolio::document::DocumentMessageContext;
|
||||
use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn;
|
||||
@@ -20,7 +21,7 @@ use crate::messages::preferences::SelectionMode;
|
||||
use crate::messages::prelude::*;
|
||||
use crate::messages::tool::common_functionality::graph_modification_utils;
|
||||
use crate::messages::tool::common_functionality::utility_functions::make_path_editable_is_allowed;
|
||||
use crate::messages::tool::utility_types::{HintData, HintGroup, ToolType};
|
||||
use crate::messages::tool::utility_types::{HintData, ToolType};
|
||||
use crate::messages::viewport::ToPhysical;
|
||||
use crate::node_graph_executor::{ExportConfig, NodeGraphExecutor};
|
||||
use derivative::*;
|
||||
@@ -218,8 +219,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
||||
responses.add(PropertiesPanelMessage::Clear);
|
||||
responses.add(DocumentMessage::ClearLayersPanel);
|
||||
responses.add(DataPanelMessage::ClearLayout);
|
||||
let hint_data = HintData(vec![HintGroup(vec![])]);
|
||||
responses.add(FrontendMessage::UpdateInputHints { hint_data });
|
||||
HintData::clear_layout(responses);
|
||||
}
|
||||
|
||||
for document_id in &self.document_ids {
|
||||
@@ -243,8 +243,7 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
||||
responses.add(PropertiesPanelMessage::Clear);
|
||||
responses.add(DocumentMessage::ClearLayersPanel);
|
||||
responses.add(DataPanelMessage::ClearLayout);
|
||||
let hint_data = HintData(vec![HintGroup(vec![])]);
|
||||
responses.add(FrontendMessage::UpdateInputHints { hint_data });
|
||||
HintData::clear_layout(responses);
|
||||
}
|
||||
|
||||
// Actually delete the document (delay to delete document is required to let the document and properties panel messages above get processed)
|
||||
@@ -882,6 +881,53 @@ impl MessageHandler<PortfolioMessage, PortfolioMessageContext<'_>> for Portfolio
|
||||
responses.add(PortfolioMessage::SelectDocument { document_id: prev_id });
|
||||
}
|
||||
}
|
||||
PortfolioMessage::RequestWelcomeScreenButtonsLayout => {
|
||||
let donate = "https://graphite.rs/donate/";
|
||||
|
||||
let table = LayoutGroup::Table {
|
||||
unstyled: true,
|
||||
rows: vec![
|
||||
vec![
|
||||
TextButton::new("New Document")
|
||||
.icon(Some("File".into()))
|
||||
.flush(true)
|
||||
.on_commit(|_| DialogMessage::RequestNewDocumentDialog.into())
|
||||
.widget_holder(),
|
||||
ShortcutLabel::new(action_shortcut!(DialogMessageDiscriminant::RequestNewDocumentDialog)).widget_holder(),
|
||||
],
|
||||
vec![
|
||||
TextButton::new("Open Document")
|
||||
.icon(Some("Folder".into()))
|
||||
.flush(true)
|
||||
.on_commit(|_| PortfolioMessage::OpenDocument.into())
|
||||
.widget_holder(),
|
||||
ShortcutLabel::new(action_shortcut!(PortfolioMessageDiscriminant::OpenDocument)).widget_holder(),
|
||||
],
|
||||
vec![
|
||||
TextButton::new("Open Demo Artwork")
|
||||
.icon(Some("Image".into()))
|
||||
.flush(true)
|
||||
.on_commit(|_| DialogMessage::RequestDemoArtworkDialog.into())
|
||||
.widget_holder(),
|
||||
],
|
||||
vec![
|
||||
TextButton::new("Support the Development Fund")
|
||||
.icon(Some("Heart".into()))
|
||||
.flush(true)
|
||||
.on_commit(move |_| FrontendMessage::TriggerVisitLink { url: donate.to_string() }.into())
|
||||
.widget_holder(),
|
||||
],
|
||||
],
|
||||
};
|
||||
|
||||
responses.add(LayoutMessage::DestroyLayout {
|
||||
layout_target: LayoutTarget::WelcomeScreenButtons,
|
||||
});
|
||||
responses.add(LayoutMessage::SendLayout {
|
||||
layout: Layout::WidgetLayout(WidgetLayout::new(vec![table])),
|
||||
layout_target: LayoutTarget::WelcomeScreenButtons,
|
||||
});
|
||||
}
|
||||
PortfolioMessage::SetActivePanel { panel } => {
|
||||
self.active_panel = panel;
|
||||
responses.add(DocumentMessage::SetActivePanel { active_panel: self.active_panel });
|
||||
|
||||
@@ -41,6 +41,7 @@ pub enum KeyboardPlatformLayout {
|
||||
pub enum PanelType {
|
||||
#[default]
|
||||
Document,
|
||||
Welcome,
|
||||
Layers,
|
||||
Properties,
|
||||
DataPanel,
|
||||
@@ -50,6 +51,7 @@ impl From<String> for PanelType {
|
||||
fn from(value: String) -> Self {
|
||||
match value.as_str() {
|
||||
"Document" => PanelType::Document,
|
||||
"Welcome" => PanelType::Welcome,
|
||||
"Layers" => PanelType::Layers,
|
||||
"Properties" => PanelType::Properties,
|
||||
"Data" => PanelType::DataPanel,
|
||||
|
||||
Reference in New Issue
Block a user