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

📄 iplotmastermanager.pas

📁 iocopm3.04源码,一套很好的工控开发工具
💻 PAS
📖 第 1 页 / 共 4 页
字号:
procedure TiPlotMasterManager.NotificationInsert(Sender: TObject);
begin
  if Sender is TiPlotObject then
    begin
      if Assigned(FPlotObjectManager) then if Sender is TiPlotObject        then FPlotObjectManager.NotificationInsert(Sender);
      if Assigned(FLayoutManager    ) then if Sender is TiPlotLayoutObject  then FLayoutManager.NotificationInsert(Sender);

      if Assigned(FToolBarManager   ) then if Sender is TiPlotToolBar       then FToolBarManager.NotificationInsert(Sender);
      if Assigned(FLegendManager    ) then if Sender is TiPlotLegend        then FLegendManager.NotificationInsert(Sender);
      if Assigned(FTableManager     ) then if Sender is TiPlotTable         then FTableManager.NotificationInsert(Sender);
      if Assigned(FXAxisManager     ) then if Sender is TiPlotXAxis         then FXAxisManager.NotificationInsert(Sender);
      if Assigned(FYAxisManager     ) then if Sender is TiPlotYAxis         then FYAxisManager.NotificationInsert(Sender);
      if Assigned(FChannelManager   ) then if Sender is TiPlotChannelCustom then FChannelManager.NotificationInsert(Sender);
      if Assigned(FDataViewManager  ) then if Sender is TiPlotDataView      then FDataViewManager.NotificationInsert(Sender);
      if Assigned(FDataCursorManager) then if Sender is TiPlotDataCursor    then FDataCursorManager.NotificationInsert(Sender);
      if Assigned(FLimitManager     ) then if Sender is TiPlotLimit         then FLimitManager.NotificationInsert(Sender);
      if Assigned(FLabelManager     ) then if Sender is TiPlotLabel         then FLabelManager.NotificationInsert(Sender);
      if Assigned(FAnnotationManager) then if Sender is TiPlotAnnotation    then FAnnotationManager.NotificationInsert(Sender);

      if Sender is TiPlotObject then
        begin
          TiPlotObjectAccess(Sender as TiPlotObject).OnSetFocus      := NotificationSetFocus;
          TiPlotObjectAccess(Sender as TiPlotObject).OnInvalidateNow := FOnInvalidateNow;
          TiPlotObjectAccess(Sender as TiPlotObject).UserCanEdit     := FUserCanEditObjects;
          TiPlotObjectAccess(Sender as TiPlotObject).OnEdit          := EditLayoutObject;
          TiPlotObjectAccess(Sender as TiPlotObject).XYAxesReversed  := FXYAxesReverse;
        end;

      if Assigned(FEditorForm) then if not (FEditorForm as TiPlotEditorForm).IsClosing then
        with FEditorForm as TiPlotEditorForm do
          begin
            if Sender is TiPlotToolBar then
              begin
                ToolBarListBox.Items.AddObject ('',Sender);
                ToolBarListBox.ItemIndex := ToolBarListBox.Items.Count-1;
                UpdateToolBarEdit;
              end
            else if Sender is TiPlotLegend then
              begin
                LegendListBox.Items.AddObject ('',Sender);
                LegendListBox.ItemIndex := LegendListBox.Items.Count-1;
                UpdateLegendEdit;
              end
            else if Sender is TiPlotTable then
              begin
                TableListBox.Items.AddObject ('',Sender);
                TableListBox.ItemIndex := TableListBox.Items.Count-1;
                UpdateTableEdit;
              end
            else if Sender is TiPlotXAxis   then
              begin
                XAxisListBox.Items.AddObject  ('',Sender);
                XAxisListBox.ItemIndex := XAxisListBox.Items.Count-1;
                UpdateXAxesEdit;
              end
            else if Sender is TiPlotYAxis   then
              begin
                YAxisListBox.Items.AddObject  ('',Sender);
                YAxisListBox.ItemIndex := YAxisListBox.Items.Count-1;
                UpdateYAxesEdit;
              end
            else if Sender is TiPlotDataView then
              begin
                DataViewListBox.Items.AddObject('',Sender);
                DataViewListBox.ItemIndex := DataViewListBox.Items.Count-1;
                UpdateDataViewEdit;
              end
            else if Sender is TiPlotChannelCustom then
              begin
                ChannelListBox.Items.AddObject('',Sender);
                ChannelListBox.ItemIndex := ChannelListBox.Items.Count-1;
                UpdateChannelEdit;
              end
            else if Sender is TiPlotDataCursor then
              begin
                DataCursorListBox.Items.AddObject('',Sender);
                DataCursorListBox.ItemIndex := DataCursorListBox.Items.Count-1;
                UpdateDataCursorEdit;
              end
            else if Sender is TiPlotLimit then
              begin
                LimitListBox.Items.AddObject('',Sender);
                LimitListBox.ItemIndex := LimitListBox.Items.Count-1;
                UpdateLimitEdit;
              end
            else if Sender is TiPlotLabel then
              begin
                LabelListBox.Items.AddObject('',Sender);
                LabelListBox.ItemIndex := LabelListBox.Items.Count-1;
                UpdateLabelEdit;
              end
          end;
    end
  else if Sender is TiPlotTranslationObject  then FTranslationManager.NotificationInsert(Sender)
  else if Sender is TiPlotObjectManager      then FPlotObjectManager  := Sender as TiPlotObjectManager
  else if Sender is TiPlotToolBarManager     then FToolBarManager     := Sender as TiPlotToolBarManager
  else if Sender is TiPlotLegendManager      then FLegendManager      := Sender as TiPlotLegendManager
  else if Sender is TiPlotTableManager       then FTableManager       := Sender as TiPlotTableManager
  else if Sender is TiPlotXAxisManager       then FXAxisManager       := Sender as TiPlotXAxisManager
  else if Sender is TiPlotYAxisManager       then FYAxisManager       := Sender as TiPlotYAxisManager
  else if Sender is TiPlotChannelManager     then FChannelManager     := Sender as TiPlotChannelManager
  else if Sender is TiPlotDataViewManager    then FDataViewManager    := Sender as TiPlotDataViewManager
  else if Sender is TiPlotDataCursorManager  then FDataCursorManager  := Sender as TiPlotDataCursorManager
  else if Sender is TiPlotLimitManager       then FLimitManager       := Sender as TiPlotLimitManager
  else if Sender is TiPlotLabelManager       then FLabelManager       := Sender as TiPlotLabelManager
  else if Sender is TiPlotAnnotationManager  then FAnnotationManager  := Sender as TiPlotAnnotationManager
  else if Sender is TiPlotLayoutManager      then FLayoutManager      := Sender as TiPlotLayoutManager
  else if Sender is TiPlotTranslationManager then FTranslationManager := Sender as TiPlotTranslationManager;

  if Assigned(FOnInsert) then FOnInsert(Sender);
