unit TeeRepaintMonitorEditor;
{$I TeeDefs.inc}

interface

uses
  {$IFDEF MSWINDOWS}
  Windows, Messages,
  {$ENDIF}
  SysUtils, Classes,
  Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, ComCtrls,
  TeeAnnToolEdit, TeCanvas, TeeTools;

type
  TRepaintMonitorEditor = class(TAnnotationToolEdit)
    TabMonitor: TTabSheet;
    Label1: TLabel;
    TBInterval: TTrackBar;
    LInterval: TLabel;
    RGMode: TRadioGroup;
    CBShowChart: TCheckBox;
    procedure CBShowChartClick(Sender: TObject);
    procedure RGModeClick(Sender: TObject);
    procedure TBIntervalChange(Sender: TObject);
    procedure FormShow(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }

    procedure SetLabelInterval;
  public
    { Public declarations }
  end;

implementation

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

procedure TRepaintMonitorEditor.CBShowChartClick(Sender: TObject);
begin
  (Tool as TRepaintMonitor).ShowChart:=CBShowChart.Checked;
end;

procedure TRepaintMonitorEditor.RGModeClick(Sender: TObject);
begin
  (Tool as TRepaintMonitor).Mode:=TRepaintMonitorMode(RGMode.ItemIndex);
end;

procedure TRepaintMonitorEditor.SetLabelInterval;
begin
  LInterval.Caption:=IntToStr(TBInterval.Position)+' msec';
end;

procedure TRepaintMonitorEditor.TBIntervalChange(Sender: TObject);
begin
  (Tool as TRepaintMonitor).Interval:=TBInterval.Position;
  SetLabelInterval;
end;

procedure TRepaintMonitorEditor.FormShow(Sender: TObject);
var tmp : TRepaintMonitor;
begin
  inherited;

  if Assigned(Tool) then
  begin
    tmp:=Tool as TRepaintMonitor;

    TBInterval.Position:=tmp.Interval;
    SetLabelInterval;

    RGMode.ItemIndex:=Ord(tmp.Mode);
    CBShowChart.Checked:=tmp.ShowChart;
  end;

  IMainTab:=TabMonitor;
end;

procedure TRepaintMonitorEditor.FormCreate(Sender: TObject);
begin
  inherited;
  HideTextTab:=True;
end;

initialization
  RegisterClass(TRepaintMonitorEditor);
end.
