mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-28 08:08:13 +08:00
@@ -190,10 +190,6 @@ pub fn default_mapping() -> Mapping {
|
|||||||
standard!(KeyDown(KeyS); modifiers=[KeyControl], action_dispatch=DocumentMessage::SaveDocument),
|
standard!(KeyDown(KeyS); modifiers=[KeyControl], action_dispatch=DocumentMessage::SaveDocument),
|
||||||
mac_only!(KeyDown(KeyS); modifiers=[KeyCommand], action_dispatch=DocumentMessage::SaveDocument),
|
mac_only!(KeyDown(KeyS); modifiers=[KeyCommand], action_dispatch=DocumentMessage::SaveDocument),
|
||||||
),
|
),
|
||||||
entry_multiplatform!(
|
|
||||||
standard!(KeyDown(Key0); modifiers=[KeyControl], action_dispatch=DocumentMessage::ZoomCanvasToFitAll),
|
|
||||||
mac_only!(KeyDown(Key0); modifiers=[KeyCommand], action_dispatch=DocumentMessage::ZoomCanvasToFitAll),
|
|
||||||
),
|
|
||||||
entry_multiplatform!(
|
entry_multiplatform!(
|
||||||
standard!(KeyDown(KeyD); modifiers=[KeyControl], action_dispatch=DocumentMessage::DuplicateSelectedLayers),
|
standard!(KeyDown(KeyD); modifiers=[KeyControl], action_dispatch=DocumentMessage::DuplicateSelectedLayers),
|
||||||
mac_only!(KeyDown(KeyD); modifiers=[KeyCommand], action_dispatch=DocumentMessage::DuplicateSelectedLayers),
|
mac_only!(KeyDown(KeyD); modifiers=[KeyCommand], action_dispatch=DocumentMessage::DuplicateSelectedLayers),
|
||||||
@@ -210,6 +206,18 @@ pub fn default_mapping() -> Mapping {
|
|||||||
standard!(KeyDown(KeyN); modifiers=[KeyControl, KeyShift], action_dispatch=DocumentMessage::CreateEmptyFolder { container_path: vec![] }),
|
standard!(KeyDown(KeyN); modifiers=[KeyControl, KeyShift], action_dispatch=DocumentMessage::CreateEmptyFolder { container_path: vec![] }),
|
||||||
mac_only!(KeyDown(KeyN); modifiers=[KeyCommand, KeyShift], action_dispatch=DocumentMessage::CreateEmptyFolder { container_path: vec![] }),
|
mac_only!(KeyDown(KeyN); modifiers=[KeyCommand, KeyShift], action_dispatch=DocumentMessage::CreateEmptyFolder { container_path: vec![] }),
|
||||||
),
|
),
|
||||||
|
entry_multiplatform!(
|
||||||
|
standard!(KeyDown(Key0); modifiers=[KeyControl], action_dispatch=DocumentMessage::ZoomCanvasToFitAll),
|
||||||
|
mac_only!(KeyDown(Key0); modifiers=[KeyCommand], action_dispatch=DocumentMessage::ZoomCanvasToFitAll),
|
||||||
|
),
|
||||||
|
entry_multiplatform!(
|
||||||
|
standard!(KeyDown(Key1); modifiers=[KeyControl], action_dispatch=DocumentMessage::ZoomCanvasTo100Percent),
|
||||||
|
mac_only!(KeyDown(Key1); modifiers=[KeyCommand], action_dispatch=DocumentMessage::ZoomCanvasTo100Percent),
|
||||||
|
),
|
||||||
|
entry_multiplatform!(
|
||||||
|
standard!(KeyDown(Key2); modifiers=[KeyControl], action_dispatch=DocumentMessage::ZoomCanvasTo200Percent),
|
||||||
|
mac_only!(KeyDown(Key2); modifiers=[KeyCommand], action_dispatch=DocumentMessage::ZoomCanvasTo200Percent),
|
||||||
|
),
|
||||||
entry_multiplatform!(
|
entry_multiplatform!(
|
||||||
standard!(KeyDown(KeyLeftBracket); modifiers=[KeyControl, KeyShift], action_dispatch=DocumentMessage::SelectedLayersLowerToBack),
|
standard!(KeyDown(KeyLeftBracket); modifiers=[KeyControl, KeyShift], action_dispatch=DocumentMessage::SelectedLayersLowerToBack),
|
||||||
mac_only!(KeyDown(KeyLeftBracket); modifiers=[KeyCommand, KeyShift], action_dispatch=DocumentMessage::SelectedLayersLowerToBack),
|
mac_only!(KeyDown(KeyLeftBracket); modifiers=[KeyCommand, KeyShift], action_dispatch=DocumentMessage::SelectedLayersLowerToBack),
|
||||||
@@ -285,14 +293,6 @@ pub fn default_mapping() -> Mapping {
|
|||||||
standard!(KeyDown(KeyMinus); modifiers=[KeyControl], action_dispatch=MovementMessage::DecreaseCanvasZoom { center_on_mouse: false }),
|
standard!(KeyDown(KeyMinus); modifiers=[KeyControl], action_dispatch=MovementMessage::DecreaseCanvasZoom { center_on_mouse: false }),
|
||||||
mac_only!(KeyDown(KeyMinus); modifiers=[KeyCommand], action_dispatch=MovementMessage::DecreaseCanvasZoom { center_on_mouse: false }),
|
mac_only!(KeyDown(KeyMinus); modifiers=[KeyCommand], action_dispatch=MovementMessage::DecreaseCanvasZoom { center_on_mouse: false }),
|
||||||
),
|
),
|
||||||
entry_multiplatform!(
|
|
||||||
standard!(KeyDown(Key1); modifiers=[KeyControl], action_dispatch=MovementMessage::SetCanvasZoom { zoom_factor: 1. }),
|
|
||||||
mac_only!(KeyDown(Key1); modifiers=[KeyCommand], action_dispatch=MovementMessage::SetCanvasZoom { zoom_factor: 1. }),
|
|
||||||
),
|
|
||||||
entry_multiplatform!(
|
|
||||||
standard!(KeyDown(Key2); modifiers=[KeyControl], action_dispatch=MovementMessage::SetCanvasZoom { zoom_factor: 2. }),
|
|
||||||
mac_only!(KeyDown(Key2); modifiers=[KeyCommand], action_dispatch=MovementMessage::SetCanvasZoom { zoom_factor: 2. }),
|
|
||||||
),
|
|
||||||
entry!(WheelScroll; modifiers=[KeyControl], action_dispatch=MovementMessage::WheelCanvasZoom),
|
entry!(WheelScroll; modifiers=[KeyControl], action_dispatch=MovementMessage::WheelCanvasZoom),
|
||||||
entry!(WheelScroll; modifiers=[KeyShift], action_dispatch=MovementMessage::WheelCanvasTranslate { use_y_as_x: true }),
|
entry!(WheelScroll; modifiers=[KeyShift], action_dispatch=MovementMessage::WheelCanvasTranslate { use_y_as_x: true }),
|
||||||
entry!(WheelScroll; action_dispatch=MovementMessage::WheelCanvasTranslate { use_y_as_x: false }),
|
entry!(WheelScroll; action_dispatch=MovementMessage::WheelCanvasTranslate { use_y_as_x: false }),
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ use crate::messages::input_mapper::utility_types::input_keyboard::{Key, Modifier
|
|||||||
use crate::messages::input_mapper::utility_types::input_mouse::{EditorMouseState, ViewportBounds};
|
use crate::messages::input_mapper::utility_types::input_mouse::{EditorMouseState, ViewportBounds};
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
|
|
||||||
#[doc(inline)]
|
|
||||||
pub use graphene::DocumentResponse;
|
pub use graphene::DocumentResponse;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ use crate::messages::input_mapper::utility_types::input_mouse::{MouseKeys, Mouse
|
|||||||
use crate::messages::portfolio::document::utility_types::misc::KeyboardPlatformLayout;
|
use crate::messages::portfolio::document::utility_types::misc::KeyboardPlatformLayout;
|
||||||
use crate::messages::prelude::*;
|
use crate::messages::prelude::*;
|
||||||
|
|
||||||
#[doc(inline)]
|
|
||||||
pub use graphene::DocumentResponse;
|
pub use graphene::DocumentResponse;
|
||||||
|
|
||||||
use glam::DVec2;
|
use glam::DVec2;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ pub enum ArtboardMessage {
|
|||||||
position: (f64, f64),
|
position: (f64, f64),
|
||||||
size: (f64, f64),
|
size: (f64, f64),
|
||||||
},
|
},
|
||||||
|
ClearArtboards,
|
||||||
DeleteArtboard {
|
DeleteArtboard {
|
||||||
artboard: LayerId,
|
artboard: LayerId,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -63,6 +63,11 @@ impl MessageHandler<ArtboardMessage, &FontCache> for ArtboardMessageHandler {
|
|||||||
|
|
||||||
responses.push_back(DocumentMessage::RenderDocument.into());
|
responses.push_back(DocumentMessage::RenderDocument.into());
|
||||||
}
|
}
|
||||||
|
ClearArtboards => {
|
||||||
|
for &artboard in self.artboard_ids.iter() {
|
||||||
|
responses.push_front(ArtboardMessage::DeleteArtboard { artboard }.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
DeleteArtboard { artboard } => {
|
DeleteArtboard { artboard } => {
|
||||||
self.artboard_ids.retain(|&id| id != artboard);
|
self.artboard_ids.retain(|&id| id != artboard);
|
||||||
|
|
||||||
|
|||||||
@@ -169,6 +169,8 @@ pub enum DocumentMessage {
|
|||||||
layer_path: Vec<LayerId>,
|
layer_path: Vec<LayerId>,
|
||||||
layer_metadata: LayerMetadata,
|
layer_metadata: LayerMetadata,
|
||||||
},
|
},
|
||||||
|
ZoomCanvasTo100Percent,
|
||||||
|
ZoomCanvasTo200Percent,
|
||||||
ZoomCanvasToFitAll,
|
ZoomCanvasToFitAll,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -758,6 +758,12 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
|
|||||||
UpdateLayerMetadata { layer_path, layer_metadata } => {
|
UpdateLayerMetadata { layer_path, layer_metadata } => {
|
||||||
self.layer_metadata.insert(layer_path, layer_metadata);
|
self.layer_metadata.insert(layer_path, layer_metadata);
|
||||||
}
|
}
|
||||||
|
ZoomCanvasTo100Percent => {
|
||||||
|
responses.push_front(MovementMessage::SetCanvasZoom { zoom_factor: 1. }.into());
|
||||||
|
}
|
||||||
|
ZoomCanvasTo200Percent => {
|
||||||
|
responses.push_front(MovementMessage::SetCanvasZoom { zoom_factor: 2. }.into());
|
||||||
|
}
|
||||||
ZoomCanvasToFitAll => {
|
ZoomCanvasToFitAll => {
|
||||||
if let Some(bounds) = self.document_bounds(font_cache) {
|
if let Some(bounds) = self.document_bounds(font_cache) {
|
||||||
responses.push_back(
|
responses.push_back(
|
||||||
@@ -785,6 +791,8 @@ impl MessageHandler<DocumentMessage, (&InputPreprocessorMessageHandler, &FontCac
|
|||||||
SetSnapping,
|
SetSnapping,
|
||||||
DebugPrintDocument,
|
DebugPrintDocument,
|
||||||
ZoomCanvasToFitAll,
|
ZoomCanvasToFitAll,
|
||||||
|
ZoomCanvasTo100Percent,
|
||||||
|
ZoomCanvasTo200Percent,
|
||||||
CreateEmptyFolder,
|
CreateEmptyFolder,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -267,7 +267,6 @@ impl MessageHandler<MovementMessage, (&Document, &InputPreprocessorMessageHandle
|
|||||||
TranslateCanvasBegin,
|
TranslateCanvasBegin,
|
||||||
RotateCanvasBegin,
|
RotateCanvasBegin,
|
||||||
ZoomCanvasBegin,
|
ZoomCanvasBegin,
|
||||||
SetCanvasZoom,
|
|
||||||
SetCanvasRotation,
|
SetCanvasRotation,
|
||||||
WheelCanvasZoom,
|
WheelCanvasZoom,
|
||||||
IncreaseCanvasZoom,
|
IncreaseCanvasZoom,
|
||||||
|
|||||||
@@ -44,47 +44,6 @@ impl PropertyHolder for MenuBarMessageHandler {
|
|||||||
action: MenuEntry::create_action(|_| PortfolioMessage::OpenDocument.into()),
|
action: MenuEntry::create_action(|_| PortfolioMessage::OpenDocument.into()),
|
||||||
..MenuEntry::default()
|
..MenuEntry::default()
|
||||||
},
|
},
|
||||||
MenuEntry {
|
|
||||||
label: "Open Recent".into(),
|
|
||||||
shortcut: None,
|
|
||||||
action: MenuEntry::no_action(),
|
|
||||||
icon: None,
|
|
||||||
children: MenuEntryGroups(vec![
|
|
||||||
vec![
|
|
||||||
MenuEntry {
|
|
||||||
label: "Reopen Last Closed".into(),
|
|
||||||
// shortcut: [Key::KeyControl, Key::KeyShift, Key::KeyT],
|
|
||||||
..MenuEntry::default()
|
|
||||||
},
|
|
||||||
MenuEntry {
|
|
||||||
label: "Clear Recently Opened".into(),
|
|
||||||
..MenuEntry::default()
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vec![
|
|
||||||
MenuEntry {
|
|
||||||
label: "Some Recent File.gdd".into(),
|
|
||||||
..MenuEntry::default()
|
|
||||||
},
|
|
||||||
MenuEntry {
|
|
||||||
label: "Another Recent File.gdd".into(),
|
|
||||||
..MenuEntry::default()
|
|
||||||
},
|
|
||||||
MenuEntry {
|
|
||||||
label: "An Older File.gdd".into(),
|
|
||||||
..MenuEntry::default()
|
|
||||||
},
|
|
||||||
MenuEntry {
|
|
||||||
label: "Some Other Older File.gdd".into(),
|
|
||||||
..MenuEntry::default()
|
|
||||||
},
|
|
||||||
MenuEntry {
|
|
||||||
label: "Yet Another Older File.gdd".into(),
|
|
||||||
..MenuEntry::default()
|
|
||||||
},
|
|
||||||
],
|
|
||||||
]),
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
vec![
|
vec![
|
||||||
MenuEntry {
|
MenuEntry {
|
||||||
@@ -100,29 +59,12 @@ impl PropertyHolder for MenuBarMessageHandler {
|
|||||||
..MenuEntry::default()
|
..MenuEntry::default()
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
vec![
|
vec![MenuEntry {
|
||||||
MenuEntry {
|
label: "Save".into(),
|
||||||
label: "Save".into(),
|
shortcut: action_keys!(DocumentMessageDiscriminant::SaveDocument),
|
||||||
shortcut: action_keys!(DocumentMessageDiscriminant::SaveDocument),
|
action: MenuEntry::create_action(|_| DocumentMessage::SaveDocument.into()),
|
||||||
action: MenuEntry::create_action(|_| DocumentMessage::SaveDocument.into()),
|
..MenuEntry::default()
|
||||||
..MenuEntry::default()
|
}],
|
||||||
},
|
|
||||||
MenuEntry {
|
|
||||||
label: "Save As…".into(),
|
|
||||||
// shortcut: [Key::KeyControl, Key::KeyShift, Key::KeyS],
|
|
||||||
..MenuEntry::default()
|
|
||||||
},
|
|
||||||
MenuEntry {
|
|
||||||
label: "Save All".into(),
|
|
||||||
// shortcut: [Key::KeyControl, Key::KeyAlt, Key::KeyS],
|
|
||||||
..MenuEntry::default()
|
|
||||||
},
|
|
||||||
MenuEntry {
|
|
||||||
label: "Auto-Save".into(),
|
|
||||||
icon: Some("CheckboxChecked".into()),
|
|
||||||
..MenuEntry::default()
|
|
||||||
},
|
|
||||||
],
|
|
||||||
vec![
|
vec![
|
||||||
MenuEntry {
|
MenuEntry {
|
||||||
label: "Import…".into(),
|
label: "Import…".into(),
|
||||||
@@ -137,11 +79,6 @@ impl PropertyHolder for MenuBarMessageHandler {
|
|||||||
..MenuEntry::default()
|
..MenuEntry::default()
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
vec![MenuEntry {
|
|
||||||
label: "Quit".into(),
|
|
||||||
// shortcut: [Key::KeyControl, Key::KeyQ],
|
|
||||||
..MenuEntry::default()
|
|
||||||
}],
|
|
||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
MenuColumn {
|
MenuColumn {
|
||||||
@@ -187,20 +124,49 @@ impl PropertyHolder for MenuBarMessageHandler {
|
|||||||
},
|
},
|
||||||
MenuColumn {
|
MenuColumn {
|
||||||
label: "Layer".into(),
|
label: "Layer".into(),
|
||||||
children: MenuEntryGroups(vec![vec![
|
children: MenuEntryGroups(vec![
|
||||||
MenuEntry {
|
vec![
|
||||||
label: "Select All".into(),
|
MenuEntry {
|
||||||
shortcut: action_keys!(DocumentMessageDiscriminant::SelectAllLayers),
|
label: "Select All".into(),
|
||||||
action: MenuEntry::create_action(|_| DocumentMessage::SelectAllLayers.into()),
|
shortcut: action_keys!(DocumentMessageDiscriminant::SelectAllLayers),
|
||||||
|
action: MenuEntry::create_action(|_| DocumentMessage::SelectAllLayers.into()),
|
||||||
|
..MenuEntry::default()
|
||||||
|
},
|
||||||
|
MenuEntry {
|
||||||
|
label: "Deselect All".into(),
|
||||||
|
shortcut: action_keys!(DocumentMessageDiscriminant::DeselectAllLayers),
|
||||||
|
action: MenuEntry::create_action(|_| DocumentMessage::DeselectAllLayers.into()),
|
||||||
|
..MenuEntry::default()
|
||||||
|
},
|
||||||
|
],
|
||||||
|
vec![MenuEntry {
|
||||||
|
label: "Delete Selected".into(),
|
||||||
|
icon: Some("Trash".into()),
|
||||||
|
shortcut: action_keys!(DocumentMessageDiscriminant::DeleteSelectedLayers),
|
||||||
|
action: MenuEntry::create_action(|_| DocumentMessage::DeleteSelectedLayers.into()),
|
||||||
..MenuEntry::default()
|
..MenuEntry::default()
|
||||||
},
|
}],
|
||||||
MenuEntry {
|
vec![
|
||||||
label: "Deselect All".into(),
|
MenuEntry {
|
||||||
shortcut: action_keys!(DocumentMessageDiscriminant::DeselectAllLayers),
|
label: "Grab Selected".into(),
|
||||||
action: MenuEntry::create_action(|_| DocumentMessage::DeselectAllLayers.into()),
|
shortcut: action_keys!(TransformLayerMessageDiscriminant::BeginGrab),
|
||||||
..MenuEntry::default()
|
action: MenuEntry::create_action(|_| TransformLayerMessage::BeginGrab.into()),
|
||||||
},
|
..MenuEntry::default()
|
||||||
MenuEntry {
|
},
|
||||||
|
MenuEntry {
|
||||||
|
label: "Rotate Selected".into(),
|
||||||
|
shortcut: action_keys!(TransformLayerMessageDiscriminant::BeginRotate),
|
||||||
|
action: MenuEntry::create_action(|_| TransformLayerMessage::BeginRotate.into()),
|
||||||
|
..MenuEntry::default()
|
||||||
|
},
|
||||||
|
MenuEntry {
|
||||||
|
label: "Scale Selected".into(),
|
||||||
|
shortcut: action_keys!(TransformLayerMessageDiscriminant::BeginScale),
|
||||||
|
action: MenuEntry::create_action(|_| TransformLayerMessage::BeginScale.into()),
|
||||||
|
..MenuEntry::default()
|
||||||
|
},
|
||||||
|
],
|
||||||
|
vec![MenuEntry {
|
||||||
label: "Order".into(),
|
label: "Order".into(),
|
||||||
action: MenuEntry::no_action(),
|
action: MenuEntry::no_action(),
|
||||||
children: MenuEntryGroups(vec![vec![
|
children: MenuEntryGroups(vec![vec![
|
||||||
@@ -230,23 +196,46 @@ impl PropertyHolder for MenuBarMessageHandler {
|
|||||||
},
|
},
|
||||||
]]),
|
]]),
|
||||||
..MenuEntry::default()
|
..MenuEntry::default()
|
||||||
},
|
}],
|
||||||
]]),
|
]),
|
||||||
},
|
},
|
||||||
MenuColumn {
|
MenuColumn {
|
||||||
label: "Document".into(),
|
label: "Document".into(),
|
||||||
children: MenuEntryGroups(vec![vec![MenuEntry {
|
children: MenuEntryGroups(vec![vec![MenuEntry {
|
||||||
label: "Menu entries coming soon".into(),
|
label: "Clear Artboards".into(),
|
||||||
|
action: MenuEntry::create_action(|_| ArtboardMessage::ClearArtboards.into()),
|
||||||
..MenuEntry::default()
|
..MenuEntry::default()
|
||||||
}]]),
|
}]]),
|
||||||
},
|
},
|
||||||
MenuColumn {
|
MenuColumn {
|
||||||
label: "View".into(),
|
label: "View".into(),
|
||||||
children: MenuEntryGroups(vec![vec![MenuEntry {
|
children: MenuEntryGroups(vec![
|
||||||
label: "Show/Hide Node Graph (In Development)".into(),
|
vec![
|
||||||
action: MenuEntry::create_action(|_| WorkspaceMessage::NodeGraphToggleVisibility.into()),
|
MenuEntry {
|
||||||
..MenuEntry::default()
|
label: "Zoom to Fit".into(),
|
||||||
}]]),
|
shortcut: action_keys!(DocumentMessageDiscriminant::ZoomCanvasToFitAll),
|
||||||
|
action: MenuEntry::create_action(|_| DocumentMessage::ZoomCanvasToFitAll.into()),
|
||||||
|
..MenuEntry::default()
|
||||||
|
},
|
||||||
|
MenuEntry {
|
||||||
|
label: "Zoom to 100%".into(),
|
||||||
|
shortcut: action_keys!(DocumentMessageDiscriminant::ZoomCanvasTo100Percent),
|
||||||
|
action: MenuEntry::create_action(|_| DocumentMessage::ZoomCanvasTo100Percent.into()),
|
||||||
|
..MenuEntry::default()
|
||||||
|
},
|
||||||
|
MenuEntry {
|
||||||
|
label: "Zoom to 200%".into(),
|
||||||
|
shortcut: action_keys!(DocumentMessageDiscriminant::ZoomCanvasTo200Percent),
|
||||||
|
action: MenuEntry::create_action(|_| DocumentMessage::ZoomCanvasTo200Percent.into()),
|
||||||
|
..MenuEntry::default()
|
||||||
|
},
|
||||||
|
],
|
||||||
|
vec![MenuEntry {
|
||||||
|
label: "Node Graph (In Development)".into(),
|
||||||
|
action: MenuEntry::create_action(|_| WorkspaceMessage::NodeGraphToggleVisibility.into()),
|
||||||
|
..MenuEntry::default()
|
||||||
|
}],
|
||||||
|
]),
|
||||||
},
|
},
|
||||||
MenuColumn {
|
MenuColumn {
|
||||||
label: "Help".into(),
|
label: "Help".into(),
|
||||||
|
|||||||
Reference in New Issue
Block a user