end;
//*************************************************************************************************************************************
procedure TiPlotMasterManager.NotificationRemove(Sender: TObject);
begin
  if Assigned(FOnRemove) then FOnRemove(Sender);

  if Assigned(FTranslationManager) then if Sender is TiPlotTranslationObject then
    begin
      FTranslationManager.NotificationRemove(Sender);
      Exit;
    end;

  if (Sender is TiPlotObject) then
    begin
      if Assigned(FEditorForm) then if not (FEditorForm as TiPlotEditorForm).IsClosing then
        with FEditorForm as TiPlotEditorForm do
          begin
            if      Sender is TiPlotToolBar       then ToolBarListBox.DeleteObjectIndex(Sender)
            else if Sender is TiPlotLegend        then LegendListBox.DeleteObjectIndex(Sender)
            else if Sender is TiPlotTable         then TableListBox.DeleteObjectIndex(Sender)
            else if Sender is TiPlotXAxis         then XAxisListBox.DeleteObjectIndex(Sender)
            else if Sender is TiPlotYAxis         then YAxisListBox.DeleteObjectIndex(Sender)
            else if Sender is TiPlotDataView      then DataViewListBox.DeleteObjectIndex(Sender)
            else if Sender is TiPlotChannelCustom then ChannelListBox.DeleteObjectIndex(Sender)
            else if Sender is TiPlotDataCursor    then DataCursorListBox.DeleteObjectIndex(Sender)
            else if Sender is TiPlotLimit         then LimitListBox.DeleteObjectIndex(Sender)
            else if Sender is TiPlotLabel         then LabelListBox.DeleteObjectIndex(Sender);
          end;

      if Assigned(FPlotObjectManager)then FPlotObjectManager.NotificationRemove(Sender);
      if Assigned(FLayoutManager)    then FLayoutManager.NotificationRemove    (Sender);

      if Assigned(FToolBarManager)   then FToolBarManager.NotificationRemove   (Sender);
      if Assigned(FLegendManager)    then FLegendManager.NotificationRemove    (Sender);
      if Assigned(FTableManager)     then FTableManager.NotificationRemove     (Sender);
      if Assigned(FXAxisManager)     then FXAxisManager.NotificationRemove     (Sender);
      if Assigned(FYAxisManager)     then FYAxisManager.NotificationRemove     (Sender);
      if Assigned(FChannelManager)   then FChannelManager.NotificationRemove   (Sender);
      if Assigned(FDataViewManager)  then FDataViewManager.NotificationRemove  (Sender);
      if Assigned(FDataCursorManager)then FDataCursorManager.NotificationRemove(Sender);
      if Assigned(FLimitManager)     then FLimitManager.NotificationRemove     (Sender);
      if Assigned(FLabelManager)     then FLabelManager.NotificationRemove     (Sender);
      if Assigned(FAnnotationManager)then FAnnotationManager.NotificationRemove(Sender);
    end;

  if      Sender = FPlotObjectManager  then FPlotObjectManager  := nil
  else if Sender = FToolBarManager     then FToolBarManager     := nil
  else if Sender = FLegendManager      then FLegendManager      := nil
  else if Sender = FTableManager       then FTableManager       := nil
  else if Sender = FXAxisManager       then FXAxisManager       := nil
  else if Sender = FYAxisManager       then FYAxisManager       := nil
  else if Sender = FChannelManager     then FChannelManager     := nil
  else if Sender = FDataViewManager    then FDataViewManager    := nil
  else if Sender = FDataCursorManager  then FDataCursorManager  := nil
  else if Sender = FLimitManager       then FLimitManager       := nil
  else if Sender = FLabelManager       then FLabelManager       := nil
  else if Sender = FAnnotationManager  then FAnnotationManager  := nil
  else if Sender = FLayoutManager      then FLayoutManager      := nil
  else if Sender = FTranslationManager then FTranslationManager := nil;
