⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flexbase.int

📁 FlexGraphics是一套创建矢量图形的VCL组件
💻 INT
📖 第 1 页 / 共 5 页
字号:
/////////////////////////////////////////////////////////
//                                                     //
//    FlexGraphics library                             //
//    Copyright (c) 2002-2009, FlexGraphics software.  //
//                                                     //
//    FlexGraphics library base classes                //
//                                                     //
/////////////////////////////////////////////////////////

unit FlexBase;

{$I FlexDefs.inc}

interface

uses
  Windows, Classes, Messages, Forms, Controls, SysUtils, ExtCtrls, Graphics,
  Dialogs, Menus, Printers, Consts, ClipBrd,
  {$IFDEF FG_D6} Variants, RTLConsts, {$ENDIF}
  FlexProps, FlexUtils, FlexPath, FlexAlpha, FlexHistory;

const
  FlexGraphicsVersion = 170;

  ClassNamePrefix  = 'TFlex';

  MinScale = 1;
  MaxScale = 100 * PixelScaleFactor div 2;

  StdConnectorsMinGap = 8 * PixelScaleFactor;

  // Constants in pixels
  AnchorPointSize = 5;
  SelectionMarkerSize = 6;
  SelectionInflate = 8;
  SelectionPointInflate = 2;
  SelectionThreshold = 4;
  ConnectorStickThreshold = 16;
  DefaultLinkPointSize = 7;

  // Perfomance params
  MaxSinglePointsInvalidation = 20;

