📄 flexactions.int
字号:
/////////////////////////////////////////////////////////
// //
// FlexGraphics library //
// Copyright (c) 2002-2009, FlexGraphics software. //
// //
// History actions and groups //
// //
/////////////////////////////////////////////////////////
unit FlexActions;
{$I FlexDefs.inc}
interface
uses
Windows, Classes,
FlexBase, FlexProps, FlexHistory, FlexPath, FlexUtils;
type
TDocRectHistoryAction = class(TIdHistoryAction)
protected
FUndoDocRect: TRect;
FRedoDocRect: TRect;
FUndoExist: boolean;
FRedoExist: boolean;
class function DoIsRecordable(Source: TObject;
Parent: THistoryGroup): boolean; override;
procedure DoRecordAction(Source: TObject); override;
procedure DoUndo(Source: TObject); override;
procedure DoRedo(Source: TObject); override;
public
procedure OffsetUndo(const Diff: TPoint);
property UndoDocRect: TRect read FUndoDocRect write FUndoDocRect;
property RedoDocRect: TRect read FRedoDocRect write FRedoDocRect;
property UndoExist: boolean read FUndoExist write FUndoExist;
property RedoExist: boolean read FRedoExist write FRedoExist;
end;
TPointsHistoryActionInfo = record
Exist: boolean;
DocRect: TRect;
Points: TPointArray;
Types: TPointTypeArray;
end;
TPointsHistoryAction = class(TIdHistoryAction)
protected
FUndo: TPointsHistoryActionInfo;
FRedo: TPointsHistoryActionInfo;
class function DoIsRecordable(Source: TObject;
Parent: THistoryGroup): boolean; override;
procedure Save(var Info: TPointsHistoryActionInfo; Control: TFlexControl);
procedure Restore(var Info: TPointsHistoryActionInfo; Control: TFlexControl);
procedure DoRecordAction(Source: TObject); override;
procedure DoUndo(Source: TObject); override;
procedure DoRedo(Source: TObject); override;
public
procedure OffsetUndo(const Diff: TPoint);
procedure SetUndoSavedDocRect(Control: TFlexControl);
property UndoInfo: TPointsHistoryActionInfo read FUndo write FUndo;
property RedoInfo: TPointsHistoryActionInfo read FRedo write FRedo;
end;
TOrderHistoryActionInfo = record
Exist: boolean;
Index: integer;
ParentId: LongWord;
LayerId: LongWord;
end;
TOrderHistoryAction = class(TIdHistoryAction)
protected
FUndo: TOrderHistoryActionInfo;
FRedo: TOrderHistoryActionInfo;
procedure Save(var Info: TOrderHistoryActionInfo; Control: TFlexControl);
procedure Restore(var Info: TOrderHistoryActionInfo; Control: TFlexControl;
CurIndex: integer);
procedure DoRecordAction(Source: TObject); override;
procedure DoUndo(Source: TObject); override;
procedure DoRedo(Source: TObject); override;
public
property UndoInfo: TOrderHistoryActionInfo read FUndo;
property RedoInfo: TOrderHistoryActionInfo read FRedo;
end;
TGroupUngroupHistoryAction = class(TIdHistoryAction)
protected
FSourcePanel: TFlexPanel;
FGroupClass: TFlexGroupClass;
FSelected: TList;
procedure SelectControls;
procedure Save(Source: TFlexGroup);
public
destructor Destroy; override;
end;
TControlGroupHistoryAction = class(TGroupUngroupHistoryAction)
protected
procedure DoUndo(Source: TObject); override;
procedure DoRedo(Source: TObject); override;
procedure DoRecordAction(Source: TObject); override;
end;
TControlUngroupHistoryAction = class(TGroupUngroupHistoryAction)
protected
procedure DoUndo(Source: TObject); override;
procedure DoRedo(Source: TObject); override;
procedure DoRecordAction(Source: TObject); override;
end;
TCustomControlHistoryAction = class(TIdHistoryAction)
protected
function ProcessSource(Stream: TStream; Source: TObject;
DoLoad: boolean): boolean; override;
public
class function RecordAction(
Source: TFlexControl): TCustomControlHistoryAction;
end;
TCreateDestroyHistoryGroup = class(THistoryGroup)
protected
FStream: TMemoryStream;
FSourcePanel: TFlexPanel;
FSourceId: LongWord;
FParentId: LongWord;
FParentIndex: integer;
class function DoIsRecordable(Source: TObject;
Parent: THistoryGroup): boolean; override;
procedure SaveSource(Source: TObject);
function ProcessSource(Source: TFlexControl; DoLoad: boolean): boolean;
public
property SourcePanel: TFlexPanel read FSourcePanel write FSourcePanel;
property SourceId: LongWord read FSourceId write FSourceId;
property ParentId: LongWord read FParentId write FParentId;
property ParentIndex: integer read FParentIndex write FParentIndex;
property Stream: TMemoryStream read FStream;
end;
TControlCreateHistoryGroup = class(TCreateDestroyHistoryGroup)
protected
procedure DoUndo(Source: TObject); override;
procedure DoRedo(Source: TObject); override;
procedure DoRecordAction(Source: TObject); override;
end;
TControlDestroyHistoryGroup = class(TCreateDestroyHistoryGroup)
protected
procedure DoUndo(Source: TObject); override;
procedure DoRedo(Source: TObject); override;
procedure DoRecordAction(Source: TObject); override;
end;
TFlexPanelHistoryGroup = class(THistoryGroup)
protected
FSourcePanel: TFlexPanel;
public
constructor Create(AOwner: THistory; AParent: THistoryGroup); override;
property SourcePanel: TFlexPanel read FSourcePanel write FSourcePanel;
end;
TPanelSizeMoveHistoryGroup = class(TFlexPanelHistoryGroup);
TPanelAlignHistoryGroup = class(TFlexPanelHistoryGroup);
TPanelCreateControlsHistoryGroup = class(TFlexPanelHistoryGroup);
TPanelDestroyControlsHistoryGroup = class(TFlexPanelHistoryGroup);
TPanelUngroupControlsHistoryGroup = class(TFlexPanelHistoryGroup);
TPanelDuplicateHistoryGroup = class(TFlexPanelHistoryGroup);
TPanelCloneHistoryGroup = class(TFlexPanelHistoryGroup);
TPanelOrderHistoryGroup = class(TFlexPanelHistoryGroup);
TPanelPointsHistoryGroup = class(TFlexPanelHistoryGroup);
TPanelRerouteHistoryGroup = class(TFlexPanelHistoryGroup);
TPanelColorHistoryGroup = class(TFlexPanelHistoryGroup);
TPanelPropsHistoryGroup = class(TFlexPanelHistoryGroup);
implementation
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -