⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iploteditor.pas

📁 iocopm3.04源码,一套很好的工控开发工具
💻 PAS
📖 第 1 页 / 共 5 页
字号:
begin
  if Assigned((PlotComponent as TiPlotComponent).OnAfterCloseEditor) then (PlotComponent as TiPlotComponent).OnAfterCloseEditor(Self);
  inherited;
end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.iCustomEditorFormClose(Sender: TObject; var Action: TCloseAction);
begin
  FIsClosing := True;
end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.UpdateAll;
begin
  UpdateToolBarEdit;
  UpdateLegendEdit;
  UpdateXAxesEdit;
  UpdateYAxesEdit;
  UpdateChannelEdit;
  UpdateDataViewEdit;
  UpdateDataCursorEdit;
  UpdateLimitEdit;
  UpdateLabelEdit;
  UpdateTableEdit;
end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.XAxisNameComboBoxDropDown(Sender: TObject);
var
  x : Integer;
  OldText : String;
begin
  if not Assigned(Master.XAxisManager) then exit;
  with Sender as TiComponentEditorComboBox do
    begin
      OldText := AsString;
      Clear;
      Items.Add(Master.TranslationManager.FindReplacement('<None>'));
      for x := 0 to Master.XAxisManager.Count-1 do
        Items.Add(Master.XAxisManager.Items[x].Name);
      ItemIndex := Items.IndexOf(OldText);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.DataViewGridXAxisNameComboBoxDropDown(Sender: TObject);
var
  x : Integer;
  OldText : String;
begin
  if not Assigned(Master.XAxisManager) then exit;
  with Sender as TiComponentEditorComboBox do
    begin
      OldText := AsString;
      Clear;
      Items.Add(Master.TranslationManager.FindReplacement('<None>'));
      for x := 0 to Master.XAxisManager.Count-1 do
        Items.Add(Master.XAxisManager.Items[x].Name);
      Items.Add(Master.TranslationManager.FindReplacement('<All>'));
      ItemIndex := Items.IndexOf(OldText);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.YAxisNameComboBoxDropDown(Sender: TObject);
var
  x       : Integer;
  OldText : String;
begin
  if not Assigned(Master.YAxisManager) then exit;
  with Sender as TiComponentEditorComboBox do
    begin
      OldText := AsString;
      Clear;
      Items.Add(Master.TranslationManager.FindReplacement('<None>'));
      for x := 0 to Master.YAxisManager.Count-1 do
        Items.Add(Master.YAxisManager.Items[x].Name);
      ItemIndex := Items.IndexOf(OldText);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.DataViewGridYAxisNameComboBoxDropDown(Sender: TObject);
var
  x       : Integer;
  OldText : String;
begin
  if not Assigned(Master.YAxisManager) then exit;
  with Sender as TiComponentEditorComboBox do
    begin
      OldText := AsString;
      Clear;
      Items.Add(Master.TranslationManager.FindReplacement('<None>'));
      for x := 0 to Master.YAxisManager.Count-1 do
        Items.Add(Master.YAxisManager.Items[x].Name);
      Items.Add(Master.TranslationManager.FindReplacement('<All>'));
      ItemIndex := Items.IndexOf(OldText);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.ChannelNameComboBoxDropDown(Sender: TObject);
var
  x       : Integer;
  OldText : String;
begin
  if not Assigned(Master.ChannelManager) then exit;
  with Sender as TiComponentEditorComboBox do
    begin
      OldText := AsString;
      Clear;
      Items.Add(Master.TranslationManager.FindReplacement('<None>'));
      for x := 0 to Master.ChannelManager.Count-1 do
        Items.Add(Master.ChannelManager.Items[x].Name);
      ItemIndex := Items.IndexOf(OldText);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.DataCursorChannelNameComboBoxDropDown(Sender: TObject);
var
  x       : Integer;
  OldText : String;