end;
//*************************************************************************************************************************************
procedure TiPlotMasterManager.NotificationSetFocus(Sender: TObject);
begin
  if Assigned(FToolBarManager   ) then FToolBarManager.NotificationSetFocus(Sender);
  if Assigned(FLegendManager    ) then FLegendManager.NotificationSetFocus(Sender);
  if Assigned(FTableManager     ) then FTableManager.NotificationSetFocus(Sender);
  if Assigned(FXAxisManager     ) then FXAxisManager.NotificationSetFocus(Sender);
  if Assigned(FYAxisManager     ) then FYAxisManager.NotificationSetFocus(Sender);
  if Assigned(FChannelManager   ) then FChannelManager.NotificationSetFocus(Sender);
  if Assigned(FDataViewManager  ) then FDataViewManager.NotificationSetFocus(Sender);
  if Assigned(FDataCursorManager) then FDataCursorManager.NotificationSetFocus(Sender);
  if Assigned(FLimitManager     ) then FLimitManager.NotificationSetFocus(Sender);
  if Assigned(FLabelManager     ) then FLabelManager.NotificationSetFocus(Sender);
  if Assigned(FAnnotationManager) then FAnnotationManager.NotificationSetFocus(Sender);
  if Assigned(FLayoutManager    ) then FLayoutManager.NotificationSetFocus(Sender);
end;
//*************************************************************************************************************************************
procedure TiPlotMasterManager.NotificationRename(Sender: TObject);
var
  NewName : String;
