{**********************************************}
{   TeeChart Knob Gauge style                  }
{   Copyright (c) 2011-2020 by Steema Software }
{**********************************************}
unit TeeKnobGaugeEditor;
{$I TeeDefs.inc}

interface

uses
  {$IFNDEF LINUX}
  Windows, Messages,
  {$ENDIF}
  SysUtils, Classes, Math,
  {$IFDEF D10}
  Types,
  {$ENDIF}

  Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, ComCtrls, Buttons,

  TeeCircularGauge, TeEngine, TeCanvas, TeeProcs, TeeEdiGrad, TeePenDlg,
  TeeCircularGaugeEditor, TeeKnobGauge;

type
  TKnobGaugeEditor = class(TCircularGaugeEditor)
    TabKnob: TTabSheet;
    PageControl4: TPageControl;
    TabSheet3: TTabSheet;
    TabHighlight: TTabSheet;
    CBAxisInside: TCheckBox;
    CBActiveCenter: TCheckBox;
    procedure FormShow(Sender: TObject);
    procedure CBAxisInsideClick(Sender: TObject);
    procedure CBActiveCenterClick(Sender: TObject);
    procedure PageControl4Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

implementation

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

uses
  Chart, TeeProCo, TeePoEdi, Series, TeeNumericGauge, TeeLinearGauge;

procedure TKnobGaugeEditor.FormShow(Sender: TObject);
begin
  inherited;

  if Gauge is TKnobGauge then
  with Gauge as TKnobGauge do
  begin
    //TabFrame.TabVisible:=False; //Do not allow editing frame page
    
    CBCircled.Visible:=False; //Do not allow changing this property

    CBActiveCenter.Checked:=ActiveCenter;
    CBAxisInside.Checked:=AxisInside;
  end;

  PageControl1.ActivePageIndex:=0;
end;

procedure TKnobGaugeEditor.CBAxisInsideClick(Sender: TObject);
begin
  (Gauge as TKnobGauge).AxisInside:=CBAxisInside.Checked;
end;

procedure TKnobGaugeEditor.CBActiveCenterClick(Sender: TObject);
begin
  (Gauge as TKnobGauge).ActiveCenter:=CBActiveCenter.Checked;
end;

procedure TKnobGaugeEditor.PageControl4Change(Sender: TObject);
begin
  inherited;

  if (PageControl4.ActivePage=TabHighlight) and (TabHighlight.ControlCount=0) then
     TTeeGradientEditor.InsertForm((Gauge as TKnobGauge).HighLight,TabHighlight);
end;

initialization
  RegisterClass(TKnobGaugeEditor);
end.
