{***********************************************}
{   TEquiVolumeSeries Component Editor Dialog   }
{   Copyright (c) 1996-2020 by Steema Software  }
{***********************************************}
unit TeeEquiVolEdi;
{$I TeeDefs.inc}

interface

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

  SysUtils, Classes,

  Graphics, Controls, Forms, Dialogs, StdCtrls, ComCtrls,
  TeCanvas, TeeProcs, TeeEdiGrad, TeeEquiVolume, TeePoEdi, TeeProco;

type
  TEquiVolumeEditor = class(TForm)
    BUpColor: TButtonColor;
    BDownColor: TButtonColor;
    Label2: TLabel;
    CBColorStyle: TComboFlat;
    LDepth: TLabel;
    EPGap: TEdit;
    UDPGap: TUpDown;
    procedure FormShow(Sender: TObject);
    procedure CBColorStyleChange(Sender: TObject);
    procedure EPGapChange(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    PointerForm      : TCustomForm;
    EquiVolume : TEquiVolumeSeries;
  public
    { Public declarations }
  end;

implementation

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

procedure TEquiVolumeEditor.FormShow(Sender: TObject);
begin
  EquiVolume:=TEquiVolumeSeries(Tag);
  if Assigned(EquiVolume) then
  begin
    BUpColor.LinkProperty(EquiVolume,'UpCloseColor'); // Do not localize
    BDownColor.LinkProperty(EquiVolume,'DownCloseColor'); // Do not localize

    case EquiVolume.BoxFillStyle of
      bfsFillToClose  : CBColorStyle.ItemIndex:=0;
      bfsOutline : CBColorStyle.ItemIndex:=1;
    end;

    UDPGap.Position := EquiVolume.PointGap;

    if Assigned(Parent) then
    begin
      if not Assigned(PointerForm) then
         PointerForm:=TeeInsertPointerForm(Parent,EquiVolume.VolumePointer,TeeMsg_EquiVolPoint);
    end;
  end;
end;

procedure TEquiVolumeEditor.CBColorStyleChange(Sender: TObject);
begin
  case CBColorStyle.ItemIndex of
    0: EquiVolume.BoxFillStyle:=bfsFillToClose;
    1: EquiVolume.BoxFillStyle:=bfsOutline;
  end;
  EquiVolume.Repaint;
end;

procedure TEquiVolumeEditor.EPGapChange(Sender: TObject);
begin
  if Showing then
  Begin
    EquiVolume.PointGap := UDPGap.Position;
    EquiVolume.RefreshSeries;
    EquiVolume.Repaint;
  end;
end;

procedure TEquiVolumeEditor.FormDestroy(Sender: TObject);
begin
  FreeAndNil(PointerForm);
end;

initialization
  RegisterClass(TEquiVolumeEditor);
end.
