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

📄 teeedit.pas

📁 TeeChart7Source 控件
💻 PAS
📖 第 1 页 / 共 2 页
字号:
{*****************************************}
{   TeeChart Pro                          }
{   Copyright (c) 1995-2004 David Berneda }
{     TChartEditor                        }
{     TChartPreviewer                     }
{     TChartEditorPanel                   }
{*****************************************}
unit TeeEdit;
{$I TeeDefs.inc}

interface

uses {$IFNDEF LINUX}
     Messages,
     {$ENDIF}
     SysUtils, Classes,
     {$IFDEF CLX}
     QGraphics, QControls, QForms, QDialogs, QStdCtrls, QExtCtrls, QComCtrls,
     {$ELSE}
     Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls,
     {$ENDIF}
     Chart, TeeEditCha, TeeLisB, TeeProcs, TeEngine, TeePrevi, TeePreviewPanel;

type
  TCustomChartEditor=class(TComponent)
  private
    { Private declarations }
    FChart   : TCustomChart;
    FTitle   : String;
    FOnClose : TNotifyEvent;
    FOnShow  : TNotifyEvent;
  protected
    { Protected declarations }
    procedure Notification( AComponent: TComponent;
                            Operation: TOperation); override;
    procedure SetChart(const Value: TCustomChart); virtual;
  public
    { Public declarations }
    Procedure Execute; virtual; // abstract;

    property Title:String read FTitle write FTitle;
  published
    { Published declarations }
    property Chart:TCustomChart read FChart write SetChart;
    property OnClose: TNotifyEvent read FOnClose write FOnClose;
    property OnShow: TNotifyEvent read FOnShow write FOnShow;
  end;

  TChartEditor = class(TCustomChartEditor)
  private
    { Private declarations }
    FAutoRepaint   : Boolean;
    FDefaultTab    : TChartEditorTab;
    FHideTabs      : TChartEditorHiddenTabs;
    FHighLight     : Boolean;
    FOnChangeOrder : TChangeOrderEvent;
    FOptions       : TChartEditorOptions;
    FRememberPosition: Boolean;
    FSeries        : TChartSeries;
    FTree          : Boolean;

    procedure ChangeSeriesOrder(Sender:TChartListBox;
                                Series1,Series2:TCustomChartSeries);
    procedure SetSeries(const Value: TChartSeries);
  protected
    procedure Notification( AComponent: TComponent;
                            Operation: TOperation); override;
    procedure SetChart(const Value: TCustomChart); override;
  public
    { Public declarations }
    Constructor Create(AOwner:TComponent); override;

    Procedure Execute; override;
  published
    { Published declarations }
    property AutoRepaint:Boolean read FAutoRepaint write FAutoRepaint default True;
    property DefaultTab:TChartEditorTab read FDefaultTab write FDefaultTab default cetMain;
    property HideTabs:TChartEditorHiddenTabs read FHideTabs write FHideTabs default [];
    property HighLightTabs:Boolean read FHighLight write FHighLight default False;
    property Options:TChartEditorOptions read FOptions write FOptions
                                         default eoAll;
    property RememberPosition:Boolean read FRememberPosition write
                                      FRememberPosition default False;
    property Series:TChartSeries read FSeries write SetSeries;
    property Title;
    property TreeView:Boolean read FTree write FTree default False;

    { events }
    property OnChangeSeriesOrder:TChangeOrderEvent read FOnChangeOrder
                                                   write FOnChangeOrder;
  end;

  TChartPreviewOption=( cpoChangePrinter,
                        cpoSetupPrinter,
                        cpoResizeChart,
                        cpoMoveChart,
                        cpoChangeDetail,
                        cpoChangePaperOrientation,
                        cpoChangeMargins,
                        cpoProportional,
                        cpoDragChart,
                        cpoPrintPanel,
                        cpoAsBitmap );

  TChartPreviewOptions=set of TChartPreviewOption;

Const DefaultChartPreviewOptions=[ cpoChangePrinter,
                                   cpoSetupPrinter,
                                   cpoResizeChart,
                                   cpoMoveChart,
                                   cpoChangeDetail,
                                   cpoChangePaperOrientation,
                                   cpoChangeMargins,
                                   cpoProportional ];


