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

📄 iplotobjects.pas

📁 iocopm3.04源码,一套很好的工控开发工具
💻 PAS
📖 第 1 页 / 共 4 页
字号:
//****************************************************************************************************************************************************
procedure TiPlotObject.SetDoubleProperty(Value: Double; var FVariable: Double; EventHandler : TNotifyEvent);
begin
  if FVariable <> Value then
    begin
      FVariable := Value;
      if Assigned(EventHandler) then EventHandler(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.SetIntegerProperty(Value: Integer; var FVariable: Integer; EventHandler : TNotifyEvent);
begin
  if FVariable <> Value then
    begin
      FVariable := Value;
      if Assigned(EventHandler) then EventHandler(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.SetStringProperty(Value: String; var FVariable: String; EventHandler : TNotifyEvent);
begin
  if FVariable <> Value then
    begin
      FVariable := Value;
      if Assigned(EventHandler) then EventHandler(Self);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.DrawSetup(const Canvas: TCanvas);
begin
  FCanDraw := True;
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.Draw(const Canvas: TCanvas; const BackGroundColor: TColor);
begin
end;
//****************************************************************************************************************************************************
function TiPlotObject.GetMouseObject(X, Y: Integer): TiPlotObject;
begin
  Result := Self;
  FMouseOverObject := Result;
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.CalcAxisPixels(X, Y: Integer; var XAxisPixels, YAxisPixels: Integer);
begin
  if XYAxesReversed then
    begin
      XAxisPixels := Y;
      YAxisPixels := X;
    end
  else
    begin
      XAxisPixels := X;
      YAxisPixels := Y;
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.iMouseDown(Button: TMouseButton; Shift: TShiftState; X, Y, ScreenX, ScreenY: Integer; PopupMenu : TPopupMenu);
var
  XAxisPixels : Integer;
  YAxisPixels : Integer;
  MouseData   : TiPlotMouseData;
  Cancel      : Boolean;
begin
  if not Enabled then Exit;
  CalcAxisPixels(X, Y, XAxisPixels, YAxisPixels);

  MouseData.X := X;
  MouseData.Y := Y;
  MouseData.XAxisPixels := XAxisPixels;
  MouseData.YAxisPixels := YAxisPixels;

  if Button = mbRight then
    begin
      if PopupEnabled then
        begin
          Cancel := False;
          TiPlotComponentAccess(Owner).DoPopUpMenuEvent(Self, Cancel, ScreenX, ScreenY);
          if not Cancel then
            begin
              AddMenuItems(PopupMenu);
              PopupMenu.Popup(ScreenX, ScreenY);
            end;
        end;
    end
  else if Button = mbLeft then
    begin
      FMouseDown := True;
      DoMouseLeft(MouseData);
    end;

  if iMouseHitTest(MouseData) then TiPlotComponentAccess(Owner).DoObjectMouseDown(Self, Button, Shift, X, Y);
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.iMouseMove(var HintData: TiHintData; Shift: TShiftState; X, Y, ScreenX, ScreenY: Integer; DblClickActive: Boolean);
var
  XAxisPixels : Integer;
  YAxisPixels : Integer;
  MouseData   : TiPlotMouseData;
begin
  CalcAxisPixels(X, Y, XAxisPixels, YAxisPixels);

  MouseData.X              := X;
  MouseData.Y              := Y;
  MouseData.XAxisPixels    := XAxisPixels;
  MouseData.YAxisPixels    := YAxisPixels;
  MouseData.DblClickActive := DblClickActive;

  if not FMouseDown then
       DoMouseHint(MouseData, HintData)
  else DoMouseMove(MouseData);

  if iMouseHitTest(MouseData) then TiPlotComponentAccess(Owner).DoObjectMouseMove(Self, Shift, X, Y);
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.iMouseUp(Button: TMouseButton; Shift: TShiftState; X, Y, ScreenX, ScreenY: Integer; DblClickActive: Boolean);
var
  XAxisPixels : Integer;
  YAxisPixels : Integer;
  MouseData   : TiPlotMouseData;
begin
  CalcAxisPixels(X, Y, XAxisPixels, YAxisPixels);

  MouseData.X              := X;
  MouseData.Y              := Y;
  MouseData.XAxisPixels    := XAxisPixels;
  MouseData.YAxisPixels    := YAxisPixels;
  MouseData.DblClickActive := DblClickActive;

  DoMouseUp(MouseData);
  if FMouseDown then
    begin
      FMouseDown := False;
      if iMouseHitTest(MouseData) then TiPlotComponentAccess(Owner).DoObjectMouseUp(Self, Button, Shift, X, Y);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.DoMouseNotOver;
begin

end;
//****************************************************************************************************************************************************
function TiPlotObject.iMouseWheel(WheelDelta: Integer; Shift: TShiftState; const MousePos: TPoint): Boolean;
begin
  Result := False;
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.DoMouseMove(MouseData: TiPlotMouseData);
begin

end;
//****************************************************************************************************************************************************
procedure TiPlotObject.DoMouseUp(MouseData: TiPlotMouseData);
begin

end;
//****************************************************************************************************************************************************
procedure TiPlotObject.DoMouseLeft(MouseData: TiPlotMouseData);
begin
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.DoMouseHint(MouseData: TiPlotMouseData; var HintData: TiHintData);
begin

end;
//****************************************************************************************************************************************************
procedure TiPlotObject.DoMouseDoubleClick(MouseData: TiPlotMouseData);
begin

end;
//****************************************************************************************************************************************************
function TiPlotObject.GetMousePointer(APoint: TPoint): TCursor;
begin
  Result := crDefault;
  if Assigned(FMouseOverObject) then
    begin
      if FMouseOverObject <> Self then Result := FMouseOverObject.GetMousePointer(APoint);
    end
  else FMouseOverObject := Self;
end;
//****************************************************************************************************************************************************
function TiPlotObject.GetTranslation(Value: String): String;
begin
  Result := TiPlotComponentAccess(Owner).Master.TranslationManager.FindReplacement(Value);
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.iKeyDown(var CharCode: Word; Shift: TShiftState);
begin

end;
//****************************************************************************************************************************************************
procedure TiPlotObject.AddMenuItems(PopupMenu: TPopUpMenu);
var
  x : Integer;
begin
  for x := PopupMenu.Items.Count - 1 downto 0 do
    PopupMenu.Items[x].Free;
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.AddEditMenuItems(PopupMenu: TPopUpMenu);
var
  MenuItem : TMenuItem;
begin
  if FUserCanEdit then
    begin
      MenuItem := TMenuItem.Create(PopupMenu);
      MenuItem.Caption := GetTranslation('Edit...');
      MenuItem.OnClick := EditMenuItemClick;
      MenuItem.Visible := True;

      PopupMenu.Items.Add(MenuItem);
    end;
end;
//****************************************************************************************************************************************************
procedure TiPlotObject.EditMenuItemClick(Sender: TObject);
begin
  if Assigned(FOnEdit) then FOnEdit(Self);
end;
//****************************************************************************************************************************************************
function TiPlotObject.iMouseHitTest(MouseData: TiPlotMouseData): Boolean;
begin
  Result := False;
end;                                         
//****************************************************************************************************************************************************
{ TiPlotLayoutObject }
//****************************************************************************************************************************************************
constructor TiPlotLayoutObject.Create(AOwner: TObject; AOnChange, AOnInsert, AOnRemove, AOnRename: TNotifyEvent);
begin
  inherited Create(AOwner, AOnChange, AOnInsert, AOnRemove, AOnRename);
  FStopPercent := 100;
end;
//****************************************************************************************************************************************************
destructor TiPlotLayoutObject.Destroy;
begin
  inherited;
end;
//****************************************************************************************************************************************************
function TiPlotLayoutObject.GetZOrderString: String;
begin
  Result := IntToStr(ZOrder);
  while Length(Result) < 3 do Result := '0' + Result;
end;
//****************************************************************************************************************************************************
function TiPlotLayoutObject.GetStartPercentString: String;
begin
  Result := IntToStr(Round(StartPercent));
  while Length(Result) < 3 do Result := '0' + Result;
end;
//****************************************************************************************************************************************************
procedure TiPlotLayoutObject.SetReverseSide  (const Value:Boolean);begin SetBooleanProperty(Value,FReverseSide,  TriggerChange      );end;
procedure TiPlotLayoutObject.SetLeft         (const Value:Integer);begin SetIntegerProperty(Value,FLeft,         nil                );end;
procedure TiPlotLayoutObject.SetTop          (const Value:Integer);begin SetIntegerProperty(Value,FTop,          nil                );end;
procedure TiPlotLayoutObject.SetRight        (const Value:Integer);begin SetIntegerProperty(Value,FRight,        nil                );end;
procedure TiPlotLayoutObject.SetBottom       (const Value:Integer);begin SetIntegerProperty(Value,FBottom,       nil                );end;
procedure TiPlotLayoutObject.SetHorizontal   (const Value:Boolean);begin SetBooleanProperty(Value,FHorizontal,   TriggerLayoutChange);end;
procedure TiPlotLayoutObject.SetZOrder       (const Value:Integer);begin SetIntegerProperty(Value,FZOrder,       TriggerLayoutChange);end;
procedure TiPlotLayoutObject.SetStartStacked (const Value:Boolean);begin SetBooleanProperty(Value,FStartStacked, nil                );end;
procedure TiPlotLayoutObject.SetStopStacked  (const Value:Boolean);begin SetBooleanProperty(Value,FStopStacked,  nil                );end;
procedure TiPlotLayoutObject.SetForceStacking(const Value:Boolean);begin SetBooleanProperty(Value,FForceStacking,TriggerLayoutChange);end;

⌨️ 快捷键说明

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