Bulk rename gcore -> gstd in editor (#2729)

* remove `gcore` dependency from `editor`

* editor: bulk rename `gcore` -> `gstd`, cargo fmt
This commit is contained in:
Firestar99
2025-06-19 20:28:17 -07:00
committed by Keavon Chambers
parent 13226f7049
commit 6b69a75391
62 changed files with 198 additions and 201 deletions
@@ -1,7 +1,7 @@
use crate::messages::layout::utility_types::widget_prelude::*;
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
use crate::messages::prelude::*;
use graphene_core::Color;
use graphene_std::Color;
use graphene_std::vector::style::FillChoice;
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize, specta::Type)]
@@ -60,14 +60,14 @@ impl ToolColorOptions {
pub fn apply_fill(&self, layer: LayerNodeIdentifier, responses: &mut VecDeque<Message>) {
if let Some(color) = self.active_color() {
let fill = graphene_core::vector::style::Fill::solid(color.to_gamma_srgb());
let fill = graphene_std::vector::style::Fill::solid(color.to_gamma_srgb());
responses.add(GraphOperationMessage::FillSet { layer, fill });
}
}
pub fn apply_stroke(&self, weight: f64, layer: LayerNodeIdentifier, responses: &mut VecDeque<Message>) {
if let Some(color) = self.active_color() {
let stroke = graphene_core::vector::style::Stroke::new(Some(color.to_gamma_srgb()), weight);
let stroke = graphene_std::vector::style::Stroke::new(Some(color.to_gamma_srgb()), weight);
responses.add(GraphOperationMessage::StrokeSet { layer, stroke });
}
}
@@ -8,12 +8,12 @@ use glam::DVec2;
use graph_craft::concrete;
use graph_craft::document::value::TaggedValue;
use graph_craft::document::{NodeId, NodeInput};
use graphene_core::Color;
use graphene_core::raster::BlendMode;
use graphene_core::raster_types::{CPU, GPU, RasterDataTable};
use graphene_core::text::{Font, TypesettingConfig};
use graphene_core::vector::style::Gradient;
use graphene_std::Color;
use graphene_std::NodeInputDecleration;
use graphene_std::raster::BlendMode;
use graphene_std::raster_types::{CPU, GPU, RasterDataTable};
use graphene_std::text::{Font, TypesettingConfig};
use graphene_std::vector::style::Gradient;
use graphene_std::vector::{ManipulatorPointId, PointId, SegmentId, VectorModificationType};
use std::collections::VecDeque;
@@ -12,8 +12,8 @@ use crate::messages::tool::common_functionality::utility_functions::is_visible_p
use crate::messages::tool::tool_messages::path_tool::{PathOverlayMode, PointSelectState};
use bezier_rs::{Bezier, BezierHandles, Subpath, TValue};
use glam::{DAffine2, DVec2};
use graphene_core::vector::{ManipulatorPointId, PointId, VectorData, VectorModificationType};
use graphene_std::vector::{HandleId, SegmentId};
use graphene_std::vector::{ManipulatorPointId, PointId, VectorData, VectorModificationType};
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum SelectionChange {
@@ -13,10 +13,10 @@ pub use alignment_snapper::*;
use bezier_rs::TValue;
pub use distribution_snapper::*;
use glam::{DAffine2, DVec2};
use graphene_core::renderer::Quad;
use graphene_core::vector::PointId;
use graphene_std::renderer::Quad;
use graphene_std::renderer::Rect;
use graphene_std::vector::NoHashBuilder;
use graphene_std::vector::PointId;
pub use grid_snapper::*;
pub use layer_snapper::*;
pub use snap_results::*;
@@ -1,7 +1,7 @@
use super::*;
use crate::messages::portfolio::document::utility_types::misc::*;
use glam::{DAffine2, DVec2};
use graphene_core::renderer::Quad;
use graphene_std::renderer::Quad;
#[derive(Clone, Debug, Default)]
pub struct AlignmentSnapper {
@@ -2,7 +2,7 @@ use super::*;
use crate::messages::portfolio::document::utility_types::document_metadata::LayerNodeIdentifier;
use crate::messages::portfolio::document::utility_types::misc::*;
use glam::DVec2;
use graphene_core::renderer::Quad;
use graphene_std::renderer::Quad;
use std::collections::VecDeque;
#[derive(Clone, Debug, Default)]
@@ -1,7 +1,7 @@
use super::*;
use crate::messages::portfolio::document::utility_types::misc::{GridSnapTarget, GridSnapping, GridType, SnapTarget};
use glam::DVec2;
use graphene_core::renderer::Quad;
use graphene_std::renderer::Quad;
struct Line {
pub point: DVec2,
@@ -5,8 +5,8 @@ use crate::messages::portfolio::document::utility_types::misc::*;
use crate::messages::prelude::*;
use bezier_rs::{Bezier, Identifier, Subpath, TValue};
use glam::{DAffine2, DVec2};
use graphene_core::renderer::Quad;
use graphene_core::vector::PointId;
use graphene_std::renderer::Quad;
use graphene_std::vector::PointId;
#[derive(Clone, Debug, Default)]
pub struct LayerSnapper {
@@ -4,9 +4,9 @@ use crate::messages::portfolio::document::utility_types::misc::{DistributionSnap
use crate::messages::tool::common_functionality::snapping::SnapCandidatePoint;
use bezier_rs::Bezier;
use glam::DVec2;
use graphene_core::renderer::Quad;
use graphene_core::vector::PointId;
use graphene_std::renderer::Quad;
use graphene_std::renderer::Rect;
use graphene_std::vector::PointId;
use std::collections::VecDeque;
#[derive(Clone, Debug, Default)]
@@ -11,7 +11,7 @@ use crate::messages::prelude::*;
use crate::messages::tool::common_functionality::compass_rose::Axis;
use crate::messages::tool::common_functionality::snapping::SnapTypeConfiguration;
use glam::{DAffine2, DMat2, DVec2};
use graphene_core::renderer::Quad;
use graphene_std::renderer::Quad;
use graphene_std::renderer::Rect;
/// (top, bottom, left, right)
@@ -4,8 +4,8 @@ use crate::messages::tool::common_functionality::graph_modification_utils::get_t
use crate::messages::tool::tool_messages::path_tool::PathOverlayMode;
use bezier_rs::Bezier;
use glam::DVec2;
use graphene_core::renderer::Quad;
use graphene_core::text::{FontCache, load_face};
use graphene_std::renderer::Quad;
use graphene_std::text::{FontCache, load_face};
use graphene_std::vector::{HandleId, ManipulatorPointId, PointId, SegmentId, VectorData, VectorModificationType};
/// Determines if a path should be extended. Goal in viewport space. Returns the path and if it is extending from the start, if applicable.
@@ -64,7 +64,7 @@ pub fn text_bounding_box(layer: LayerNodeIdentifier, document: &DocumentMessageH
};
let buzz_face = font_cache.get(font).map(|data| load_face(data));
let far = graphene_core::text::bounding_box(text, buzz_face.as_ref(), typesetting, false);
let far = graphene_std::text::bounding_box(text, buzz_face.as_ref(), typesetting, false);
Quad::from_box([DVec2::ZERO, far])
}
+1 -1
View File
@@ -1,7 +1,7 @@
use super::utility_types::ToolType;
use crate::messages::preferences::SelectionMode;
use crate::messages::prelude::*;
use graphene_core::raster::color::Color;
use graphene_std::raster::color::Color;
#[impl_message(Message, Tool)]
#[derive(PartialEq, Clone, Debug, serde::Serialize, serde::Deserialize)]
@@ -7,7 +7,7 @@ use crate::messages::portfolio::utility_types::PersistentData;
use crate::messages::prelude::*;
use crate::messages::tool::utility_types::ToolType;
use crate::node_graph_executor::NodeGraphExecutor;
use graphene_core::raster::color::Color;
use graphene_std::raster::color::Color;
const ARTBOARD_OVERLAY_PROVIDER: OverlayProvider = |context| DocumentMessage::DrawArtboardOverlays(context).into();
@@ -11,7 +11,7 @@ use crate::messages::tool::common_functionality::snapping::SnapData;
use crate::messages::tool::common_functionality::snapping::SnapManager;
use crate::messages::tool::common_functionality::transformation_cage::*;
use graph_craft::document::NodeId;
use graphene_core::renderer::Quad;
use graphene_std::renderer::Quad;
#[derive(Default)]
pub struct ArtboardTool {
@@ -335,12 +335,12 @@ impl Fsm for ArtboardToolFsmState {
responses.add(GraphOperationMessage::NewArtboard {
id,
artboard: graphene_core::Artboard {
graphic_group: graphene_core::GraphicGroupTable::default(),
artboard: graphene_std::Artboard {
graphic_group: graphene_std::GraphicGroupTable::default(),
label: String::from("Artboard"),
location: start.min(end).round().as_ivec2(),
dimensions: (start.round() - end.round()).abs().as_ivec2(),
background: graphene_core::Color::WHITE,
background: graphene_std::Color::WHITE,
clip: false,
},
})
@@ -562,12 +562,12 @@ impl Fsm for ArtboardToolFsmState {
mod test_artboard {
pub use crate::test_utils::test_prelude::*;
async fn get_artboards(editor: &mut EditorTestUtils) -> Vec<graphene_core::Artboard> {
async fn get_artboards(editor: &mut EditorTestUtils) -> Vec<graphene_std::Artboard> {
let instrumented = match editor.eval_graph().await {
Ok(instrumented) => instrumented,
Err(e) => panic!("Failed to evaluate graph: {}", e),
};
instrumented.grab_all_input::<graphene_core::append_artboard::ArtboardInput>(&editor.runtime).collect()
instrumented.grab_all_input::<graphene_std::append_artboard::ArtboardInput>(&editor.runtime).collect()
}
#[tokio::test]
@@ -7,9 +7,9 @@ use crate::messages::portfolio::document::utility_types::network_interface::Flow
use crate::messages::tool::common_functionality::color_selector::{ToolColorOptions, ToolColorType};
use graph_craft::document::NodeId;
use graph_craft::document::value::TaggedValue;
use graphene_core::Color;
use graphene_core::raster::BlendMode;
use graphene_core::vector::brush_stroke::{BrushInputSample, BrushStroke, BrushStyle};
use graphene_std::Color;
use graphene_std::raster::BlendMode;
use graphene_std::vector::brush_stroke::{BrushInputSample, BrushStroke, BrushStyle};
const BRUSH_MAX_SIZE: f64 = 5000.;
@@ -11,7 +11,7 @@ use crate::messages::tool::common_functionality::resize::Resize;
use crate::messages::tool::common_functionality::snapping::SnapData;
use graph_craft::document::value::TaggedValue;
use graph_craft::document::{NodeId, NodeInput};
use graphene_core::Color;
use graphene_std::Color;
#[derive(Default)]
pub struct EllipseTool {
@@ -320,7 +320,7 @@ impl Fsm for EllipseToolFsmState {
mod test_ellipse {
pub use crate::test_utils::test_prelude::*;
use glam::DAffine2;
use graphene_core::vector::generator_nodes::ellipse;
use graphene_std::vector::generator_nodes::ellipse;
#[derive(Debug, PartialEq)]
struct ResolvedEllipse {
@@ -1,7 +1,7 @@
use super::tool_prelude::*;
use crate::messages::portfolio::document::overlays::utility_types::OverlayContext;
use crate::messages::tool::common_functionality::graph_modification_utils::NodeGraphLayer;
use graphene_core::vector::style::Fill;
use graphene_std::vector::style::Fill;
#[derive(Default)]
pub struct FillTool {
@@ -157,7 +157,7 @@ impl Fsm for FillToolFsmState {
#[cfg(test)]
mod test_fill {
pub use crate::test_utils::test_prelude::*;
use graphene_core::vector::fill;
use graphene_std::vector::fill;
use graphene_std::vector::style::Fill;
async fn get_fills(editor: &mut EditorTestUtils) -> Vec<Fill> {
@@ -9,8 +9,8 @@ use crate::messages::tool::common_functionality::graph_modification_utils;
use crate::messages::tool::common_functionality::utility_functions::should_extend;
use glam::DVec2;
use graph_craft::document::NodeId;
use graphene_core::Color;
use graphene_core::vector::VectorModificationType;
use graphene_std::Color;
use graphene_std::vector::VectorModificationType;
use graphene_std::vector::{PointId, SegmentId};
#[derive(Default)]
@@ -349,7 +349,7 @@ mod test_freehand {
use crate::messages::tool::tool_messages::freehand_tool::FreehandOptionsUpdate;
use crate::test_utils::test_prelude::*;
use glam::{DAffine2, DVec2};
use graphene_core::vector::VectorData;
use graphene_std::vector::VectorData;
async fn get_vector_data(editor: &mut EditorTestUtils) -> Vec<(VectorData, DAffine2)> {
let document = editor.active_document();
@@ -5,7 +5,7 @@ use crate::messages::portfolio::document::utility_types::document_metadata::Laye
use crate::messages::tool::common_functionality::auto_panning::AutoPanning;
use crate::messages::tool::common_functionality::graph_modification_utils::{NodeGraphLayer, get_gradient};
use crate::messages::tool::common_functionality::snapping::SnapManager;
use graphene_core::vector::style::{Fill, Gradient, GradientType};
use graphene_std::vector::style::{Fill, Gradient, GradientType};
#[derive(Default)]
pub struct GradientTool {
@@ -538,9 +538,9 @@ mod test_gradient {
use crate::messages::portfolio::document::{graph_operation::utility_types::TransformIn, utility_types::misc::GroupFolderType};
pub use crate::test_utils::test_prelude::*;
use glam::DAffine2;
use graphene_core::vector::fill;
use graphene_core::vector::style::Gradient;
use graphene_std::vector::fill;
use graphene_std::vector::style::Fill;
use graphene_std::vector::style::Gradient;
use super::gradient_space_transform;
@@ -10,7 +10,7 @@ use crate::messages::tool::common_functionality::graph_modification_utils::{self
use crate::messages::tool::common_functionality::snapping::{SnapCandidatePoint, SnapConstraint, SnapData, SnapManager, SnapTypeConfiguration};
use graph_craft::document::value::TaggedValue;
use graph_craft::document::{NodeId, NodeInput};
use graphene_core::Color;
use graphene_std::Color;
#[derive(Default)]
pub struct LineTool {
@@ -17,9 +17,9 @@ use crate::messages::tool::common_functionality::shape_editor::{
use crate::messages::tool::common_functionality::snapping::{SnapCache, SnapCandidatePoint, SnapConstraint, SnapData, SnapManager};
use crate::messages::tool::common_functionality::utility_functions::{calculate_segment_angle, find_two_param_best_approximate};
use bezier_rs::{Bezier, TValue};
use graphene_core::renderer::Quad;
use graphene_core::vector::{ManipulatorPointId, PointId, VectorModificationType};
use graphene_std::renderer::Quad;
use graphene_std::vector::{HandleId, NoHashBuilder, SegmentId, VectorData};
use graphene_std::vector::{ManipulatorPointId, PointId, VectorModificationType};
use std::vec;
#[derive(Default)]
@@ -13,9 +13,9 @@ use crate::messages::tool::common_functionality::snapping::{SnapCache, SnapCandi
use crate::messages::tool::common_functionality::utility_functions::{calculate_segment_angle, closest_point, should_extend};
use bezier_rs::{Bezier, BezierHandles};
use graph_craft::document::NodeId;
use graphene_core::Color;
use graphene_core::vector::{PointId, VectorModificationType};
use graphene_std::Color;
use graphene_std::vector::{HandleId, ManipulatorPointId, NoHashBuilder, SegmentId, StrokeId, VectorData};
use graphene_std::vector::{PointId, VectorModificationType};
#[derive(Default)]
pub struct PenTool {
@@ -12,7 +12,7 @@ use crate::messages::tool::common_functionality::resize::Resize;
use crate::messages::tool::common_functionality::snapping::SnapData;
use graph_craft::document::value::TaggedValue;
use graph_craft::document::{NodeId, NodeInput};
use graphene_core::Color;
use graphene_std::Color;
#[derive(Default)]
pub struct PolygonTool {
@@ -11,7 +11,7 @@ use crate::messages::tool::common_functionality::resize::Resize;
use crate::messages::tool::common_functionality::snapping::SnapData;
use graph_craft::document::value::TaggedValue;
use graph_craft::document::{NodeId, NodeInput};
use graphene_core::Color;
use graphene_std::Color;
#[derive(Default)]
pub struct RectangleTool {
@@ -26,7 +26,7 @@ use crate::messages::tool::common_functionality::utility_functions::text_boundin
use bezier_rs::Subpath;
use glam::DMat2;
use graph_craft::document::NodeId;
use graphene_core::renderer::Quad;
use graphene_std::renderer::Quad;
use graphene_std::renderer::Rect;
use graphene_std::transform::ReferencePoint;
use graphene_std::vector::misc::BooleanOperation;
@@ -181,7 +181,7 @@ impl SelectTool {
}
fn boolean_widgets(&self, selected_count: usize) -> impl Iterator<Item = WidgetHolder> + use<> {
let list = <BooleanOperation as graphene_core::registry::ChoiceTypeStatic>::list();
let list = <BooleanOperation as graphene_std::registry::ChoiceTypeStatic>::list();
list.into_iter().map(|i| i.into_iter()).flatten().map(move |(operation, info)| {
let mut tooltip = info.label.to_string();
if let Some(doc) = info.docstring.as_deref() {
@@ -563,7 +563,7 @@ impl Fsm for SelectToolFsmState {
.metadata()
.bounding_box_with_transform(layer, transform.inverse() * document.metadata().transform_to_viewport(layer))
})
.reduce(graphene_core::renderer::Quad::combine_bounds);
.reduce(graphene_std::renderer::Quad::combine_bounds);
// When not in Drawing State
// Only highlight layers if the viewport is not being panned (middle mouse button is pressed)
@@ -11,7 +11,7 @@ use crate::messages::tool::common_functionality::graph_modification_utils::{self
use crate::messages::tool::common_functionality::snapping::{SnapCandidatePoint, SnapData, SnapManager, SnapTypeConfiguration, SnappedPoint};
use crate::messages::tool::common_functionality::utility_functions::{closest_point, should_extend};
use graph_craft::document::{NodeId, NodeInput};
use graphene_core::Color;
use graphene_std::Color;
use graphene_std::vector::{PointId, SegmentId, VectorModificationType};
#[derive(Default)]
@@ -541,8 +541,8 @@ mod test_spline_tool {
use crate::messages::tool::tool_messages::spline_tool::find_spline;
use crate::test_utils::test_prelude::*;
use glam::DAffine2;
use graphene_core::vector::VectorData;
use graphene_std::vector::PointId;
use graphene_std::vector::VectorData;
fn assert_point_positions(vector_data: &VectorData, layer_to_viewport: DAffine2, expected_points: &[DVec2], epsilon: f64) {
let points_in_viewport: Vec<DVec2> = vector_data
@@ -16,10 +16,10 @@ use crate::messages::tool::common_functionality::transformation_cage::*;
use crate::messages::tool::common_functionality::utility_functions::text_bounding_box;
use graph_craft::document::value::TaggedValue;
use graph_craft::document::{NodeId, NodeInput};
use graphene_core::Color;
use graphene_core::renderer::Quad;
use graphene_core::text::{Font, FontCache, TypesettingConfig, lines_clipping, load_face};
use graphene_core::vector::style::Fill;
use graphene_std::Color;
use graphene_std::renderer::Quad;
use graphene_std::text::{Font, FontCache, TypesettingConfig, lines_clipping, load_face};
use graphene_std::vector::style::Fill;
#[derive(Default)]
pub struct TextTool {
@@ -43,8 +43,8 @@ impl Default for TextOptions {
font_size: 24.,
line_height_ratio: 1.2,
character_spacing: 1.,
font_name: graphene_core::consts::DEFAULT_FONT_FAMILY.into(),
font_style: graphene_core::consts::DEFAULT_FONT_STYLE.into(),
font_name: graphene_std::consts::DEFAULT_FONT_FAMILY.into(),
font_style: graphene_std::consts::DEFAULT_FONT_STYLE.into(),
fill: ToolColorOptions::new_primary(),
}
}
@@ -469,7 +469,7 @@ impl Fsm for TextToolFsmState {
});
if let Some(editing_text) = tool_data.editing_text.as_mut() {
let buzz_face = font_cache.get(&editing_text.font).map(|data| load_face(data));
let far = graphene_core::text::bounding_box(&tool_data.new_text, buzz_face.as_ref(), editing_text.typesetting, false);
let far = graphene_std::text::bounding_box(&tool_data.new_text, buzz_face.as_ref(), editing_text.typesetting, false);
if far.x != 0. && far.y != 0. {
let quad = Quad::from_box([DVec2::ZERO, far]);
let transformed_quad = document.metadata().transform_to_viewport(tool_data.layer) * quad;
@@ -9,8 +9,8 @@ use crate::messages::tool::common_functionality::shape_editor::ShapeState;
use crate::messages::tool::tool_messages::tool_prelude::Key;
use crate::messages::tool::utility_types::{ToolData, ToolType};
use glam::{DAffine2, DVec2};
use graphene_core::renderer::Quad;
use graphene_core::vector::ManipulatorPointId;
use graphene_std::renderer::Quad;
use graphene_std::vector::ManipulatorPointId;
use graphene_std::vector::{VectorData, VectorModificationType};
use std::f64::consts::{PI, TAU};
@@ -721,7 +721,7 @@ mod test_transform_layer {
use crate::messages::tool::transform_layer::transform_layer_message_handler::VectorModificationType;
use crate::test_utils::test_prelude::*;
use glam::DAffine2;
use graphene_core::vector::PointId;
use graphene_std::vector::PointId;
use std::collections::VecDeque;
async fn get_layer_transform(editor: &mut EditorTestUtils, layer: LayerNodeIdentifier) -> Option<DAffine2> {
+2 -2
View File
@@ -12,8 +12,8 @@ use crate::messages::portfolio::document::overlays::utility_types::OverlayProvid
use crate::messages::preferences::PreferencesMessageHandler;
use crate::messages::prelude::*;
use crate::node_graph_executor::NodeGraphExecutor;
use graphene_core::raster::color::Color;
use graphene_core::text::FontCache;
use graphene_std::raster::color::Color;
use graphene_std::text::FontCache;
use std::borrow::Cow;
use std::fmt::{self, Debug};