mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-21 08:08:12 +08:00
Massively reorganize and clean up the whole Rust codebase (#478)
* Massively reorganize and clean up the whole Rust codebase * Additional changes during code review
This commit is contained in:
@@ -1,30 +1,16 @@
|
||||
pub use crate::document::layer_panel::*;
|
||||
use crate::document::{DocumentMessage, LayerMetadata};
|
||||
use crate::input::InputPreprocessor;
|
||||
use super::layer_panel::LayerMetadata;
|
||||
use crate::input::InputPreprocessorMessageHandler;
|
||||
use crate::message_prelude::*;
|
||||
use glam::{DAffine2, DVec2};
|
||||
|
||||
use graphene::color::Color;
|
||||
use graphene::document::Document as GrapheneDocument;
|
||||
use graphene::layers::style::{self, Fill, ViewMode};
|
||||
use graphene::Operation as DocumentOperation;
|
||||
|
||||
use glam::{DAffine2, DVec2};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::VecDeque;
|
||||
|
||||
#[remain::sorted]
|
||||
#[impl_message(Message, DocumentMessage, Artboard)]
|
||||
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum ArtboardMessage {
|
||||
AddArtboard { top: f64, left: f64, height: f64, width: f64 },
|
||||
DispatchOperation(Box<DocumentOperation>),
|
||||
RenderArtboards,
|
||||
}
|
||||
|
||||
impl From<DocumentOperation> for ArtboardMessage {
|
||||
fn from(operation: DocumentOperation) -> Self {
|
||||
Self::DispatchOperation(Box::new(operation))
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
|
||||
pub struct ArtboardMessageHandler {
|
||||
pub artboards_graphene_document: GrapheneDocument,
|
||||
@@ -37,9 +23,9 @@ impl ArtboardMessageHandler {
|
||||
}
|
||||
}
|
||||
|
||||
impl MessageHandler<ArtboardMessage, (&mut LayerMetadata, &GrapheneDocument, &InputPreprocessor)> for ArtboardMessageHandler {
|
||||
impl MessageHandler<ArtboardMessage, (&mut LayerMetadata, &GrapheneDocument, &InputPreprocessorMessageHandler)> for ArtboardMessageHandler {
|
||||
#[remain::check]
|
||||
fn process_action(&mut self, message: ArtboardMessage, _data: (&mut LayerMetadata, &GrapheneDocument, &InputPreprocessor), responses: &mut VecDeque<Message>) {
|
||||
fn process_action(&mut self, message: ArtboardMessage, _data: (&mut LayerMetadata, &GrapheneDocument, &InputPreprocessorMessageHandler), responses: &mut VecDeque<Message>) {
|
||||
// let (layer_metadata, document, ipp) = data;
|
||||
use ArtboardMessage::*;
|
||||
#[remain::sorted]
|
||||
|
||||
Reference in New Issue
Block a user