begin
  if Assigned(FToolBarManager   ) then FToolBarManager.NotificationRename(Sender);
  if Assigned(FLegendManager    ) then FLegendManager.NotificationRename(Sender);
  if Assigned(FTableManager     ) then FTableManager.NotificationRename(Sender);
  if Assigned(FXAxisManager     ) then FXAxisManager.NotificationRename(Sender);
  if Assigned(FYAxisManager     ) then FYAxisManager.NotificationRename(Sender);
  if Assigned(FChannelManager   ) then FChannelManager.NotificationRename(Sender);
  if Assigned(FDataViewManager  ) then FDataViewManager.NotificationRename(Sender);
  if Assigned(FDataCursorManager) then FDataCursorManager.NotificationRename(Sender);
  if Assigned(FLimitManager     ) then FLimitManager.NotificationRename(Sender);
  if Assigned(FLabelManager     ) then FLabelManager.NotificationRename(Sender);
  if Assigned(FAnnotationManager) then FAnnotationManager.NotificationRename(Sender);
  if Assigned(FLayoutManager    ) then FLayoutManager.NotificationRename(Sender);

  if Assigned(FEditorForm) then if not (FEditorForm as TiPlotEditorForm).IsClosing then
    with FEditorForm as TiPlotEditorForm do
      begin
        if Sender is TiPlotXAxis then
          begin
            NewName := (Sender as TiPlotXAxis).Name;
            if ChannelXAxisNameComboBox.Text = TiPlotObjectAccess(Sender as TiPlotXAxis).NameOld then
              begin
                XAxisNameComboBoxDropDown(ChannelXAxisNameComboBox);
                ChannelXAxisNameComboBox.ItemIndex := ChannelXAxisNameComboBox.Items.IndexOf(NewName);
              end;
            if LimitXAxisNameComboBox.Text = TiPlotObjectAccess(Sender as TiPlotXAxis).NameOld then
              begin
                XAxisNameComboBoxDropDown(LimitXAxisNameComboBox);
                LimitXAxisNameComboBox.ItemIndex := LimitXAxisNameComboBox.Items.IndexOf(NewName);
              end;
            if DataViewGridXAxisNameComboBox.Text = TiPlotObjectAccess(Sender).NameOld then
              begin
                XAxisNameComboBoxDropDown(DataViewGridXAxisNameComboBox);
                DataViewGridXAxisNameComboBox.ItemIndex := DataViewGridXAxisNameComboBox.Items.IndexOf(NewName);
              end;
          end;
        if Sender is TiPlotYAxis then
          begin
            NewName := (Sender as TiPlotYAxis).Name;
            if ChannelYAxisNameComboBox.Text = TiPlotObjectAccess(Sender as TiPlotYAxis).NameOld then
              begin
                YAxisNameComboBoxDropDown(ChannelYAxisNameComboBox);
                ChannelYAxisNameComboBox.ItemIndex := ChannelYAxisNameComboBox.Items.IndexOf(NewName);
              end;
            if LimitYAxisNameComboBox.Text = TiPlotObjectAccess(Sender as TiPlotYAxis).NameOld then
              begin
                YAxisNameComboBoxDropDown(LimitYAxisNameComboBox);
                LimitYAxisNameComboBox.ItemIndex := LimitYAxisNameComboBox.Items.IndexOf(NewName);
              end;
            if DataViewGridYAxisNameComboBox.Text = TiPlotObjectAccess(Sender).NameOld then
              begin
                YAxisNameComboBoxDropDown(DataViewGridYAxisNameComboBox);
                DataViewGridYAxisNameComboBox.ItemIndex := DataViewGridYAxisNameComboBox.Items.IndexOf(NewName);
              end;
          end;
        if Sender is TiPlotChannelCustom then
          begin
            NewName := (Sender as TiPlotChannelCustom).Name;
            if DataCursorChannelNameComboBox.Text = TiPlotObjectAccess(Sender).NameOld then
              begin
                ChannelNameComboBoxDropDown(DataCursorChannelNameComboBox);
                DataCursorChannelNameComboBox.ItemIndex := DataCursorChannelNameComboBox.Items.IndexOf(NewName);
              end;
          end
      end;
end;
//*************************************************************************************************************************************
procedure TiPlotMasterManager.NotificationChange(Sender: TObject);
begin
  if Assigned(FOnChange) then FOnChange(Self);
end;
//*************************************************************************************************************************************
function TiPlotMasterManager.AddChannel: Integer;
var
  iChannel : TiPlotChannelCustom;
begin
  iChannel := FChannelClass.Create(FOwner, NotificationChange, NotificationInsert, NotificationRemove, NotificationRename);
  TiPlotObjectAccess(iChannel).Loaded;

⌨️ 快捷键说明

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