// $Revision: 1.25 $ // Copyright (C) 1994 Taligent, Inc. All rights reserved. #ifndef Taligent_CANVASCOMMANDS #define Taligent_CANVASCOMMANDS #ifndef Taligent_GRAFEDIT #include #endif #ifndef Taligent_PRIMITIVECLASSES #include #endif #ifndef Taligent_CANVASCORECOMMANDS #include #endif // Classes defined in this file: class TSetCanvasGraphicFillColorCmd; class TSetCanvasGraphicFrameColorCmd; class TSetCanvasGraphicLineWidthCmd; class TScaleCanvasGraphicCms; class TRotateCanvasGraphicCmd; class TTranslateCanvasGraphicCmd; class TTransformCanvasGraphicCmd; // ******************************************************************************** // class TSetCanvasGraphicFillColorCmd // // description A command that sets the fill color of each graphic in the // selection. It also saves the old colors for individual graphics // and associates them with the graphic ids. When called to // undo, it looks up the old color associated with the id and re-applies // it. // // ******************************************************************************** class TSetCanvasGraphicFillColorCmd : public TChangeCanvasGraphicCmd { public: TSetCanvasGraphicFillColorCmd (); TSetCanvasGraphicFillColorCmd (const TColor&); TSetCanvasGraphicFillColorCmd (const TSetCanvasGraphicFillColorCmd&); virtual ~TSetCanvasGraphicFillColorCmd (); //======================================== // MCollectible Overrides //======================================== MCollectibleDeclarationsMacro (TSetCanvasGraphicFillColorCmd); virtual TStream& operator>>= (TStream&) const; virtual TStream& operator<<= (TStream&); TSetCanvasGraphicFillColorCmd& operator= (const TSetCanvasGraphicFillColorCmd&); virtual void SetColor (const TColor&); protected: //======================================== // TChangeCanvasGraphicCmd Overrides //======================================== virtual void BeginChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void ContinueChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void UndoChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void RedoChange (MCanvasRepresentation&, MCanvasGraphic&); #ifndef NO_Internal private: void* fExtension; TDeleterFor fColor; TDeleterFor< TCanvasGraphicAssociationsWith > fUndoRedoMemory; enum Version { kOriginalVersion }; #endif }; // ******************************************************************************** // class TSetCanvasGraphicFrameColorCmd // // description A command that sets the frame color of each graphic in the // selection. It also saves the old colors for individual graphics // and associates them with the graphic ids. When called to // undo, it looks up the old color associated with the id and re-applies // it. // // ******************************************************************************** class TSetCanvasGraphicFrameColorCmd : public TChangeCanvasGraphicCmd { public: TSetCanvasGraphicFrameColorCmd (); TSetCanvasGraphicFrameColorCmd (const TColor&); TSetCanvasGraphicFrameColorCmd (const TSetCanvasGraphicFrameColorCmd&); virtual ~TSetCanvasGraphicFrameColorCmd (); //======================================== // MCollectible Overrides //======================================== MCollectibleDeclarationsMacro (TSetCanvasGraphicFrameColorCmd); virtual TStream& operator>>= (TStream&) const; virtual TStream& operator<<= (TStream&); TSetCanvasGraphicFrameColorCmd& operator= (const TSetCanvasGraphicFrameColorCmd&); //======================================== // TSetCanvasGraphicFrameColorCmd Methods //======================================== virtual void SetColor (const TColor&); protected: //======================================== // TChangeCanvasGraphicCmd Overrides //======================================== virtual void BeginChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void ContinueChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void UndoChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void RedoChange (MCanvasRepresentation&, MCanvasGraphic&); #ifndef NO_Internal private: void* fExtension; TDeleterFor fColor; TDeleterFor< TCanvasGraphicAssociationsWith > fUndoRedoMemory; enum Version { kOriginalVersion }; #endif }; // ******************************************************************************** // class TSetCanvasGraphicLineWidthCmd // // description A command that sets the line width of each graphic in the // selection. It also saves the old widths for individual graphics // and associates them with the graphic ids. When called to // undo, it looks up the old width associated with the id and reapplies // it. // // ******************************************************************************** class TSetCanvasGraphicLineWidthCmd : public TChangeCanvasGraphicCmd { public: TSetCanvasGraphicLineWidthCmd (); TSetCanvasGraphicLineWidthCmd (GCoordinate); TSetCanvasGraphicLineWidthCmd (const TSetCanvasGraphicLineWidthCmd&); virtual ~TSetCanvasGraphicLineWidthCmd (); //======================================== // MCollectible Overrides //======================================== MCollectibleDeclarationsMacro (TSetCanvasGraphicLineWidthCmd); virtual TStream& operator>>= (TStream&) const; virtual TStream& operator<<= (TStream&); TSetCanvasGraphicLineWidthCmd& operator= (const TSetCanvasGraphicLineWidthCmd&); //======================================== // TSetCanvasGraphicLineWidthCmd Methods //======================================== virtual void SetWidth (GCoordinate); protected: //======================================== // TChangeCanvasGraphicCmd Overrides //======================================== virtual void BeginChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void ContinueChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void UndoChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void RedoChange (MCanvasRepresentation&, MCanvasGraphic&); #ifndef NO_Internal private: void* fExtension; GCoordinate fWidth; TDeleterFor< TCanvasGraphicAssociationsWith > fUndoRedoMemory; enum Version { kOriginalVersion }; #endif }; // ******************************************************************************** // class TScaleCanvasGraphicCmd // // description A command that scales each graphic in the selection by a // specified scale factor (x and y) around a specified center of // scaling. All scaling can be centered around a single // absolute point, or around a relative point (top, bottom, // left, right, or center) with respect to each graphic in the // selection. Undo reverses the scaling. Round-off error // can make this slightly imprecise, but it's much cheaper than // cloning the entire graphics for undo. // // ******************************************************************************** class TScaleCanvasGraphicCmd : public TChangeCanvasGraphicCmd { public: TScaleCanvasGraphicCmd (); TScaleCanvasGraphicCmd (const TGPoint& centerOfScale); TScaleCanvasGraphicCmd (const TGPoint& scaleFactor, const TGPoint& centerOfScale); TScaleCanvasGraphicCmd (const TScaleCanvasGraphicCmd&); virtual ~TScaleCanvasGraphicCmd (); //======================================== // MCollectible Overrides //======================================== MCollectibleDeclarationsMacro (TScaleCanvasGraphicCmd); virtual TStream& operator>>= (TStream&) const; virtual TStream& operator<<= (TStream&); TScaleCanvasGraphicCmd& operator= (const TScaleCanvasGraphicCmd&); //======================================== // TScaleCanvasGraphicCmd Methods //======================================== virtual void SetScaleFactor (const TGPoint&); #ifndef NO_Internal virtual void HandleStreamOutIncrementDelta(TStream&) const; virtual void HandleStreamInIncrementDelta(TStream&); #endif protected: //======================================== // TChangeCanvasGraphicCmd Overrides //======================================== virtual void BeginChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void ContinueChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void UndoChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void RedoChange (MCanvasRepresentation&, MCanvasGraphic&); #ifndef NO_Internal private: void* fExtension; TGPoint fScaleFactor; TGPoint fCenter; TDeleterFor< TCanvasGraphicAssociationsWith > fUndoRedoMemory; enum Version { kOriginalVersion }; #endif }; // ******************************************************************************** // class TRotateCanvasGraphicCmd // // description A command that rotates each graphic in the selection by a // specified number of degrees around a specified center of // rotation. All rotation can be centered around a single // absolute point, or around a relative point (top, bottom, // left, right, or center) with respect to each graphic in the // selection. Undo reverses the rotation. Round-off error // can make this slightly imprecise, but it's much cheaper than // cloning the entire graphics for undo. // // ******************************************************************************** class TRotateCanvasGraphicCmd : public TChangeCanvasGraphicCmd { public: TRotateCanvasGraphicCmd (); TRotateCanvasGraphicCmd (const TGPoint& centerOfRotation); TRotateCanvasGraphicCmd (GDegrees degrees, const TGPoint& centerOfRotation); TRotateCanvasGraphicCmd (const TRotateCanvasGraphicCmd&); virtual ~TRotateCanvasGraphicCmd (); //======================================== // MCollectible Overrides //======================================== MCollectibleDeclarationsMacro (TRotateCanvasGraphicCmd); virtual TStream& operator>>= (TStream&) const; virtual TStream& operator<<= (TStream&); TRotateCanvasGraphicCmd& operator= (const TRotateCanvasGraphicCmd&); //======================================== // TRotateCanvasGraphicCmd Methods //======================================== virtual void SetAngle (GDegrees); protected: //======================================== // TChangeCanvasGraphicCmd Overrides //======================================== virtual void BeginChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void ContinueChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void UndoChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void RedoChange (MCanvasRepresentation&, MCanvasGraphic&); #ifndef NO_Internal virtual void HandleStreamOutIncrementDelta(TStream&) const; virtual void HandleStreamInIncrementDelta(TStream&); #endif #ifndef NO_Internal private: void* fExtension; GDegrees fAngle; TGPoint fCenter; TDeleterFor< TCanvasGraphicAssociationsWith > fUndoRedoMemory; enum Version { kOriginalVersion }; #endif }; // ******************************************************************************** // class TTranslateCanvasGraphicCmd // // description A command that translates each graphic in the selection by a // specified offset (x and y). Undo reverses the translation. // Round-off error can make this slightly imprecise, but it's much // cheaper than cloning the entire graphics for undo. // // ******************************************************************************** class TTranslateCanvasGraphicCmd : public TChangeCanvasGraphicCmd { public: TTranslateCanvasGraphicCmd (); TTranslateCanvasGraphicCmd (const TGPoint& offset); TTranslateCanvasGraphicCmd (const TTranslateCanvasGraphicCmd&); virtual ~TTranslateCanvasGraphicCmd (); //======================================== // MCollectible Overrides //======================================== MCollectibleDeclarationsMacro (TTranslateCanvasGraphicCmd); virtual TStream& operator>>= (TStream&) const; virtual TStream& operator<<= (TStream&); TTranslateCanvasGraphicCmd& operator= (const TTranslateCanvasGraphicCmd&); //======================================== // TTranslateCanvasGraphicCmd Methods //======================================== virtual void SetOffset (const TGPoint&); protected: //======================================== // TChangeCanvasGraphicCmd Overrides //======================================== virtual void BeginChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void ContinueChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void UndoChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void RedoChange (MCanvasRepresentation&, MCanvasGraphic&); #ifndef NO_Internal virtual void HandleStreamOutIncrementDelta(TStream&) const; virtual void HandleStreamInIncrementDelta(TStream&); #endif #ifndef NO_Internal private: void* fExtension; TGPoint fOffset; TDeleterFor< TCanvasGraphicAssociationsWith > fUndoRedoMemory; enum Version { kOriginalVersion }; #endif }; // ******************************************************************************** // class TTransformCanvasGraphicCmd // // description A command that transforms each graphic in the selection by a // specified graf matrix. Undo reverses the transformation. // Round-off error can make this slightly imprecise, but it's much // cheaper than cloning the entire graphics for undo. // // ******************************************************************************** class TTransformCanvasGraphicCmd : public TChangeCanvasGraphicCmd { public: TTransformCanvasGraphicCmd (); TTransformCanvasGraphicCmd (const TGrafMatrix&); TTransformCanvasGraphicCmd (const TTransformCanvasGraphicCmd&); virtual ~TTransformCanvasGraphicCmd (); //======================================== // MCollectible Overrides //======================================== MCollectibleDeclarationsMacro (TTransformCanvasGraphicCmd); virtual TStream& operator>>= (TStream&) const; virtual TStream& operator<<= (TStream&); TTransformCanvasGraphicCmd& operator= (const TTransformCanvasGraphicCmd&); //======================================== // TTransformCanvasGraphicCmd Methods //======================================== virtual void SetTransform (const TGrafMatrix&); #ifndef NO_Internal virtual void HandleStreamOutIncrementDelta(TStream&) const; virtual void HandleStreamInIncrementDelta(TStream&); #endif protected: //======================================== // TChangeCanvasGraphicCmd Overrides //======================================== virtual void BeginChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void ContinueChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void UndoChange (MCanvasRepresentation&, MCanvasGraphic&); virtual void RedoChange (MCanvasRepresentation&, MCanvasGraphic&); #ifndef NO_Internal private: void* fExtension; TDeleterFor fTransform; TDeleterFor< TCanvasGraphicAssociationsWith > fUndoRedoMemory; enum Version { kOriginalVersion }; #endif }; #endif // Taligent_CANVASCOMMANDS