TAChart: Rename TLine to TConstantLine to avoid confusion with TLineSeries

git-svn-id: trunk@24646 -
This commit is contained in:
ask 2010-04-16 06:03:41 +00:00
parent dfc1161da4
commit f19e3d4ca3
2 changed files with 23 additions and 17 deletions

View File

@ -211,14 +211,14 @@ type
end; end;
// 'TSerie' alias is for compatibility with older versions of TAChart. // 'TSerie' alias is for compatibility with older versions of TAChart.
// Do not use it. // Use TLineSeries instead.
TSerie = TLineSeries; TSerie = TLineSeries deprecated;
TLineStyle = (lsVertical, lsHorizontal); TLineStyle = (lsVertical, lsHorizontal);
{ TLine } { TConstantLine }
TLine = class(TCustomChartSeries) TConstantLine = class(TCustomChartSeries)
private private
FLineStyle: TLineStyle; FLineStyle: TLineStyle;
FPen: TPen; FPen: TPen;
@ -254,6 +254,10 @@ type
property ZPosition; property ZPosition;
end; end;
// 'TLine' alias is for compatibility with older versions of TAChart.
// Use TConstantLine instead.
TLine = class(TConstantLine) end deprecated;
TFuncCalculateEvent = procedure (const AX: Double; out AY: Double) of object; TFuncCalculateEvent = procedure (const AX: Double; out AY: Double) of object;
TFuncSeriesStep = 1..MaxInt; TFuncSeriesStep = 1..MaxInt;
@ -466,9 +470,9 @@ begin
UpdateParentChart; UpdateParentChart;
end; end;
{ TLine } { TConstantLine }
constructor TLine.Create(AOwner: TComponent); constructor TConstantLine.Create(AOwner: TComponent);
begin begin
inherited Create(AOwner); inherited Create(AOwner);
@ -478,13 +482,13 @@ begin
FUseBounds := true; FUseBounds := true;
end; end;
destructor TLine.Destroy; destructor TConstantLine.Destroy;
begin begin
FreeAndNil(FPen); FreeAndNil(FPen);
inherited; inherited;
end; end;
procedure TLine.Draw(ACanvas: TCanvas); procedure TConstantLine.Draw(ACanvas: TCanvas);
begin begin
ACanvas.Brush.Style := bsClear; ACanvas.Brush.Style := bsClear;
ACanvas.Pen.Assign(FPen); ACanvas.Pen.Assign(FPen);
@ -498,7 +502,7 @@ begin
end; end;
end; end;
procedure TLine.GetBounds(var ABounds: TDoubleRect); procedure TConstantLine.GetBounds(var ABounds: TDoubleRect);
begin begin
if not UseBounds then exit; if not UseBounds then exit;
case LineStyle of case LineStyle of
@ -513,42 +517,42 @@ begin
end; end;
end; end;
procedure TLine.GetLegendItems(AItems: TChartLegendItems); procedure TConstantLine.GetLegendItems(AItems: TChartLegendItems);
begin begin
AItems.Add(TLegendItemLine.Create(Pen, Title)); AItems.Add(TLegendItemLine.Create(Pen, Title));
end; end;
function TLine.GetSeriesColor: TColor; function TConstantLine.GetSeriesColor: TColor;
begin begin
Result := FPen.Color; Result := FPen.Color;
end; end;
procedure TLine.SetLineStyle(AValue: TLineStyle); procedure TConstantLine.SetLineStyle(AValue: TLineStyle);
begin begin
if FLineStyle = AValue then exit; if FLineStyle = AValue then exit;
FLineStyle := AValue; FLineStyle := AValue;
UpdateParentChart; UpdateParentChart;
end; end;
procedure TLine.SetPen(AValue: TPen); procedure TConstantLine.SetPen(AValue: TPen);
begin begin
FPen.Assign(AValue); FPen.Assign(AValue);
end; end;
procedure TLine.SetPos(AValue: Double); procedure TConstantLine.SetPos(AValue: Double);
begin begin
if FPosGraph = AValue then exit; if FPosGraph = AValue then exit;
FPosGraph := AValue; FPosGraph := AValue;
UpdateParentChart; UpdateParentChart;
end; end;
procedure TLine.SetSeriesColor(AValue: TColor); procedure TConstantLine.SetSeriesColor(AValue: TColor);
begin begin
if FPen.Color = AValue then exit; if FPen.Color = AValue then exit;
FPen.Color := AValue; FPen.Color := AValue;
end; end;
procedure TLine.SetUseBounds(AValue: Boolean); procedure TConstantLine.SetUseBounds(AValue: Boolean);
begin begin
if FUseBounds = AValue then exit; if FUseBounds = AValue then exit;
FUseBounds := AValue; FUseBounds := AValue;
@ -1232,7 +1236,8 @@ initialization
RegisterSeriesClass(TPieSeries, 'Pie series'); RegisterSeriesClass(TPieSeries, 'Pie series');
RegisterSeriesClass(TFuncSeries, 'Function series'); RegisterSeriesClass(TFuncSeries, 'Function series');
RegisterSeriesClass(TUserDrawnSeries, 'User-drawn series'); RegisterSeriesClass(TUserDrawnSeries, 'User-drawn series');
RegisterSeriesClass(TLine, 'Line'); RegisterSeriesClass(TConstantLine, 'Constant line');
{$WARNINGS OFF}RegisterSeriesClass(TLine, '');{$WARNINGS ON}
RegisterPropertyEditor( RegisterPropertyEditor(
TypeInfo(Boolean), TLineSeries, 'ShowLines', THiddenPropertyEditor); TypeInfo(Boolean), TLineSeries, 'ShowLines', THiddenPropertyEditor);

View File

@ -168,6 +168,7 @@ procedure TComponentListEditorForm.AddSubcomponentClass(
var var
mi: TMenuItem; mi: TMenuItem;
begin begin
if ACaption = '' then exit; // Empty names denote deprecated components.
mi := TMenuItem.Create(Self); mi := TMenuItem.Create(Self);
mi.OnClick := @miAddClick; mi.OnClick := @miAddClick;
mi.Caption := ACaption; mi.Caption := ACaption;