Remove remain alphabetical sorting enforcement macros (#1647)

remove `remain`

Co-authored-by: 0HyperCube <78500760+0HyperCube@users.noreply.github.com>
This commit is contained in:
Karthik Prakash
2024-03-06 16:43:51 +00:00
committed by GitHub
co-authored by 0HyperCube
parent a47fff905e
commit 0c60fd95fa
53 changed files with 21 additions and 292 deletions
+5 -46
View File
@@ -5,120 +5,79 @@ use graphene_core::raster::color::Color;
use serde::{Deserialize, Serialize};
#[remain::sorted]
#[impl_message(Message, Tool)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize)]
pub enum ToolMessage {
// Sub-messages
#[remain::unsorted]
#[child]
TransformLayer(TransformLayerMessage),
#[remain::unsorted]
#[child]
Select(SelectToolMessage),
#[remain::unsorted]
#[child]
Artboard(ArtboardToolMessage),
#[remain::unsorted]
#[child]
Navigate(NavigateToolMessage),
#[remain::unsorted]
#[child]
Eyedropper(EyedropperToolMessage),
#[remain::unsorted]
#[child]
Fill(FillToolMessage),
#[remain::unsorted]
#[child]
Gradient(GradientToolMessage),
#[remain::unsorted]
#[child]
Path(PathToolMessage),
#[remain::unsorted]
#[child]
Pen(PenToolMessage),
#[remain::unsorted]
#[child]
Freehand(FreehandToolMessage),
#[remain::unsorted]
#[child]
Spline(SplineToolMessage),
#[remain::unsorted]
#[child]
Line(LineToolMessage),
#[remain::unsorted]
#[child]
Rectangle(RectangleToolMessage),
#[remain::unsorted]
#[child]
Ellipse(EllipseToolMessage),
#[remain::unsorted]
#[child]
Polygon(PolygonToolMessage),
#[remain::unsorted]
#[child]
Text(TextToolMessage),
#[remain::unsorted]
#[child]
Brush(BrushToolMessage),
// #[remain::unsorted]
// #[child]
// // #[child]
// Heal(HealToolMessage),
// #[remain::unsorted]
// #[child]
// // #[child]
// Clone(CloneToolMessage),
// #[remain::unsorted]
// #[child]
// // #[child]
// Patch(PatchToolMessage),
// #[remain::unsorted]
// #[child]
// // #[child]
// Relight(RelightToolMessage),
// #[remain::unsorted]
// #[child]
// // #[child]
// Detail(DetailToolMessage),
#[remain::unsorted]
#[child]
Imaginate(ImaginateToolMessage),
// Messages
#[remain::unsorted]
ActivateToolSelect,
#[remain::unsorted]
ActivateToolArtboard,
#[remain::unsorted]
ActivateToolNavigate,
#[remain::unsorted]
ActivateToolEyedropper,
#[remain::unsorted]
ActivateToolText,
#[remain::unsorted]
ActivateToolFill,
#[remain::unsorted]
ActivateToolGradient,
#[remain::unsorted]
ActivateToolPath,
#[remain::unsorted]
ActivateToolPen,
#[remain::unsorted]
ActivateToolFreehand,
#[remain::unsorted]
ActivateToolSpline,
#[remain::unsorted]
ActivateToolLine,
#[remain::unsorted]
ActivateToolRectangle,
#[remain::unsorted]
ActivateToolEllipse,
#[remain::unsorted]
ActivateToolPolygon,
#[remain::unsorted]
ActivateToolBrush,
#[remain::unsorted]
ActivateToolImaginate,
ActivateTool {
@@ -17,7 +17,6 @@ pub struct ToolMessageHandler {
}
impl MessageHandler<ToolMessage, (&DocumentMessageHandler, DocumentId, &InputPreprocessorMessageHandler, &PersistentData, &NodeGraphExecutor)> for ToolMessageHandler {
#[remain::check]
fn process_message(
&mut self,
message: ToolMessage,
@@ -26,49 +25,30 @@ impl MessageHandler<ToolMessage, (&DocumentMessageHandler, DocumentId, &InputPre
) {
let font_cache = &persistent_data.font_cache;
#[remain::sorted]
match message {
// Messages
#[remain::unsorted]
ToolMessage::TransformLayer(message) => self
.transform_layer_handler
.process_message(message, responses, (document, input, &self.tool_state.tool_data, &mut self.shape_editor)),
#[remain::unsorted]
ToolMessage::ActivateToolSelect => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Select }),
#[remain::unsorted]
ToolMessage::ActivateToolArtboard => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Artboard }),
#[remain::unsorted]
ToolMessage::ActivateToolNavigate => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Navigate }),
#[remain::unsorted]
ToolMessage::ActivateToolEyedropper => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Eyedropper }),
#[remain::unsorted]
ToolMessage::ActivateToolText => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Text }),
#[remain::unsorted]
ToolMessage::ActivateToolFill => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Fill }),
#[remain::unsorted]
ToolMessage::ActivateToolGradient => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Gradient }),
#[remain::unsorted]
ToolMessage::ActivateToolPath => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Path }),
#[remain::unsorted]
ToolMessage::ActivateToolPen => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Pen }),
#[remain::unsorted]
ToolMessage::ActivateToolFreehand => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Freehand }),
#[remain::unsorted]
ToolMessage::ActivateToolSpline => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Spline }),
#[remain::unsorted]
ToolMessage::ActivateToolLine => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Line }),
#[remain::unsorted]
ToolMessage::ActivateToolRectangle => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Rectangle }),
#[remain::unsorted]
ToolMessage::ActivateToolEllipse => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Ellipse }),
#[remain::unsorted]
ToolMessage::ActivateToolPolygon => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Polygon }),
#[remain::unsorted]
ToolMessage::ActivateToolBrush => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Brush }),
#[remain::unsorted]
ToolMessage::ActivateToolImaginate => responses.add_front(ToolMessage::ActivateTool { tool_type: ToolType::Imaginate }),
ToolMessage::ActivateTool { tool_type } => {
@@ -241,7 +221,6 @@ impl MessageHandler<ToolMessage, (&DocumentMessageHandler, DocumentId, &InputPre
}
// Sub-messages
#[remain::unsorted]
tool_message => {
let tool_type = match &tool_message {
ToolMessage::UpdateCursor | ToolMessage::UpdateHints => self.tool_state.tool_data.active_tool_type,
@@ -15,27 +15,18 @@ pub struct ArtboardTool {
data: ArtboardToolData,
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Artboard)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum ArtboardToolMessage {
// Standard messages
#[remain::unsorted]
Abort,
#[remain::unsorted]
Overlays(OverlayContext),
// Tool-specific messages
DeleteSelected,
NudgeSelected {
delta_x: f64,
delta_y: f64,
},
NudgeSelected { delta_x: f64, delta_y: f64 },
PointerDown,
PointerMove {
constrain_axis_or_aspect: Key,
center: Key,
},
PointerMove { constrain_axis_or_aspect: Key, center: Key },
PointerUp,
}
@@ -51,14 +51,11 @@ impl Default for BrushOptions {
}
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Brush)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum BrushToolMessage {
// Standard messages
#[remain::unsorted]
Abort,
#[remain::unsorted]
WorkingColorChanged,
// Tool-specific messages
@@ -68,7 +65,6 @@ pub enum BrushToolMessage {
UpdateOptions(BrushToolMessageOptionsUpdate),
}
#[remain::sorted]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum BrushToolMessageOptionsUpdate {
BlendMode(BlendMode),
@@ -33,7 +33,6 @@ impl Default for EllipseToolOptions {
}
}
#[remain::sorted]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum EllipseOptionsUpdate {
FillColor(Option<Color>),
@@ -44,25 +43,18 @@ pub enum EllipseOptionsUpdate {
WorkingColors(Option<Color>, Option<Color>),
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Ellipse)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum EllipseToolMessage {
// Standard messages
#[remain::unsorted]
Overlays(OverlayContext),
#[remain::unsorted]
Abort,
#[remain::unsorted]
WorkingColorChanged,
// Tool-specific messages
DragStart,
DragStop,
PointerMove {
center: Key,
lock_ratio: Key,
},
PointerMove { center: Key, lock_ratio: Key },
UpdateOptions(EllipseOptionsUpdate),
}
@@ -7,12 +7,10 @@ pub struct EyedropperTool {
data: EyedropperToolData,
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Eyedropper)]
#[derive(PartialEq, Eq, Clone, Debug, Hash, Serialize, Deserialize, specta::Type)]
pub enum EyedropperToolMessage {
// Standard messages
#[remain::unsorted]
Abort,
// Tool-specific messages
@@ -7,7 +7,6 @@ pub struct FillTool {
fsm_state: FillToolFsmState,
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Fill)]
#[derive(PartialEq, Eq, Clone, Debug, Hash, Serialize, Deserialize, specta::Type)]
pub enum FillToolMessage {
@@ -39,16 +39,12 @@ impl Default for FreehandOptions {
}
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Freehand)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum FreehandToolMessage {
// Standard messages
#[remain::unsorted]
Overlays(OverlayContext),
#[remain::unsorted]
Abort,
#[remain::unsorted]
WorkingColorChanged,
// Tool-specific messages
@@ -58,7 +54,6 @@ pub enum FreehandToolMessage {
UpdateOptions(FreehandOptionsUpdate),
}
#[remain::sorted]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum FreehandOptionsUpdate {
FillColor(Option<Color>),
@@ -19,28 +19,22 @@ pub struct GradientOptions {
gradient_type: GradientType,
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Gradient)]
#[derive(PartialEq, Clone, Debug, Hash, Serialize, Deserialize, specta::Type)]
pub enum GradientToolMessage {
// Standard messages
#[remain::unsorted]
Abort,
#[remain::unsorted]
Overlays(OverlayContext),
// Tool-specific messages
DeleteStop,
InsertStop,
PointerDown,
PointerMove {
constrain_axis: Key,
},
PointerMove { constrain_axis: Key },
PointerUp,
UpdateOptions(GradientOptionsUpdate),
}
#[remain::sorted]
#[derive(PartialEq, Eq, Clone, Debug, Hash, Serialize, Deserialize, specta::Type)]
pub enum GradientOptionsUpdate {
Type(GradientType),
@@ -11,21 +11,16 @@ pub struct ImaginateTool {
tool_data: ImaginateToolData,
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Imaginate)]
#[derive(PartialEq, Eq, Clone, Debug, Hash, Serialize, Deserialize, specta::Type)]
pub enum ImaginateToolMessage {
// Standard messages
#[remain::unsorted]
Abort,
// Tool-specific messages
DragStart,
DragStop,
Resize {
center: Key,
lock_ratio: Key,
},
Resize { center: Key, lock_ratio: Key },
}
impl LayoutHolder for ImaginateTool {
@@ -32,30 +32,21 @@ impl Default for LineOptions {
}
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Line)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum LineToolMessage {
// Standard messages
#[remain::unsorted]
Overlays(OverlayContext),
#[remain::unsorted]
Abort,
#[remain::unsorted]
WorkingColorChanged,
// Tool-specific messages
DragStart,
DragStop,
PointerMove {
center: Key,
lock_angle: Key,
snap_angle: Key,
},
PointerMove { center: Key, lock_angle: Key, snap_angle: Key },
UpdateOptions(LineOptionsUpdate),
}
#[remain::sorted]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum LineOptionsUpdate {
LineWeight(f64),
@@ -6,22 +6,15 @@ pub struct NavigateTool {
tool_data: NavigateToolData,
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Navigate)]
#[derive(PartialEq, Eq, Clone, Debug, Hash, Serialize, Deserialize, specta::Type)]
pub enum NavigateToolMessage {
// Standard messages
#[remain::unsorted]
Abort,
// Tool-specific messages
ClickZoom {
zoom_in: bool,
},
PointerMove {
snap_angle: Key,
snap_zoom: Key,
},
ClickZoom { zoom_in: bool },
PointerMove { snap_angle: Key, snap_zoom: Key },
RotateCanvasBegin,
TransformCanvasEnd,
TranslateCanvasBegin,
@@ -19,16 +19,12 @@ pub struct PathTool {
tool_data: PathToolData,
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Path)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum PathToolMessage {
// Standard messages
#[remain::unsorted]
Abort,
#[remain::unsorted]
Overlays(OverlayContext),
#[remain::unsorted]
SelectionChanged,
// Tool-specific messages
@@ -39,29 +39,20 @@ impl Default for PenOptions {
}
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Pen)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum PenToolMessage {
// Standard messages
#[remain::unsorted]
Abort,
#[remain::unsorted]
SelectionChanged,
#[remain::unsorted]
WorkingColorChanged,
#[remain::unsorted]
Overlays(OverlayContext),
// Tool-specific messages
Confirm,
DragStart,
DragStop,
PointerMove {
snap_angle: Key,
break_handle: Key,
lock_angle: Key,
},
PointerMove { snap_angle: Key, break_handle: Key, lock_angle: Key },
Redo,
Undo,
UpdateOptions(PenOptionsUpdate),
@@ -75,7 +66,6 @@ enum PenToolFsmState {
PlacingAnchor,
}
#[remain::sorted]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum PenOptionsUpdate {
FillColor(Option<Color>),
@@ -37,25 +37,18 @@ impl Default for PolygonOptions {
}
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Polygon)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum PolygonToolMessage {
// Standard messages
#[remain::unsorted]
Overlays(OverlayContext),
#[remain::unsorted]
Abort,
#[remain::unsorted]
WorkingColorChanged,
// Tool-specific messages
DragStart,
DragStop,
PointerMove {
center: Key,
lock_ratio: Key,
},
PointerMove { center: Key, lock_ratio: Key },
UpdateOptions(PolygonOptionsUpdate),
}
@@ -65,7 +58,6 @@ pub enum PrimitiveShapeType {
Star = 1,
}
#[remain::sorted]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum PolygonOptionsUpdate {
FillColor(Option<Color>),
@@ -33,7 +33,6 @@ impl Default for RectangleToolOptions {
}
}
#[remain::sorted]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum RectangleOptionsUpdate {
FillColor(Option<Color>),
@@ -44,25 +43,18 @@ pub enum RectangleOptionsUpdate {
WorkingColors(Option<Color>, Option<Color>),
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Rectangle)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum RectangleToolMessage {
// Standard messages
#[remain::unsorted]
Overlays(OverlayContext),
#[remain::unsorted]
Abort,
#[remain::unsorted]
WorkingColorChanged,
// Tool-specific messages
DragStart,
DragStop,
PointerMove {
center: Key,
lock_ratio: Key,
},
PointerMove { center: Key, lock_ratio: Key },
UpdateOptions(RectangleOptionsUpdate),
}
@@ -30,7 +30,6 @@ pub struct SelectOptions {
nested_selection_behavior: NestedSelectionBehavior,
}
#[remain::sorted]
#[derive(PartialEq, Eq, Clone, Debug, Hash, Serialize, Deserialize, specta::Type)]
pub enum SelectOptionsUpdate {
NestedSelectionBehavior(NestedSelectionBehavior),
@@ -60,32 +59,22 @@ pub struct SelectToolPointerKeys {
pub duplicate: Key,
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Select)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum SelectToolMessage {
// Standard messages
#[remain::unsorted]
Abort,
#[remain::unsorted]
Overlays(OverlayContext),
// Tool-specific messages
DragStart {
add_to_selection: Key,
select_deepest: Key,
},
DragStop {
remove_from_selection: Key,
},
DragStart { add_to_selection: Key, select_deepest: Key },
DragStop { remove_from_selection: Key },
EditLayer,
Enter,
PointerMove(SelectToolPointerKeys),
PointerOutsideViewport(SelectToolPointerKeys),
SelectOptions(SelectOptionsUpdate),
SetPivot {
position: PivotPosition,
},
SetPivot { position: PivotPosition },
ShiftViewport,
}
@@ -34,16 +34,12 @@ impl Default for SplineOptions {
}
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Spline)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum SplineToolMessage {
// Standard messages
#[remain::unsorted]
CanvasTransformed,
#[remain::unsorted]
Abort,
#[remain::unsorted]
WorkingColorChanged,
// Tool-specific messages
@@ -62,7 +58,6 @@ enum SplineToolFsmState {
Drawing,
}
#[remain::sorted]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum SplineOptionsUpdate {
FillColor(Option<Color>),
@@ -40,32 +40,23 @@ impl Default for TextOptions {
}
}
#[remain::sorted]
#[impl_message(Message, ToolMessage, Text)]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum TextToolMessage {
// Standard messages
#[remain::unsorted]
Abort,
#[remain::unsorted]
WorkingColorChanged,
#[remain::unsorted]
Overlays(OverlayContext),
// Tool-specific messages
CommitText,
EditSelected,
Interact,
TextChange {
new_text: String,
},
UpdateBounds {
new_text: String,
},
TextChange { new_text: String },
UpdateBounds { new_text: String },
UpdateOptions(TextOptionsUpdate),
}
#[remain::sorted]
#[derive(PartialEq, Clone, Debug, Serialize, Deserialize, specta::Type)]
pub enum TextOptionsUpdate {
FillColor(Option<Color>),
@@ -3,7 +3,6 @@ use crate::messages::prelude::*;
use serde::{Deserialize, Serialize};
#[remain::sorted]
#[impl_message(Message, ToolMessage, TransformLayer)]
#[derive(PartialEq, Eq, Clone, Debug, Serialize, Deserialize)]
pub enum TransformLayerMessage {
@@ -42,7 +42,6 @@ impl TransformLayerMessageHandler {
type TransformData<'a> = (&'a DocumentMessageHandler, &'a InputPreprocessorMessageHandler, &'a ToolData, &'a mut ShapeState);
impl<'a> MessageHandler<TransformLayerMessage, TransformData<'a>> for TransformLayerMessageHandler {
#[remain::check]
fn process_message(&mut self, message: TransformLayerMessage, responses: &mut VecDeque<Message>, (document, input, tool_data, shape_editor): TransformData) {
use TransformLayerMessage::*;
@@ -91,7 +90,6 @@ impl<'a> MessageHandler<TransformLayerMessage, TransformData<'a>> for TransformL
selected.original_transforms.clear();
};
#[remain::sorted]
match message {
ApplyTransformOperation => {
selected.original_transforms.clear();