mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 06:38:03 +08:00
* Added new DocumentResponse variant * Update Operation::DeleteSelectedManipulatorPoints to update Layer Tree by delegating deletion to Operation::DeleteLayer. Also emits Operation::DeletedSelectedManipulatorPoints to let editor clear Properties panel * Update process_message() to deal with new DocumentResponse::DeletedSelectedManipulatorPoints match case. When this DocumentResponse is emitted, it clears the Properties panel. * Added Display trait implementation for DocumentResponse::DeletedSelectedManipulatorPoints. Updated imports in document_message_handler.rs to get the correct types for messages emitted from DocumentResponse::DeletedSelectedManipulatorPoints match case in process_message(). * Removed useless import. Capitalized comments for style consistency. * Updated messages emitted to clear Properties panel by emitting LayoutMessage::SendLayout's instead, which update the backend widget state * Revert inclusion of unused imports --------- Co-authored-by: Keavon Chambers <keavon@keavon.com>
39 lines
1.1 KiB
Rust
39 lines
1.1 KiB
Rust
use crate::LayerId;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
use std::fmt;
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Hash)]
|
|
#[repr(C)]
|
|
pub enum DocumentResponse {
|
|
/// For the purposes of rendering, this triggers a re-render of the entire document.
|
|
DocumentChanged,
|
|
FolderChanged {
|
|
path: Vec<LayerId>,
|
|
},
|
|
CreatedLayer {
|
|
path: Vec<LayerId>,
|
|
},
|
|
DeletedLayer {
|
|
path: Vec<LayerId>,
|
|
},
|
|
/// Triggers an update of the layer in the layer panel.
|
|
LayerChanged {
|
|
path: Vec<LayerId>,
|
|
},
|
|
DeletedSelectedManipulatorPoints,
|
|
}
|
|
|
|
impl fmt::Display for DocumentResponse {
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
match self {
|
|
DocumentResponse::DocumentChanged { .. } => write!(f, "DocumentChanged"),
|
|
DocumentResponse::FolderChanged { .. } => write!(f, "FolderChanged"),
|
|
DocumentResponse::CreatedLayer { .. } => write!(f, "CreatedLayer"),
|
|
DocumentResponse::LayerChanged { .. } => write!(f, "LayerChanged"),
|
|
DocumentResponse::DeletedLayer { .. } => write!(f, "DeleteLayer"),
|
|
DocumentResponse::DeletedSelectedManipulatorPoints { .. } => write!(f, "DeletedSelectedManipulatorPoints"),
|
|
}
|
|
}
|
|
}
|