type
  TChartPreviewer = class(TCustomChartEditor)
  private
    FOnAfterDraw: TNotifyEvent;
    FOptions    : TChartPreviewOptions;
    FPaperColor : TColor;
    FWindowState: TWindowState;

    TheForm     : TChartPreview;
    function GetPreview: TTeePreviewPanel;
    { Private declarations }
  protected
    { Protected declarations }
  public
    { Public declarations }
    Constructor Create(AOwner:TComponent); override;
    Procedure Execute; override;
    property PreviewPanel : TTeePreviewPanel read GetPreview;
  published
    { Published declarations }
    property Options:TChartPreviewOptions read FOptions write FOptions
             default DefaultChartPreviewOptions;
    property PaperColor:TColor read FPaperColor write FPaperColor default clWhite;
    property Title;
    property WindowState:TWindowState read FWindowState write FWindowState default wsNormal;

    property OnAfterDraw:TNotifyEvent read FOnAfterDraw write FOnAfterDraw;
  end;

  TChartEditorPanel=class(TCustomPanelNoCaption)
  private
    FChart  : TCustomChart;
    FEditor : TChartEditForm;

    {$IFNDEF CLX}
    procedure CMShowingChanged(var Message: TMessage); message CM_SHOWINGCHANGED;
    {$ENDIF}

    Procedure SetChart(Value:TCustomChart);
  protected
    procedure Notification( AComponent: TComponent;
                            Operation: TOperation); override;
  public
    { Public declarations }
    Constructor Create(AOwner:TComponent); override;
    Procedure SelectUnderMouse;
    property Editor:TChartEditForm read FEditor;
  published
    property Align;
    property BevelOuter default bvLowered;
    property Chart:TCustomChart read FChart write SetChart;

    {$IFNDEF CLX}
    property UseDockManager default True;
    property DockSite;
    property DragCursor;
    property DragMode;
    {$ENDIF}
    property Enabled;
    property ParentColor;
    property ParentShowHint;
    property PopupMenu;
    property ShowHint;
    property TabOrder;
    property TabStop;
    property Visible;
    property Anchors;
    {$IFNDEF CLX}
    property AutoSize;
    {$ENDIF}
    property Constraints;
    {$IFNDEF CLX}
    property DragKind;
    property Locked;
    {$ENDIF}

    { TPanel events }
    property OnClick;
    {$IFNDEF CLX}
    {$IFDEF D5}
    property OnContextPopup;
    {$ENDIF}
    {$ENDIF}
    property OnDblClick;
    {$IFNDEF CLX}
    property OnDragDrop;
    property OnDragOver;
    property OnEndDrag;
    {$ENDIF}
    property OnEnter;
    property OnExit;
    property OnKeyDown;
    property OnKeyPress;
    property OnKeyUp;
    property OnMouseDown;
    property OnMouseMove;
    property OnMouseUp;
    property OnResize;
    {$IFNDEF CLX}
    property OnMouseWheel;
    property OnMouseWheelDown;
    property OnMouseWheelUp;
    property OnStartDrag;
    property OnConstrainedResize;
    property OnCanResize;
    property OnDockDrop;
    property OnDockOver;
    property OnEndDock;
    property OnGetSiteInfo;
    property OnStartDock;
    property OnUnDock;
    {$ENDIF}
  end;

implementation

Uses TeeProCo, EditChar, TeeEdiAxis, TeeEdiTitl, TeePenDlg;

{ TCustomChartEditor }
procedure TCustomChartEditor.Notification(AComponent: TComponent;
  Operation: TOperation);
begin
  inherited;
  if (Operation=opRemove) and Assigned(FChart) and (AComponent=FChart) then
     Chart:=nil;
end;

Procedure TCustomChartEditor.Execute; // virtual; abstract;
begin
end;

procedure TCustomChartEditor.SetChart(const Value: TCustomChart);
begin
  if FChart<>Value then
  begin
    {$IFDEF D5}
    if Assigned(FChart) then FChart.RemoveFreeNotification(Self);
    {$ENDIF}
    FChart:=Value;
    if Assigned(FChart) then FChart.FreeNotification(Self);
  end;
end;

{ TChartEditor }
Constructor TChartEditor.Create(AOwner:TComponent);
begin
  inherited;
  FHideTabs:=[];
  FOptions:=eoAll;
  FDefaultTab:=cetMain;
  FAutoRepaint:=True;
end;

procedure TChartEditor.ChangeSeriesOrder(Sender:TChartListBox;
                                         Series1,Series2:TCustomChartSeries);
begin
  if Assigned(FOnChangeOrder) then FOnChangeOrder(Sender,Series1,Series2);
end;

procedure TChartEditor.Execute;

⌨️ 快捷键说明

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