📄 iplotcomponenteditor.pas
字号:
TiPlotComponentAccess = class(TiPlotComponent) end;
{$R *.dfm}
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.iComponentEditorFormCreate(Sender: TObject);
begin
FMaster := TiPlotMasterManager.Create(Self);
FMaster.OnChange := MasterChange;
FMaster.OnInsert := MasterInsert;
FMaster.OnRemove := MasterRemove;
iPlotLayoutViewer.Master := FMaster;
iPlotLayoutViewer.LayoutManager := FMaster.LayOutManager;
iOPCBrowserPanel.AddItem;
iOPCBrowserPanel.UpdateItemEdit;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.UpdateAll;
begin
UpdateToolBarEdit;
UpdateLegendEdit;
UpdateXAxesEdit;
UpdateYAxesEdit;
UpdateChannelEdit;
UpdateDataViewEdit;
UpdateDataCursorEdit;
UpdateLimitEdit;
UpdateLabelEdit;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.iComponentEditorFormDestroy(Sender: TObject);
begin
FMaster.Free;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.CreateThemeInstance;
begin
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.FormActivate(Sender: TObject);
var
MaxZoom : Double;
XZoom : Double;
YZoom : Double;
begin
PageControl.ActivePage := LayoutTabSheet;
XZoom := LayoutTabSheet.Width*0.95 / iComponent.Width;
YZoom := LayoutTabSheet.Height*0.95 / iComponent.Height;
if XZoom > YZoom then MaxZoom := YZoom else MaxZoom := XZoom;
iPlotLayoutViewer.Width := Round(iComponent.Width * MaxZoom);
iPlotLayoutViewer.Height := Round(iComponent.Height * MaxZoom);
iPlotLayoutViewer.Left := (LayoutTabSheet.Width - iPlotLayoutViewer.Width ) div 2;
iPlotLayoutViewer.Top := (LayoutTabSheet.Height - iPlotLayoutViewer.Height) div 2;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.ModifiedEvent(Sender: TObject);
begin
Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.MasterChange(Sender: TObject);
begin
iPlotLayoutViewer.Invalidate;
if not FTransferring then Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.MasterInsert(Sender: TObject);
begin
if Sender is TiPlotToolBar then ToolBarListBox.Items.AddObject ('',Sender);
if Sender is TiPlotLegend then LegendListBox.Items.AddObject ('',Sender);
if Sender is TiPlotTable then TableListBox.Items.AddObject ('',Sender);
if Sender is TiPlotXAxis then XAxisListBox.Items.AddObject ('',Sender);
if Sender is TiPlotYAxis then YAxisListBox.Items.AddObject ('',Sender);
if Sender is TiPlotDataView then DataViewListBox.Items.AddObject ('',Sender);
if Sender is TiPlotChannelCustom then ChannelListBox.Items.AddObject ('',Sender);
if Sender is TiPlotDataCursor then DataCursorListBox.Items.AddObject ('',Sender);
if Sender is TiPlotLimit then LimitListBox.Items.AddObject ('',Sender);
if Sender is TiPlotLabel then LabelListBox.Items.AddObject ('',Sender);
if Sender is TiPlotTranslationObject then TranslationListBox.Items.AddObject('',Sender);
Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.MasterRemove(Sender: TObject);
begin
if Sender is TiPlotToolBar then ToolBarListBox.DeleteObjectIndex(Sender);
if Sender is TiPlotLegend then LegendListBox.DeleteObjectIndex(Sender);
if Sender is TiPlotTable then TableListBox.DeleteObjectIndex(Sender);
if Sender is TiPlotXAxis then XAxisListBox.DeleteObjectIndex(Sender);
if Sender is TiPlotYAxis then YAxisListBox.DeleteObjectIndex(Sender);
if Sender is TiPlotDataView then DataViewListBox.DeleteObjectIndex(Sender);
if Sender is TiPlotChannelCustom then ChannelListBox.DeleteObjectIndex(Sender);
if Sender is TiPlotDataCursor then DataCursorListBox.DeleteObjectIndex(Sender);
if Sender is TiPlotLimit then LimitListBox.DeleteObjectIndex(Sender);
if Sender is TiPlotLabel then LabelListBox.DeleteObjectIndex(Sender);
if Sender is TiPlotTranslationObject then TranslationListBox.DeleteObjectIndex(Sender);
if not FTransferring then Modified := True;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.XAxisNameComboBoxDropDown(Sender: TObject);
var
x : Integer;
OldText : String;
begin
if not Assigned(FMaster.XAxisManager) then exit;
with Sender as TiComponentEditorComboBox do
begin
OldText := AsString;
Clear;
Items.Add('<None>');
for x := 0 to FMaster.XAxisManager.Count-1 do
Items.Add(FMaster.XAxisManager.Items[x].Name);
ItemIndex := Items.IndexOf(OldText);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.DataViewGridXAxisNameComboBoxDropDown(Sender: TObject);
var
x : Integer;
OldText : String;
begin
if not Assigned(FMaster.XAxisManager) then exit;
with Sender as TiComponentEditorComboBox do
begin
OldText := AsString;
Clear;
Items.Add('<None>');
for x := 0 to FMaster.XAxisManager.Count-1 do
Items.Add(FMaster.XAxisManager.Items[x].Name);
Items.Add('<All>');
ItemIndex := Items.IndexOf(OldText);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.YAxisNameComboBoxDropDown(Sender: TObject);
var
x : Integer;
OldText : String;
begin
if not Assigned(FMaster.YAxisManager) then exit;
with Sender as TiComponentEditorComboBox do
begin
OldText := AsString;
Clear;
Items.Add('<None>');
for x := 0 to FMaster.YAxisManager.Count-1 do
Items.Add(FMaster.YAxisManager.Items[x].Name);
ItemIndex := Items.IndexOf(OldText);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.DataViewGridYAxisNameComboBoxDropDown(Sender: TObject);
var
x : Integer;
OldText : String;
begin
if not Assigned(FMaster.YAxisManager) then exit;
with Sender as TiComponentEditorComboBox do
begin
OldText := AsString;
Clear;
Items.Add('<None>');
for x := 0 to FMaster.YAxisManager.Count-1 do
Items.Add(FMaster.YAxisManager.Items[x].Name);
Items.Add('<All>');
ItemIndex := Items.IndexOf(OldText);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.ChannelNameComboBoxDropDown(Sender: TObject);
var
x : Integer;
OldText : String;
begin
if not Assigned(FMaster.ChannelManager) then exit;
with Sender as TiComponentEditorComboBox do
begin
OldText := AsString;
Clear;
Items.Add('<None>');
for x := 0 to FMaster.ChannelManager.Count-1 do
Items.Add(FMaster.ChannelManager.Items[x].Name);
ItemIndex := Items.IndexOf(OldText);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.DataCursorChannelNameComboBoxDropDown(Sender: TObject);
var
x : Integer;
OldText : String;
begin
if not Assigned(FMaster.ChannelManager) then exit;
with Sender as TiComponentEditorComboBox do
begin
OldText := AsString;
Clear;
Items.Add(FMaster.TranslationManager.FindReplacement('<All>'));
for x := 0 to FMaster.ChannelManager.Count-1 do
Items.Add(FMaster.ChannelManager.Items[x].Name);
ItemIndex := Items.IndexOf(OldText);
end;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.ToolBarListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
DrawColorBox := False;
AText := (ToolBarListBox.Items.Objects[Index] as TiPlotToolBar).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.LegendListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
DrawColorBox := False;
AText := (LegendListBox.Items.Objects[Index] as TiPlotLegend).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.TableListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
DrawColorBox := False;
AText := (TableListBox.Items.Objects[Index] as TiPlotTable).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.XAxisListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
AColor := (XAxisListBox.Items.Objects[Index] as TiPlotXAxis).LabelsFont.Color;
AText := (XAxisListBox.Items.Objects[Index] as TiPlotXAxis).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.YAxisListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
AColor := (YAxisListBox.Items.Objects[Index] as TiPlotYAxis).LabelsFont.Color;
AText := (YAxisListBox.Items.Objects[Index] as TiPlotYAxis).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.DataViewListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
DrawColorBox := False;
AText := (DataViewListBox.Items.Objects[Index] as TiPlotDataView).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.ChannelListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
AColor := (ChannelListBox.Items.Objects[Index] as TiPlotChannelCustom).Color;
AText := (ChannelListBox.Items.Objects[Index] as TiPlotChannelCustom).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.DataCursorListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
AColor := (DataCursorListBox.Items.Objects[Index] as TiPlotDataCursor).Color;
AText := (DataCursorListBox.Items.Objects[Index] as TiPlotDataCursor).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.LimitListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
AColor := (LimitListBox.Items.Objects[Index] as TiPlotLimit).Color;
AText := (LimitListBox.Items.Objects[Index] as TiPlotLimit).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.LabelListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
DrawColorBox := False;
AText := (LabelListBox.Items.Objects[Index] as TiPlotLabel).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotComponentEditorForm.TranslationListBoxGetData(const Index: Integer; var DrawColorBox: Boolean; var AColor: TColor; var AText: String);
begin
DrawColorBox := False;
with (TranslationListBox.Items.Objects[Index] as TiPlotTranslationObject) do
AText := OriginalString + ' :
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -