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

📄 iplotdatacursor.pas

📁 iocopm3.04源码,一套很好的工控开发工具
💻 PAS
📖 第 1 页 / 共 4 页
字号:
begin
  if Sender = FChannel then FChannel := nil;
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.NotificationRename(Sender: TObject);
begin
  if Sender = FChannel then FChannelName := (Sender as TiPlotObject).Name;
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.SetChannelName(const Value: String);
begin
  if FChannelName <> Value then
    begin
      FChannelName := Value;
      FChannel     := nil;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.SetXYAxesReversed(const Value: Boolean);
begin
  inherited;
  DoSetup;
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.DoSetup;
begin
  if Owner is TiXYPlot then
    case FStyle of
      ipcsValueXY       : begin
                            FPointer1Show := True; FPointer1Orientation := ioVertical;
                            FPointer2Show := True; FPointer2Orientation := ioHorizontal;
                                                   FHintOrientation     := ioVertical;
                          end;
      ipcsValueX        : begin
                            FPointer1Show := True; FPointer1Orientation := ioVertical;
                            FPointer2Show := False;
                                                   FHintOrientation     := ioVertical;
                          end;
      ipcsValueY        : begin
                            FPointer1Show := False;
                            FPointer2Show := True; FPointer2Orientation := ioHorizontal;
                                                   FHintOrientation     := ioHorizontal;
                          end;
      ipcsDeltaX        : begin
                            FPointer1Show := True; FPointer1Orientation := ioVertical;
                            FPointer2Show := True; FPointer2Orientation := ioVertical;
                                                   FHintOrientation     := ioVertical;
                          end;
      ipcsDeltaY        : begin
                            FPointer1Show := True; FPointer1Orientation := ioHorizontal;
                            FPointer2Show := True; FPointer2Orientation := ioHorizontal;
                                                   FHintOrientation     := ioHorizontal;
                          end;
      ipcsInverseDeltaX : begin
                            FPointer1Show := True; FPointer1Orientation := ioVertical;
                            FPointer2Show := True; FPointer2Orientation := ioVertical;
                                                   FHintOrientation     := ioVertical;
                          end;
    end
  else
    case FStyle of
      ipcsValueXY       : begin
                            FPointer1Show := True; FPointer1Orientation := ioVertical;
                            FPointer2Show := False;
                                                   FHintOrientation     := ioVertical;
                          end;
      ipcsValueX        : begin
                            FPointer1Show := True; FPointer1Orientation := ioVertical;
                            FPointer2Show := False;
                                                   FHintOrientation     := ioVertical;
                          end;
      ipcsValueY        : begin
                            if FScopeStyle then
                              begin
                                FPointer1Show := False;
                                FPointer2Show := True; FPointer2Orientation := ioHorizontal;
                                                       FHintOrientation     := ioHorizontal;
                              end
                            else
                              begin
                                FPointer1Show := True; FPointer1Orientation := ioVertical;
                                FPointer2Show := False;
                                                       FHintOrientation     := ioVertical;
                              end;
                          end;
      ipcsDeltaX        : begin
                            FPointer1Show := True; FPointer1Orientation := ioVertical;
                            FPointer2Show := True; FPointer2Orientation := ioVertical;
                                                   FHintOrientation     := ioVertical;
                          end;
      ipcsDeltaY        : begin
                            FPointer1Show := True; FPointer1Orientation := ioHorizontal;
                            FPointer2Show := True; FPointer2Orientation := ioHorizontal;
                                                   FHintOrientation     := ioHorizontal;
                          end;
      ipcsInverseDeltaX : begin
                            FPointer1Show := True; FPointer1Orientation := ioVertical;
                            FPointer2Show := True; FPointer2Orientation := ioVertical;
                                                   FHintOrientation     := ioVertical;
                          end;
    end;

  if XYAxesReversed then
    begin
      if FPointer1Orientation = ioVertical then FPointer1Orientation := ioHorizontal else FPointer1Orientation := ioVertical;
      if FPointer2Orientation = ioVertical then FPointer2Orientation := ioHorizontal else FPointer2Orientation := ioVertical;
      if FHintOrientation     = ioVertical then FHintOrientation     := ioHorizontal else FHintOrientation     := ioVertical;
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.SetUseChannelColor       (const Value:Boolean);begin SetBooleanProperty(Value,FUseChannelColor,       TriggerChange);end;
procedure TiPlotDataCursor.SetHintHideOnRelease     (const Value:Boolean);begin SetBooleanProperty(Value,FHintHideOnRelease,     TriggerChange);end;
procedure TiPlotDataCursor.SetHintShow              (const Value:Boolean);begin SetBooleanProperty(Value,FHintShow,              TriggerChange);end;
procedure TiPlotDataCursor.SetColor                 (const Value:TColor );begin SetColorProperty  (Value,FColor,                 TriggerChange);end;
procedure TiPlotDataCursor.SetHintPosition          (const Value:Double );begin SetDoubleProperty (Value,FHintPosition,          TriggerChange);end;
procedure TiPlotDataCursor.SetChannelAllowAll       (const Value:Boolean);begin SetBooleanProperty(Value,FChannelAllowAll,       TriggerChange);end;
procedure TiPlotDataCursor.SetChannelShowAllInLegend(const Value:Boolean);begin SetBooleanProperty(Value,FChannelShowAllInLegend,TriggerChange);end;
procedure TiPlotDataCursor.SetPointerPenWidth       (const Value:Integer);begin SetIntegerProperty(Value,FPointerPenWidth,       TriggerChange);end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.SetFont(const Value:TFont);begin FFont.Assign(Value);end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.SetHintOrientationSide(const Value: TiOrientationSide);
begin
  if FHintOrientationSide <> Value then
    begin
      FHintOrientationSide := Value;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.SetStyle(const Value: TiPlotDataCursorStyle);
begin
  if FStyle <> Value then
    begin
      FStyle := Value;
      DoSetup;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.SetScopeStyle(const Value:Boolean);
begin
  if FScopeStyle <> Value then
    begin
      FScopeStyle := Value;
      DoSetup;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.SetPointer1Position(const Value: Double);
var
  TempValue : Double;
begin
  TempValue := Value;
  if TempValue <   0 then TempValue :=   0;
  if TempValue > 100 then TempValue := 100;
  if FPointer1Position <> TempValue then
    begin
      FPointer1Position := TempValue;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.SetPointer2Position(const Value: Double);
var
  TempValue : Double;
begin
  TempValue := Value;
  if TempValue <   0 then TempValue :=   0;
  if TempValue > 100 then TempValue := 100;
  if FPointer2Position <> TempValue then
    begin
      FPointer2Position := TempValue;
      TriggerChange(Self);
    end;
end;
//****************************************************************************************************************************************************
function TiPlotDataCursor.iMouseHitTest(MouseData: TiPlotMouseData): Boolean;
begin
  Result := False;
  if not Assigned(FDataView) then Exit;

  if FPointer1Show then if PtInRect(FPointer1Rect, Point(MouseData.X, MouseData.Y)) then Result := True;
  if FPointer2Show then if PtInRect(FPointer2Rect, Point(MouseData.X, MouseData.Y)) then Result := True;
  if FHintShowing  then if PtInRect(FHintRect,     Point(MouseData.X, MouseData.Y)) then Result := True;
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.DoSetFocus;
begin
  inherited;
  if Assigned(Channel) then TiPlotChannelCustomAccess(Channel).SetUserSelected(True);
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.NotificationSetFocus(Sender: TObject);
begin
  if Sender = Self                                                      then Exit;
  if not (Sender as TiPlotObject).UserSelected                          then Exit;

  if Sender is TiPlotChannelCustom then
    begin
      if Sender = Channel                                               then Exit;

      if UserSelected  then
        begin
          ChannelName := (Sender as TiPlotChannelCustom).Name;
          Exit;
        end;
    end;
  SetUserSelected(False);
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.DoMouseLeft(MouseData: TiPlotMouseData);
begin
  inherited;

  FMouseDownX := MouseData.X;
  FMouseDownY := MouseData.Y;

  if not Assigned(FDataView) then Exit;

  if PtInRect(FHintRect, Point(MouseData.X, MouseData.Y)) then
    begin
      FMouseDownXPixels := FDataView.PositionPercentToPixelsX(FHintPosition);
      FMouseDownYPixels := FDataView.PositionPercentToPixelsY(FHintPosition);

      FMouseDownHint := True;

      TriggerInvalidateNow(Self);
    end
  else if FPointer1Show and PtInRect(FPointer1Rect, Point(MouseData.X, MouseData.Y)) then
    begin
      FMouseDownXPixels := FDataView.PositionPercentToPixelsX(FPointer1Position);
      FMouseDownYPixels := FDataView.PositionPercentToPixelsY(FPointer1Position);

      FMouseDownPointer1 := True;
      TriggerInvalidateNow(Self);
      DoUpdate;
    end
  else if FPointer2Show and PtInRect(FPointer2Rect, Point(MouseData.X, MouseData.Y)) then
    begin
      FMouseDownXPixels := FDataView.PositionPercentToPixelsX(FPointer2Position);
      FMouseDownYPixels := FDataView.PositionPercentToPixelsY(FPointer2Position);

      FMouseDownPointer2 := True;
      TriggerInvalidateNow(Self);
      DoUpdate;
    end
  else if PtInRect(FHintRect, Point(MouseData.X, MouseData.Y)) then
    begin
      FMouseDownXPixels := FDataView.PositionPercentToPixelsX(FHintPosition);
      FMouseDownYPixels := FDataView.PositionPercentToPixelsY(FHintPosition);

      FMouseDownHint := True;

      TriggerInvalidateNow(Self);
    end
end;
//****************************************************************************************************************************************************
procedure TiPlotDataCursor.DoMouseMove(MouseData: TiPlotMouseData);
begin
  if not Assigned(FDataView) then Exit;

⌨️ 快捷键说明

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