begin
  if not Assigned(Master.ChannelManager) then exit;
  with Sender as TiComponentEditorComboBox do
    begin
      OldText := AsString;
      Clear;
      Items.Add(Master.TranslationManager.FindReplacement('<All>'));
      for x := 0 to Master.ChannelManager.Count-1 do
        Items.Add(Master.ChannelManager.Items[x].Name);
      ItemIndex := Items.IndexOf(OldText);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.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 TiPlotEditorForm.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 TiPlotEditorForm.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 TiPlotEditorForm.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 TiPlotEditorForm.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 TiPlotEditorForm.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 TiPlotEditorForm.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 TiPlotEditorForm.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 TiPlotEditorForm.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 TiPlotEditorForm.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 TiPlotEditorForm.LegendListBoxClick    (Sender: TObject);begin UpdateLegendEdit;                       end;
procedure TiPlotEditorForm.YAxisListBoxClick     (Sender: TObject);begin UpdateYAxesEdit;                        end;
procedure TiPlotEditorForm.XAxisListBoxClick     (Sender: TObject);begin UpdateXAxesEdit;                        end;
procedure TiPlotEditorForm.ChannelListBoxClick   (Sender: TObject);begin UpdateChannelEdit;   ChannelStatsClear; end;
procedure TiPlotEditorForm.DataViewListBoxClick  (Sender: TObject);begin UpdateDataViewEdit;                     end;
procedure TiPlotEditorForm.ToolBarListBoxClick   (Sender: TObject);begin UpdateToolBarEdit;                      end;
procedure TiPlotEditorForm.DataCursorListBoxClick(Sender: TObject);begin UpdateDataCursorEdit;                   end;
procedure TiPlotEditorForm.LimitListBoxClick     (Sender: TObject);begin UpdateLimitEdit;                        end;
procedure TiPlotEditorForm.LabelListBoxClick     (Sender: TObject);begin UpdateLabelEdit;                        end;
procedure TiPlotEditorForm.TableListBoxClick     (Sender: TObject);begin UpdateTableEdit;                        end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.XAxesAddButtonClick      (Sender:TObject);begin Master.AddXAxis;     XAxisListBox.SelectLast;     UpdateXAxesEdit;                       end;
procedure TiPlotEditorForm.YAxesAddButtonClick      (Sender:TObject);begin Master.AddYAxis;     YAxisListBox.SelectLast;     UpdateYAxesEdit;                       end;
procedure TiPlotEditorForm.iChannelAddButtonClick   (Sender:TObject);begin Master.AddChannel;   ChannelListBox.SelectLast;   UpdateChannelEdit;   ChannelStatsClear;end;
procedure TiPlotEditorForm.iDataCursorAddButtonClick(Sender:TObject);begin Master.AddDataCursor;DataCursorListBox.SelectLast;UpdateDataCursorEdit;                  end;
procedure TiPlotEditorForm.iLimitAddButtonClick     (Sender:TObject);begin Master.AddLimit;     LimitListBox.SelectLast;     UpdateLimitEdit;                       end;
procedure TiPlotEditorForm.iLabelAddButtonClick     (Sender:TObject);begin Master.AddLabel;     LabelListBox.SelectLast;     UpdateLabelEdit;                       end;
procedure TiPlotEditorForm.iTableAddButtonClick     (Sender:TObject);begin Master.AddTable;     TableListBox.SelectLast;     UpdateTableEdit;                       end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.XAxisRemoveButtonClick     (Sender:TObject);begin XAxisListBox.DeleteSelectedObject;     UpdateChannelEdit;UpdateXAxesEdit;  end;
procedure TiPlotEditorForm.YAxisRemoveButtonClick     (Sender:TObject);begin YAxisListBox.DeleteSelectedObject;     UpdateChannelEdit;UpdateYAxesEdit;  end;
procedure TiPlotEditorForm.ChannelRemoveButtonClick   (Sender:TObject);begin ChannelListBox.DeleteSelectedObject;   UpdateChannelEdit;ChannelStatsClear;end;
procedure TiPlotEditorForm.DataCursorRemoveButtonClick(Sender:TObject);begin DataCursorListBox.DeleteSelectedObject;UpdateDataCursorEdit;               end;
procedure TiPlotEditorForm.LimitRemoveButtonClick     (Sender:TObject);begin LimitListBox.DeleteSelectedObject;     UpdateLimitEdit;                    end;
procedure TiPlotEditorForm.LabelRemoveButtonClick     (Sender:TObject);begin LabelListBox.DeleteSelectedObject;     UpdateLabelEdit;                    end;
procedure TiPlotEditorForm.TableRemoveButtonClick     (Sender:TObject);begin TableListBox.DeleteSelectedObject;     UpdateTableEdit;                    end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.UpdateToolBarEdit;
var
  iToolBar : TiPlotToolBar;
