{*********************************************}
{  TeeChart Charting Library for FireMonkey   }
{  Copyright (c) 2012-2020 by Steema Software }
{  All Rights Reserved                        }
{*********************************************}
unit FMXTee.Editor.Tools.DragMarks;
{$I TeeDefs.inc}

interface

uses
  System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
  FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMXTee.Editor.Tools.Series,
  {$IFNDEF UPTOXE3}
  FMX.StdCtrls,
  {$ENDIF}
  FMXTee.Procs, FMX.ListBox, FMXTee.Tools, FMXTee.Engine;

type
  TDragMarksToolEditor = class(TSeriesToolEditor)
    BResetPositions: TButton;
    procedure FormActivate(Sender: TObject);
    procedure BResetPositionsClick(Sender: TObject);
  private
    { Private declarations }
    DragMarks : TDragMarksTool;
  public
    { Public declarations }
  end;

implementation

{$R *.fmx}

procedure TDragMarksToolEditor.BResetPositionsClick(Sender: TObject);
var t : Integer;
begin
  if Assigned(DragMarks) and Assigned(DragMarks.Series) then
     DragMarks.Series.Marks.ResetPositions
  else
  if Assigned(DragMarks) then
    With DragMarks.ParentChart do
      for t:=0 to SeriesCount-1 do
        Series[t].Marks.ResetPositions;
end;

procedure TDragMarksToolEditor.FormActivate(Sender: TObject);
begin
  inherited;

  if not Assigned(DragMarks) then
    DragMarks:=TDragMarksTool(TagObject);
end;

initialization
  RegisterSeriesEditor(TDragMarksToolEditor);
end.
