{**********************************************}
{   TeeChart Selector Tool                     }
{   Copyright (c) 2001-2020 by Steema Software }
{        All Rights Reserved                   }
{**********************************************}
unit TeeSelectorToolEditor;
{$I TeeDefs.inc}

interface

uses
  {$IFNDEF LINUX}
  Windows, Messages,
  {$ENDIF}
  SysUtils, Classes,

  Graphics, Controls, Forms, Dialogs, ComCtrls, StdCtrls, Buttons,
  {$IFDEF D9}
  Types,
  {$ENDIF}

  TeeProcs, TeEngine, Chart, TeeTools, TeCanvas, TeePenDlg, TeeSelectorTool;

type
  { Form Editor }
  TSelectorToolEditor = class(TForm)
    ButtonPen1: TButtonPen;
    Label1: TLabel;
    Edit1: TEdit;
    UDSize: TUpDown;
    ButtonColor1: TButtonColor;
    CBAllowDrag: TCheckBox;
    CBResizeChart: TCheckBox;
    Label2: TLabel;
    CBCursor: TComboFlat;
    SpeedButton1: TSpeedButton;
    procedure FormShow(Sender: TObject);
    procedure Edit1Change(Sender: TObject);
    procedure CBAllowDragClick(Sender: TObject);
    procedure CBResizeChartClick(Sender: TObject);
    procedure CBCursorChange(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
  private
    { Private declarations }
    Selector : TSelectorTool;
  public
    { Public declarations }
  end;

implementation

{$IFNDEF LCL}
{$R *.DFM}
{$ELSE}
{$R *.lfm}
{$ENDIF}

uses
  TeeProCo, TeeMouseCursor;

{ TSelectorToolEditor }
procedure TSelectorToolEditor.FormShow(Sender: TObject);
begin
  Selector:=TSelectorTool(Tag);

  if Assigned(Selector) then
  with Selector do
  begin
    ButtonPen1.LinkPen(Pen);
    ButtonColor1.LinkProperty(Brush,'Color');
    UDSize.Position:=HandleSize;
    CBAllowDrag.Checked:=AllowDrag;
    CBResizeChart.Checked:=AllowResizeChart;

    TeeFillCursors(CBCursor,Cursor);
  end;
end;

procedure TSelectorToolEditor.Edit1Change(Sender: TObject);
begin
  if Showing and Assigned(Selector) then
     Selector.HandleSize:=UDSize.Position;
end;

procedure TSelectorToolEditor.CBAllowDragClick(Sender: TObject);
begin
  Selector.AllowDrag:=CBAllowDrag.Checked;
end;

procedure TSelectorToolEditor.CBResizeChartClick(Sender: TObject);
begin
  Selector.AllowResizeChart:=CBResizeChart.Checked;
end;

procedure TSelectorToolEditor.CBCursorChange(Sender: TObject);
begin
  with Selector do
       Cursor:=TeeSetCursor(Cursor,CBCursor.CurrentItem);
end;

procedure TSelectorToolEditor.SpeedButton1Click(Sender: TObject);
begin
  Selector.Cursor:=TMouseCursorEdit.Choose(Selector,Selector.Cursor);
end;

initialization
  RegisterClass(TSelectorToolEditor);
end.