begin
  if ToolBarListBox.ItemIndex = - 1 then DisableAllEditControlsStartingWith('ToolBar')
    else
      begin
        EnableAllEditControlsStartingWith('ToolBar');

        iToolBar := ToolBarListBox.Items.Objects[ToolBarListBox.ItemIndex] as TiPlotToolBar;

        ToolBarNameEdit.AsString                      := iToolBar.Name;
        ToolBarVisibleCheckbox.AsBoolean              := iToolBar.Visible;
        ToolBarEnabledCheckBox.AsBoolean              := iToolBar.Enabled;
        ToolBarPopupEnabledCheckBox.AsBoolean         := iToolBar.PopupEnabled;
        ToolBarFlatBorderCheckBox.AsBoolean           := iToolBar.FlatBorder;
        ToolBarFlatButtonsCheckBox.AsBoolean          := iToolBar.FlatButtons;
        ToolBarSmallButtonsCheckBox.AsBoolean         := iToolBar.SmallButtons;

        ToolBarShowResumeButtonCheckBox.AsBoolean     := iToolBar.ShowResumeButton;
        ToolBarShowPauseButtonCheckBox.AsBoolean      := iToolBar.ShowPauseButton;
        ToolBarShowAxesModeButtonsCheckBox.AsBoolean  := iToolBar.ShowAxesModeButtons;
        ToolBarShowZoomInOutButtonsCheckBox.AsBoolean := iToolBar.ShowZoomInOutButtons;
        ToolBarShowSelectButtonCheckBox.AsBoolean     := iToolBar.ShowSelectButton;
        ToolBarShowZoomBoxButtonCheckBox.AsBoolean    := iToolBar.ShowZoomBoxButton;
        ToolBarShowCursorButtonCheckBox.AsBoolean     := iToolBar.ShowCursorButton;

        ToolBarShowEditButtonCheckBox.AsBoolean       := iToolBar.ShowEditButton;
        ToolBarShowCopyButtonCheckBox.AsBoolean       := iToolBar.ShowCopyButton;
        ToolBarShowSaveButtonCheckBox.AsBoolean       := iToolBar.ShowSaveButton;
        ToolBarShowPrintButtonCheckBox.AsBoolean      := iToolBar.ShowPrintButton;
        ToolBarShowPreviewButtonCheckBox.AsBoolean    := iToolBar.ShowPreviewButton;

        ToolBarZoomInOutFactorEdit.AsFloat            := iToolBar.ZoomInOutFactor;

        ToolBarListBox.Invalidate;
      end;
end;
//****************************************************************************************************************************************************
procedure TiPlotEditorForm.UpdateLegendEdit;
var
  iLegend : TiPlotLegend;
begin
  if LegendListBox.ItemIndex = - 1 then DisableAllEditControlsStartingWith('Legend')
    else
      begin
        EnableAllEditControlsStartingWith('Legend');

        iLegend := LegendListBox.Items.Objects[LegendListBox.ItemIndex] as TiPlotLegend;

        LegendNameEdit.AsString                         := iLegend.Name;
        LegendVisibleCheckbox.AsBoolean                 := iLegend.Visible;
        L

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -