📄 qiplottoolbar.pas
字号:
FImageList.Clear;
FImageList.Height := 24;
FImageList.Width := 24;
for x := 0 to FButtonList.Count-1 do
(FButtonList.Objects[x] as TiPlotToolBarButton).ImageIndex := -1;
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.SetupSmallImages;
var
x : Integer;
begin
FResumeButton.ImageName := 'SMALLAUTO';
FPauseButton.ImageName := 'SMALLPAUSE';
FAxesModeScrollButton.ImageName := 'SMALLSCROLL';
FAxesModeZoomButton.ImageName := 'SMALLZOOM';
FZoomOutButton.ImageName := 'SMALLZOOMOUT';
FZoomInButton.ImageName := 'SMALLZOOMIN';
FSelectButton.ImageName := 'SMALLSELECT';
FZoomBoxButton.ImageName := 'SMALLSCROLLBOX';
FCursorButton.ImageName := 'SMALLCURSOR';
FEditButton.ImageName := 'SMALLPROPERTIES';
FCopyButton.ImageName := 'SMALLCOPY';
FSaveButton.ImageName := 'SMALLSAVE';
FPrintButton.ImageName := 'SMALLPRINTER';
FPreviewButton.ImageName := 'SMALLPREVIEW';
FImageList.Clear;
FImageList.Height := 16;
FImageList.Width := 16;
for x := 0 to FButtonList.Count-1 do
(FButtonList.Objects[x] as TiPlotToolBarButton).ImageIndex := -1;
end;
//****************************************************************************************************************************************************
function TiPlotToolBar.CreateButton(OnClick : TNotifyEvent; ImageIndex, GroupIndex : Integer; GlphyName, Hint: String) : TiPlotToolBarButton;
begin
Result := TiPlotToolBarButton.Create(Owner, nil, nil, nil, nil);
Result.ToolBar := Self;
Result.OnInvalidate := ButtonInvalidate;
Result.OnClick := OnClick;
Result.OnGroupClick := GroupClick;
Result.OnChange := OnChange;
Result.Hint := Hint;
Result.Style := iptbbsButton;
Result.GroupIndex := GroupIndex;
Result.Visible := True;
Result.ImageList := FImageList;
Result.ImageIndex := -1;
Result.ImageName := GlphyName;
FButtonList.AddObject('', Result);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.SetZoomInOutFactor(const Value: Double);
var
TempValue : Double;
begin
TempValue := Value;
if TempValue < 1 then TempValue := 1;
if FZoomInOutFactor <> TempValue then
begin
FZoomInOutFactor := TempValue;
TriggerChange(Self);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.AddMenuItems(PopupMenu: TPopUpMenu);
begin
inherited AddMenuItems(PopupMenu);
AddEditMenuItems(PopupMenu);
end;
//****************************************************************************************************************************************************
function TiPlotToolBar.GetMouseObject(X, Y: Integer): TiPlotObject;
var
iButton : TiPlotToolBarButton;
i : Integer;
begin
Result := inherited GetMouseObject(X, Y);
for i := 0 to FButtonList.Count-1 do
begin
iButton := FButtonList.Objects[i] as TiPlotToolBarButton;
if not iButton.Visible then Continue;
if PtInRect(iButton.DrawRect, Point(X, Y)) then
begin
Result := iButton;
Break;
end;
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.SetShowCopyButton (const Value:Boolean);begin FCopyButton.Visible :=Value; end;
procedure TiPlotToolBar.SetShowPrintButton (const Value:Boolean);begin FPrintButton.Visible :=Value; end;
procedure TiPlotToolBar.SetShowPreviewButton (const Value:Boolean);begin FPreviewButton.Visible :=Value; end;
procedure TiPlotToolBar.SetShowSaveButton (const Value:Boolean);begin FSaveButton.Visible :=Value; end;
procedure TiPlotToolBar.SetShowEditButton (const Value:Boolean);begin FEditButton.Visible :=Value; end;
procedure TiPlotToolBar.SetShowAxesModeButtons (const Value:Boolean);begin FAxesModeScrollButton.Visible:=Value;FAxesModeZoomButton.Visible:=Value;end;
procedure TiPlotToolBar.SetShowZoomInOutButtons(const Value:Boolean);begin FZoomInButton.Visible :=Value;FZoomOutButton.Visible :=Value;end;
procedure TiPlotToolBar.SetShowZoomBoxButton (const Value:Boolean);begin FZoomBoxButton.Visible :=Value; end;
procedure TiPlotToolBar.SetShowCursorButton (const Value:Boolean);begin FCursorButton.Visible :=Value; end;
procedure TiPlotToolBar.SetShowPauseButton (const Value:Boolean);begin FPauseButton.Visible :=Value; end;
procedure TiPlotToolBar.SetShowResumeButton (const Value:Boolean);begin FResumeButton.Visible :=Value; end;
procedure TiPlotToolBar.SetShowSelectButton (const Value:Boolean);begin FSelectButton.Visible :=Value; end;
//****************************************************************************************************************************************************
function TiPlotToolBar.GetShowCopyButton : Boolean;begin Result := FCopyButton.Visible; end;
function TiPlotToolBar.GetShowPrintButton : Boolean;begin Result := FPrintButton.Visible; end;
function TiPlotToolBar.GetShowPreviewButton : Boolean;begin Result := FPreviewButton.Visible; end;
function TiPlotToolBar.GetShowSaveButton : Boolean;begin Result := FSaveButton.Visible; end;
function TiPlotToolBar.GetShowEditButton : Boolean;begin Result := FEditButton.Visible; end;
function TiPlotToolBar.GetShowAxesModeButtons : Boolean;begin Result := FAxesModeScrollButton.Visible;end;
function TiPlotToolBar.GetShowCursorButton : Boolean;begin Result := FCursorButton.Visible; end;
function TiPlotToolBar.GetShowPauseButton : Boolean;begin Result := FPauseButton.Visible; end;
function TiPlotToolBar.GetShowResumeButton : Boolean;begin Result := FResumeButton.Visible; end;
function TiPlotToolBar.GetShowZoomBoxButton : Boolean;begin Result := FZoomBoxButton.Visible; end;
function TiPlotToolBar.GetShowZoomInOutButtons : Boolean;begin Result := FZoomInButton.Visible; end;
function TiPlotToolBar.GetShowSelectButton : Boolean;begin Result := FSelectButton.Visible; end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.SetFlatBorder(const Value: Boolean);begin SetBooleanProperty(Value, FFlatBorder, TriggerChange);end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.SetFlatButtons(const Value: Boolean);
var
x : Integer;
begin
if FFlatButtons <> Value then
begin
FFlatButtons := Value;
for x := 0 to FButtonList.Count-1 do
(FButtonList.Objects[x] as TiPlotToolBarButton).Flat := Value;
TriggerChange(Self);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.ResumeClick(Sender: TObject);
var
x : Integer;
begin
with TiPlotComponentAccess(Owner) do
begin
if CursorActive then DoButtonClickCursor;
if SelectActive then DoButtonClickSelect;
for x := 0 to ObjectManager.Count-1 do
ObjectManager.Items[x].UserSelected := False;
EnableAllTracking;
end;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtResume);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.PauseClick(Sender: TObject);
begin
TiPlotComponentAccess(Owner).DisableAllTracking;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtPause);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.ZoomInClick(Sender: TObject);
var
x : Integer;
begin
DoButtonClickPause;
with TiPlotComponentAccess(Owner) do
begin
for x := 0 to XAxisCount-1 do
case XAxis[x].ScaleType of
ipstLinear : XAxis[x].Zoom(1/ZoomInOutFactor);
ipstLog10 : XAxis[x].Zoom(-1);
end;
for x := 0 to YAxisCount-1 do
case YAxis[x].ScaleType of
ipstLinear : YAxis[x].Zoom(1/ZoomInOutFactor);
ipstLog10 : YAxis[x].Zoom(-1);
end;
end;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtZoomIn);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.ZoomOutClick(Sender: TObject);
var
x : Integer;
begin
DoButtonClickPause;
with TiPlotComponentAccess(Owner) do
begin
for x := 0 to XAxisCount-1 do
case XAxis[x].ScaleType of
ipstLinear : XAxis[x].Zoom(ZoomInOutFactor);
ipstLog10 : XAxis[x].Zoom(1);
end;
for x := 0 to YAxisCount-1 do
case YAxis[x].ScaleType of
ipstLinear : YAxis[x].Zoom(ZoomInOutFactor);
ipstLog10 : YAxis[x].Zoom(1);
end;
end;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtZoomOut);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.EditClick(Sender: TObject);
begin
TiPlotComponentAccess(Owner).Master.EditProperties;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtEdit);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.CopyClick(Sender: TObject);
begin
TiPlotComponentAccess(Owner).CopyToClipBoard;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtCopy);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.SaveClick(Sender: TObject);
begin
TiPlotComponentAccess(Owner).Save;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtSave);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.PrintClick(Sender: TObject);
begin
TiPlotComponentAccess(Owner).PrintChart;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtPrint);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.PreviewClick(Sender: TObject);
begin
TiPlotComponentAccess(Owner).PreviewChart;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtPreview);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.AxesModeScrollClick(Sender: TObject);
var
x : Integer;
begin
FAxesModeScrollButton.Down := True;
FAxesModeZoomButton.Down := False;
with TiPlotComponentAccess(Owner) do
begin
for x := 0 to XAxisCount-1 do
XAxis[x].Mode := ipamScroll;
for x := 0 to YAxisCount-1 do
YAxis[x].Mode := ipamScroll;
end;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtScrollAxesMode);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.AxesModeZoomClick(Sender: TObject);
var
x : Integer;
begin
FAxesModeZoomButton.Down := True;
FAxesModeScrollButton.Down := False;
with TiPlotComponentAccess(Owner) do
begin
for x := 0 to XAxisCount-1 do
XAxis[x].Mode := ipamZoom;
for x := 0 to YAxisCount-1 do
YAxis[x].Mode := ipamZoom;
end;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtZoomAxesMode);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.SelectClick(Sender: TObject);
begin
FSelectButton.Down := not FSelectButton.Down;
FZoomBoxButton.Down := False;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtSelect);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.CursorClick(Sender: TObject);
begin
FCursorButton.Down := not FCursorButton.Down;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtCursor);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.ZoomBoxClick(Sender: TObject);
begin
FSelectButton.Down := False;
FZoomBoxButton.Down := not FZoomBoxButton.Down;
TiPlotComponentAccess(Owner as TiPlotComponent).DoToolBarButtonClick(Self, iptbbtZoomBox);
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.ZoomBoxDownChange(Sender: TObject);
//var
// DataViewMode : TiPlotDataViewMode;
// x : Integer;
begin
with TiPlotComponentAccess(Owner) do
begin
// if ZoomBoxActive then DataViewMode := ipdvmZoomBox else DataViewMode := ipdvmNone;
// Tri
// for x := 0 to DataViewCount-1 do
// TiPlotDataViewAccess(DataView[x]).Mode := DataViewMode;
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotToolBar.CursorDownChange(Sender: TObject);
var
x : Integer;
begin
with TiPlotComponentAccess(Owner) do
begin
if CursorActive then
begin
for x := 0 to DataCursorCount-1 do
DataCursor[x].Visible := True;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -