mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-06 04:57:12 +01:00
TAChart: Add TChartNavPanel.MiniMap property
git-svn-id: trunk@29936 -
This commit is contained in:
parent
934a785c7f
commit
06ed79f7db
@ -966,7 +966,7 @@ procedure TChart.PaintOnAuxCanvas(ACanvas: TCanvas; ARect: TRect);
|
|||||||
var
|
var
|
||||||
oldScale, oldOffset: TDoublePoint;
|
oldScale, oldOffset: TDoublePoint;
|
||||||
oldClipRect: TRect;
|
oldClipRect: TRect;
|
||||||
oldLogicalExtent: TDoubleRect;
|
oldLogicalExtent, oldPrevLogicalExtent: TDoubleRect;
|
||||||
oldIsZoomed: Boolean;
|
oldIsZoomed: Boolean;
|
||||||
begin
|
begin
|
||||||
// TODO: Group rendering params into a structure.
|
// TODO: Group rendering params into a structure.
|
||||||
@ -974,6 +974,7 @@ begin
|
|||||||
oldOffset := FOffset;
|
oldOffset := FOffset;
|
||||||
oldClipRect := FClipRect;
|
oldClipRect := FClipRect;
|
||||||
oldLogicalExtent := FLogicalExtent;
|
oldLogicalExtent := FLogicalExtent;
|
||||||
|
oldPrevLogicalExtent := FPrevLogicalExtent;
|
||||||
oldIsZoomed := FIsZoomed;
|
oldIsZoomed := FIsZoomed;
|
||||||
try
|
try
|
||||||
FIsZoomed := false;
|
FIsZoomed := false;
|
||||||
@ -983,6 +984,7 @@ begin
|
|||||||
FOffset := oldOffset;
|
FOffset := oldOffset;
|
||||||
FClipRect := oldClipRect;
|
FClipRect := oldClipRect;
|
||||||
FLogicalExtent := oldLogicalExtent;
|
FLogicalExtent := oldLogicalExtent;
|
||||||
|
FPrevLogicalExtent := oldPrevLogicalExtent;
|
||||||
FIsZoomed := oldIsZoomed;
|
FIsZoomed := oldIsZoomed;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|||||||
@ -89,27 +89,30 @@ type
|
|||||||
|
|
||||||
TChartNavPanel = class(TCustomControl)
|
TChartNavPanel = class(TCustomControl)
|
||||||
private
|
private
|
||||||
FChart: TChart;
|
|
||||||
FFullExtentPen: TPen;
|
|
||||||
FListener: TListener;
|
|
||||||
FLogicalExtentPen: TPen;
|
|
||||||
FProportional: Boolean;
|
|
||||||
procedure ChartExtentChanged(ASender: TObject);
|
|
||||||
procedure SetChart(AValue: TChart);
|
|
||||||
procedure SetFullExtentPen(AValue: TPen);
|
|
||||||
procedure SetLogicalExtentPen(AValue: TPen);
|
|
||||||
procedure SetProportional(AValue: Boolean);
|
|
||||||
private
|
|
||||||
FAllowDragNavigation: Boolean;
|
|
||||||
FDragCursor: TCursor;
|
|
||||||
FIsDragging: Boolean;
|
FIsDragging: Boolean;
|
||||||
FLogicalExtentRect: TRect;
|
FLogicalExtentRect: TRect;
|
||||||
FOffset: TDoublePoint;
|
FOffset: TDoublePoint;
|
||||||
FOldCursor: TCursor;
|
FOldCursor: TCursor;
|
||||||
FPrevPoint: TDoublePoint;
|
FPrevPoint: TDoublePoint;
|
||||||
FScale: TDoublePoint;
|
FScale: TDoublePoint;
|
||||||
|
FUpdateLocked: Boolean;
|
||||||
|
procedure ChartExtentChanged(ASender: TObject);
|
||||||
|
private
|
||||||
|
FAllowDragNavigation: Boolean;
|
||||||
|
FChart: TChart;
|
||||||
|
FDragCursor: TCursor;
|
||||||
|
FFullExtentPen: TPen;
|
||||||
|
FListener: TListener;
|
||||||
|
FLogicalExtentPen: TPen;
|
||||||
|
FMiniMap: Boolean;
|
||||||
|
FProportional: Boolean;
|
||||||
FShift: TShiftState;
|
FShift: TShiftState;
|
||||||
|
procedure SetChart(AValue: TChart);
|
||||||
procedure SetDragCursor(AValue: TCursor);
|
procedure SetDragCursor(AValue: TCursor);
|
||||||
|
procedure SetFullExtentPen(AValue: TPen);
|
||||||
|
procedure SetLogicalExtentPen(AValue: TPen);
|
||||||
|
procedure SetMiniMap(AValue: Boolean);
|
||||||
|
procedure SetProportional(AValue: Boolean);
|
||||||
protected
|
protected
|
||||||
procedure MouseDown(
|
procedure MouseDown(
|
||||||
AButton: TMouseButton; AShift: TShiftState; AX, AY: Integer); override;
|
AButton: TMouseButton; AShift: TShiftState; AX, AY: Integer); override;
|
||||||
@ -127,6 +130,7 @@ type
|
|||||||
property DragCursor: TCursor read FDragCursor write SetDragCursor default crSizeAll;
|
property DragCursor: TCursor read FDragCursor write SetDragCursor default crSizeAll;
|
||||||
property FullExtentPen: TPen read FFullExtentPen write SetFullExtentPen;
|
property FullExtentPen: TPen read FFullExtentPen write SetFullExtentPen;
|
||||||
property LogicalExtentPen: TPen read FLogicalExtentPen write SetLogicalExtentPen;
|
property LogicalExtentPen: TPen read FLogicalExtentPen write SetLogicalExtentPen;
|
||||||
|
property MiniMap: Boolean read FMiniMap write SetMiniMap default false;
|
||||||
property Proportional: Boolean read FProportional write SetProportional default false;
|
property Proportional: Boolean read FProportional write SetProportional default false;
|
||||||
property Shift: TShiftState read FShift write FShift default [ssLeft];
|
property Shift: TShiftState read FShift write FShift default [ssLeft];
|
||||||
published
|
published
|
||||||
@ -244,7 +248,8 @@ end;
|
|||||||
procedure TChartNavPanel.ChartExtentChanged(ASender: TObject);
|
procedure TChartNavPanel.ChartExtentChanged(ASender: TObject);
|
||||||
begin
|
begin
|
||||||
Unused(ASender);
|
Unused(ASender);
|
||||||
Invalidate;
|
if not FUpdateLocked then
|
||||||
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TChartNavPanel.Create(AOwner: TComponent);
|
constructor TChartNavPanel.Create(AOwner: TComponent);
|
||||||
@ -351,9 +356,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
FOffset -= ext.a * FScale;
|
FOffset -= ext.a * FScale;
|
||||||
|
|
||||||
Canvas.Brush.Color := Chart.BackColor;
|
if MiniMap then begin
|
||||||
Canvas.Brush.Style := bsSolid;
|
FUpdateLocked := true;
|
||||||
Canvas.FillRect(ClientRect);
|
try
|
||||||
|
Chart.PaintOnAuxCanvas(Canvas, Rect(0, 0, Width, Height));
|
||||||
|
finally
|
||||||
|
FUpdateLocked := false;
|
||||||
|
end;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
Canvas.Brush.Color := Chart.BackColor;
|
||||||
|
Canvas.Brush.Style := bsSolid;
|
||||||
|
Canvas.FillRect(ClientRect);
|
||||||
|
end;
|
||||||
Canvas.Brush.Style := bsClear;
|
Canvas.Brush.Style := bsClear;
|
||||||
Canvas.Pen := FullExtentPen;
|
Canvas.Pen := FullExtentPen;
|
||||||
DrawRect(fe);
|
DrawRect(fe);
|
||||||
@ -395,6 +410,13 @@ begin
|
|||||||
Invalidate;
|
Invalidate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TChartNavPanel.SetMiniMap(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if FMiniMap = AValue then exit;
|
||||||
|
FMiniMap := AValue;
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TChartNavPanel.SetProportional(AValue: Boolean);
|
procedure TChartNavPanel.SetProportional(AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if FProportional = AValue then exit;
|
if FProportional = AValue then exit;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user