type
  TResizeCursor   = ( rcrNone,
                      rcrTopLeft, rcrTop, rcrTopRight, rcrLeft, rcrRight,
                      rcrBottomLeft, rcrBottom, rcrBottomRight );
  TFlexToolMode   = ( ftmSelect, ftmSelecting, ftmZoom, ftmZooming,
                      ftmMove, ftmMoving, ftmResize, ftmResizing, ftmCreating,
                      ftmPointEdit, ftmPointSelecting, ftmPointEditing,
                      ftmCurveMoving, ftmCurveContinue,
                      ftmPan, ftmPanning,
                      ftmUser );
  TFlexAlign      = ( faLeft, faHCenter, faRight,
                      faTop, faVCenter, faBottom, faCenter );
  TFlexSnap       = ( snLeft, snTop, snRight, snBottom, snCenter, snAll );
  TFlexSnaps      = set of TFlexSnap;
  TFlexStateItem  = ( fsCreating, fsDestroying, fsAdding, fsExtracting,
                      fsResizing, fsEndUpdating, fsRecording, fsLoading );
  TFlexState      = set of TFlexStateItem;

  TFlexLoadFunc   = ( lfNew, lfAdd );

  TFlexGridStyle  = ( gsLines, gsDots );

  TFlexAlphaBufferMode = ( amAuto, amRequired, amNotRequired );

  PFlexEditPointGuide = ^TFlexEditPointGuide;
  TFlexEditPointGuide = record
   Count: integer;
   NewPoint: TPoint;
   Points: TPointArray;
   PaintPoints: TPointArray;
   Types: TPointTypeArray;
   Visible: TSelectedArray;
  end;

  TFlexPanel = class;
  TFlexLayer = class;
  TFlexControl = class;
  TFlexServiceControl = class;
  TFlexCustomScheme = class;

  TFlexNotifyEvent = procedure(Sender: TObject; Control: TFlexControl;
    Notify: TFlexNotify) of object;

  TFlexControlCreateEvent = procedure(Sender: TObject; Control: TFlexControl;
    var ControlDocRect: TRect) of object;

  TFlexControlClass = class of TFlexControl;
  TFlexControlClasses = array of TFlexControlClass;

  PFlexCreateInDesignInfo = ^TFlexCreateInDesignInfo;
  TFlexCreateInDesignInfo = record
   IsPointEdit: boolean;
   PointEditIndex: integer;
   IsContinueAvail: boolean;
   PointContinueIndex: integer;
  end;

  PPassControlRec = ^TPassControlRec;
  TPassControlRec = record
   Control: TFlexControl;
   FirstControl: TFlexControl;
   Indexes: array of integer;
  end;

  PLinkPointInfo = ^TLinkPointInfo;
  TLinkPointInfo = record
   Control: TFlexControl;
   Index: integer;
   DocPos: TPoint;
   Size: integer; // DefaultLinkPointSize
  end;

  TSchemeRefProp = class(TCustomProp)
  private
   FValue: TFlexControl;
   procedure SetValue(const Value: TFlexControl);
  protected
   function  GetDisplayValue: string; override;
   function  GetNamesControl: TFlexControl; virtual;
  public
   constructor Create(AOwner: TPropList; const AName: string);
   procedure GetEnumList(List: TStrings); override;
   procedure SetPropValue(const PropName: string; Value: Variant); override;
   function  GetPropValue(const PropName: string): Variant; override;
   property  Value: TFlexControl read FValue write SetValue;
  end;

  TLinkProp = class(TCustomProp)
  private
   FValue: string;
   FLinkChanged: boolean;
   FOnLinkedNotify: TNotifyLinkEvent;
   FOnLinkedFreeNotify: TNotifyLinkEvent;
   function  GetValue: string;
   procedure SetValue(const Value: string);
   procedure SetControl(const Value: TFlexControl);
   procedure SetProp(const Value: TCustomProp);
  protected
   FControl: TFlexControl;
   FProp: TCustomProp;
   FLinkToOtherOwner: boolean;
   function  GetDisplayValue: string; override;
   procedure SetDisplayValue(const Value: string); override;
   function  SetLink(AControl: TFlexControl; AProp: TCustomProp): boolean;
     virtual;
   procedure LinkedNotify(Sender: TObject; Source: TNotifyLink;
     const Info: TNotifyLinkInfo); virtual;
   procedure LinkedFreeNotify(Sender: TObject; Source: TNotifyLink;
     const Info: TNotifyLinkInfo); virtual;
  public
   constructor Create(AOwner: TPropList; const AName: string);
   destructor Destroy; override;
   procedure SetPropValue(const PropName: string; Value: Variant); override;
   function  GetPropValue(const PropName: string): Variant; override;
   property  LinkedControl: TFlexControl read FControl write SetControl;
   property  LinkedProp: TCustomProp read FProp write SetProp;
   property  Value: string read GetValue write SetValue;
   property  NotifyLink read FNotifyLink;
   property  OnLinkedNotify: TNotifyLinkEvent read FOnLinkedNotify
     write FOnLinkedNotify;
   property  OnLinkedFreeNotify: TNotifyLinkEvent read FOnLinkedFreeNotify
     write FOnLinkedFreeNotify;
  end;

  TLinkPointProp = class(TLinkProp)
  private
   FConnector: TFlexControl;
   FLinkPoint: TPoint;
   FSavedPoint: TPoint;
   FSavedRect: TRect;
   procedure SetLinkPoint(const Value: TPoint);
  protected
   function  SetLink(AControl: TFlexControl; AProp: TCustomProp): boolean;
     override;
   procedure LinkedNotify(Sender: TObject; Source: TNotifyLink;
     const Info: TNotifyLinkInfo); override;
  public
   constructor Create(AOwner: TPropList; const AName: string);
   function  IndexOfLinkPoint: integer;
   property  LinkedProp: TCustomProp read FProp;
   property  LinkPoint: TPoint read FLinkPoint write SetLinkPoint;
  end;

  TLayerProp = class(TStrProp)
  private
   function  GetControl: TFlexLayer;
   procedure SetControl(const Value: TFlexLayer);
  protected
   procedure SetValue(const Value: string); override;
  public
   constructor Create(AOwner: TPropList; const AName: string);
   procedure GetEnumList(List: TStrings); override;
   property  Control: TFlexLayer read GetControl write SetControl;
  end;

  TFlexControl = class
  private
   FOwner: TFlexPanel;
   FParent: TFlexControl;
   FLayer: TFlexLayer;
   FState: TFlexState;
   FControls: TList;
   FProps: TPropList;
   FCheckID: LongWord;
   FNonVisual: boolean;
   FNoPaintRectCheck: boolean;
   FUpdateCounter: integer;
   FPointsDesigning: integer;
   FNotifyLink: TNotifyLink;
   FLinkPoints: TList;
   FLinkPointsChanged: boolean;
   FRectChanged: boolean;
   FTranslateCount: integer;
   FNameProp: TStrProp;
   FLeftProp: TIntProp;
   FTopProp: TIntProp;
   FWidthProp: TIntProp;
   FHeightProp: TIntProp;
   FIdProp: TLongWordProp;
   FTagProp: TIntProp;
   FVisibleProp: TBoolProp;
   FLayerProp: TLayerProp; //TStrProp;
   FHintProp: TStrListProp;
   FShowHintProp: TBoolProp;
   FReferenceProp: TSchemeRefProp;
   FUserDataProp: TUserDataProp;
   FTransparencyProp: TIntProp;
   FSelectableProp: TBoolProp;
   function  GetControl(Index: integer): TFlexControl;
   function  GetCount: integer;
   function  GetIsSelected: boolean;
   function  GetName: string;
   function  GetVisual: boolean;
   function  GetID: LongWord;
   function  GetHeight: integer;
   function  GetLeft: integer;
   function  GetTop: integer;
   function  GetWidth: integer;
   function  GetHint: string;
   function  GetShowHint: boolean;
   function  GetTag: integer;
   function  GetVisible: boolean;
   procedure SetParent(const Value: TFlexControl);
   procedure SetName(const Value: string);
   procedure SetLeft(Value: integer);
   procedure SetTop(Value: integer);
   procedure SetWidth(Value: integer);
   procedure SetHeight(Value: integer);
   procedure SetID(Value: LongWord);
   procedure SetLayer(Value: TFlexLayer);
   procedure SetHint(const Value: string);
   procedure SetShowHint(Value: boolean);
   procedure SetTag(Value: integer);
   procedure SetVisible(Value: boolean);
   procedure SetIsSelected(Value: boolean);
   function  GetDocRect: TRect;
   function  GetPaintRect: TRect;
   procedure GetLayerStrProp(Sender: TObject; out Value: string);
   function  GetByName(const Name: string): TFlexControl;
   function  GetParentScheme: TFlexCustomScheme;
   procedure SetOwner(Value: TFlexPanel);
   function  GetRef: TFlexCustomScheme;
   procedure SetRef(Value: TFlexCustomScheme);
   function  GetNode(NodeIndex: integer): TPoint;
   procedure SetNode(NodeIndex: integer; const Value: TPoint);
   function  GetNodeCount: integer;
   function  GetNodeType(NodeIndex: integer): TPointType;
   procedure SetNodeType(NodeIndex: integer; const Value: TPointType);
   function  GetLinkPoint(Index: integer): TPoint;
   function  GetLinkPointCount: integer;
   procedure SetLinkPoint(Index: integer; const Value: TPoint);
   function  GetTransparency: integer;
   procedure SetTransparency(const Value: integer);
   function  GetSelectable: boolean;
   procedure SetSelectable(const Value: boolean);
  protected
   FAnchorEnabled: boolean;
   FSavedDocRect: TRect;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -