2008-02-03 12:05:55 +00:00
|
|
|
{*********************************************************}
|
|
|
|
{* VPEDELEM.PAS 1.03 *}
|
|
|
|
{*********************************************************}
|
|
|
|
|
|
|
|
{* ***** BEGIN LICENSE BLOCK ***** *}
|
|
|
|
{* Version: MPL 1.1 *}
|
|
|
|
{* *}
|
|
|
|
{* The contents of this file are subject to the Mozilla Public License *}
|
|
|
|
{* Version 1.1 (the "License"); you may not use this file except in *}
|
|
|
|
{* compliance with the License. You may obtain a copy of the License at *}
|
|
|
|
{* http://www.mozilla.org/MPL/ *}
|
|
|
|
{* *}
|
|
|
|
{* Software distributed under the License is distributed on an "AS IS" basis, *}
|
|
|
|
{* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License *}
|
|
|
|
{* for the specific language governing rights and limitations under the *}
|
|
|
|
{* License. *}
|
|
|
|
{* *}
|
|
|
|
{* The Original Code is TurboPower Visual PlanIt *}
|
|
|
|
{* *}
|
|
|
|
{* The Initial Developer of the Original Code is TurboPower Software *}
|
|
|
|
{* *}
|
|
|
|
{* Portions created by TurboPower Software Inc. are Copyright (C) 2002 *}
|
|
|
|
{* TurboPower Software Inc. All Rights Reserved. *}
|
|
|
|
{* *}
|
|
|
|
{* Contributor(s): *}
|
|
|
|
{* *}
|
|
|
|
{* ***** END LICENSE BLOCK ***** *}
|
2023-01-16 12:43:17 +00:00
|
|
|
{$WARN 6058 off : Call to subroutine "$1" marked as inline is not inlined}
|
2016-06-21 11:59:37 +00:00
|
|
|
{$I vp.inc}
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
unit VpEdElem;
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
uses
|
|
|
|
{$IFDEF LCL}
|
2016-06-22 07:59:17 +00:00
|
|
|
LCLProc, LCLType, LCLIntf,
|
2008-02-03 12:05:55 +00:00
|
|
|
{$ELSE}
|
2016-06-22 07:59:17 +00:00
|
|
|
Windows, Messages,
|
2008-02-03 12:05:55 +00:00
|
|
|
{$ENDIF}
|
2016-06-22 07:59:17 +00:00
|
|
|
SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
|
2016-11-21 17:12:05 +00:00
|
|
|
StdCtrls, ExtCtrls, ComCtrls,
|
|
|
|
VpBase, VpSR, VpPrtFmt;
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
type
|
2016-07-07 20:51:29 +00:00
|
|
|
|
|
|
|
{ TfrmEditElement }
|
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
TfrmEditElement = class(TForm)
|
2017-05-20 20:43:20 +00:00
|
|
|
BevelHeightWidth: TBevel;
|
|
|
|
BevelTopLeft: TBevel;
|
2022-10-03 22:26:21 +00:00
|
|
|
BevelTopLeft1: TBevel;
|
2008-02-03 12:05:55 +00:00
|
|
|
btnCancel: TButton;
|
|
|
|
btnOk: TButton;
|
|
|
|
btnShape: TButton;
|
|
|
|
edName: TEdit;
|
2016-07-07 20:51:29 +00:00
|
|
|
gbDayOffset: TGroupBox;
|
2022-10-03 22:26:21 +00:00
|
|
|
gbPosition: TGroupBox;
|
2016-07-07 20:51:29 +00:00
|
|
|
lblName: TLabel;
|
2016-07-21 11:15:26 +00:00
|
|
|
Panel1: TPanel;
|
2022-10-03 21:26:03 +00:00
|
|
|
DayOffsetPanel: TPanel;
|
2016-07-21 11:15:26 +00:00
|
|
|
ButtonPanel: TPanel;
|
|
|
|
ItemTypePanel: TPanel;
|
2017-05-20 20:43:20 +00:00
|
|
|
HeightWidthPanel: TPanel;
|
2022-10-03 22:26:21 +00:00
|
|
|
Panel2: TPanel;
|
|
|
|
PositionPanel: TPanel;
|
|
|
|
rbPixels: TRadioButton;
|
|
|
|
rbPercent: TRadioButton;
|
|
|
|
rbInches: TRadioButton;
|
|
|
|
rbCentimeters: TRadioButton;
|
2017-05-20 20:43:20 +00:00
|
|
|
TopLeftPanel: TPanel;
|
2016-07-07 20:51:29 +00:00
|
|
|
rgDayOffsetUnit: TRadioGroup;
|
2008-02-03 12:05:55 +00:00
|
|
|
rgItemType: TRadioGroup;
|
2016-07-07 20:51:29 +00:00
|
|
|
LblTop: TLabel;
|
|
|
|
LblLeft: TLabel;
|
|
|
|
LblHeight: TLabel;
|
|
|
|
LblWidth: TLabel;
|
2008-02-03 12:05:55 +00:00
|
|
|
rgRotation: TRadioGroup;
|
|
|
|
edTop: TEdit;
|
|
|
|
edLeft: TEdit;
|
|
|
|
edHeight: TEdit;
|
|
|
|
edWidth: TEdit;
|
|
|
|
chkVisible: TCheckBox;
|
|
|
|
gbCaption: TGroupBox;
|
|
|
|
btnCaptionFont: TButton;
|
|
|
|
FontDialog1: TFontDialog;
|
|
|
|
edCaptionText: TEdit;
|
2016-07-07 20:51:29 +00:00
|
|
|
lblCaptionText: TLabel;
|
2008-02-03 12:05:55 +00:00
|
|
|
edOffset: TEdit;
|
|
|
|
udOffset: TUpDown;
|
|
|
|
udTop: TUpDown;
|
|
|
|
udLeft: TUpDown;
|
|
|
|
udHeight: TUpDown;
|
|
|
|
udWidth: TUpDown;
|
|
|
|
procedure btnCancelClick(Sender: TObject);
|
|
|
|
procedure btnOkClick(Sender: TObject);
|
|
|
|
procedure FormCreate(Sender: TObject);
|
2022-10-03 22:26:21 +00:00
|
|
|
procedure FormShow(Sender: TObject);
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure rgItemTypeClick(Sender: TObject);
|
|
|
|
procedure btnShapeClick(Sender: TObject);
|
|
|
|
procedure btnCaptionFontClick(Sender: TObject);
|
|
|
|
procedure edCaptionTextChange(Sender: TObject);
|
|
|
|
procedure PosEditExit(Sender: TObject);
|
|
|
|
procedure PosEditEnter(Sender: TObject);
|
2022-10-03 22:26:21 +00:00
|
|
|
procedure MeasurementUnitChange(Sender: TObject);
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure UpDownClick(Sender: TObject; Button: TUDBtnType);
|
|
|
|
private
|
2016-07-20 19:29:00 +00:00
|
|
|
procedure PositionControls;
|
2016-07-07 20:51:29 +00:00
|
|
|
procedure SetCaptions;
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure SetMaxSpin(Spin: Integer);
|
|
|
|
protected
|
2016-07-20 19:29:00 +00:00
|
|
|
TheShape: TVpPrintShape;
|
|
|
|
TheCaption: TVpPrintCaption;
|
|
|
|
CurEdit: TEdit;
|
|
|
|
MaxSpin: Integer;
|
2022-10-03 22:26:21 +00:00
|
|
|
function GetUnitIndex: Integer;
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure SaveData(AnElement: TVpPrintFormatElementItem);
|
|
|
|
procedure SetData(AnElement: TVpPrintFormatElementItem);
|
|
|
|
procedure SetItemType(Index: Integer);
|
|
|
|
function Validate: Boolean;
|
|
|
|
{ Private declarations }
|
|
|
|
public
|
|
|
|
function Execute(AnElement : TVpPrintFormatElementItem) : Boolean;
|
|
|
|
{ Public declarations }
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
2016-07-07 20:51:29 +00:00
|
|
|
uses
|
2022-10-03 22:26:21 +00:00
|
|
|
Math,
|
2016-11-21 17:12:05 +00:00
|
|
|
VpMisc, VpEdShape;
|
2008-02-03 12:05:55 +00:00
|
|
|
|
2016-06-07 16:34:18 +00:00
|
|
|
{$IFDEF LCL}
|
|
|
|
{$R *.lfm}
|
|
|
|
{$ELSE}
|
|
|
|
{$R *.dfm}
|
2008-02-03 12:05:55 +00:00
|
|
|
{$ENDIF}
|
|
|
|
|
|
|
|
function EvalFmt(Val : Extended) : string;
|
|
|
|
begin
|
|
|
|
Result := FormatFloat('0.00', Val);
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
|
|
|
{******************************************************************************}
|
|
|
|
{* TfrmEditElement *}
|
|
|
|
{******************************************************************************}
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.FormCreate(Sender: TObject);
|
2017-05-20 20:43:20 +00:00
|
|
|
var
|
|
|
|
i: Integer;
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
btnShape.Enabled := False;
|
|
|
|
|
|
|
|
gbCaption.Enabled := False;
|
|
|
|
edCaptionText.Enabled := False;
|
2016-07-07 20:51:29 +00:00
|
|
|
lblCaptionText.Enabled := False;
|
2008-02-03 12:05:55 +00:00
|
|
|
btnCaptionFont.Enabled := False;
|
2016-07-07 20:51:29 +00:00
|
|
|
|
2022-10-03 22:26:21 +00:00
|
|
|
for i:=0 to rgDayOffsetUnit.ControlCount-1 do
|
|
|
|
TRadioButton(rgDayOffsetUnit.Controls[i]).ParentFont := false;
|
2017-05-20 20:43:20 +00:00
|
|
|
rgDayOffsetUnit.Font.Style := [fsBold];
|
|
|
|
|
2022-10-03 22:26:21 +00:00
|
|
|
for i:=0 to rgItemType.ControlCount-1 do
|
|
|
|
TRadioButton(rgItemType.Controls[i]).ParentFont := false;
|
|
|
|
rgItemType.Font.Style := [fsBold];
|
|
|
|
|
|
|
|
for i:=0 to rgRotation.ControlCount-1 do
|
|
|
|
TRadioButton(rgRotation.Controls[i]).ParentFont := false;
|
2017-05-20 20:43:20 +00:00
|
|
|
rgItemType.Font.Style := [fsBold];
|
|
|
|
|
2022-10-03 22:26:21 +00:00
|
|
|
for i:= 0 to gbPosition.ControlCount-1 do
|
|
|
|
begin
|
|
|
|
if gbPosition.Controls[i] is TLabel then
|
|
|
|
TLabel(gbPosition.Controls[i]).ParentFont := false
|
|
|
|
else if gbPosition.Controls[i] is TEdit then
|
|
|
|
TEdit(gbPosition.Controls[i]).ParentFont := false
|
|
|
|
else if gbPosition.Controls[i] is TCheckbox then
|
|
|
|
TCheckbox(gbPosition.Controls[i]).ParentFont := false
|
|
|
|
else if gbPosition.Controls[i] is TPanel then
|
|
|
|
TPanel(gbPosition.Controls[i]).ParentFont := false;
|
|
|
|
end;
|
|
|
|
gbPosition.Font.Style := [fsBold];
|
|
|
|
|
2016-07-07 20:51:29 +00:00
|
|
|
SetCaptions;
|
2023-01-18 10:55:52 +00:00
|
|
|
FixLabels(Self);
|
2008-02-03 12:05:55 +00:00
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.FormShow(Sender: TObject);
|
|
|
|
begin
|
2016-07-20 19:29:00 +00:00
|
|
|
PositionControls;
|
2008-02-03 12:05:55 +00:00
|
|
|
edName.SetFocus;
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.btnCaptionFontClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
if FontDialog1.Execute then
|
|
|
|
TheCaption.Font := FontDialog1.Font;
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.btnCancelClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
ModalResult := mrCancel;
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.btnOkClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
if Validate then
|
|
|
|
ModalResult := mrOk
|
|
|
|
else begin
|
|
|
|
ShowMessage(RSNeedElementName);
|
|
|
|
edName.SetFocus;
|
|
|
|
Exit;
|
|
|
|
end;
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.btnShapeClick(Sender: TObject);
|
|
|
|
var
|
|
|
|
frmEditShape: TfrmEditShape;
|
|
|
|
begin
|
|
|
|
Application.CreateForm(TfrmEditShape, frmEditShape);
|
|
|
|
frmEditShape.Execute(TheShape);
|
|
|
|
frmEditShape.Free;
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.edCaptionTextChange(Sender: TObject);
|
|
|
|
begin
|
|
|
|
TheCaption.Caption := edCaptionText.Text;
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
function TfrmEditElement.Execute(AnElement : TVpPrintFormatElementItem) : Boolean;
|
|
|
|
begin
|
|
|
|
SetData(AnElement);
|
|
|
|
Result := ShowModal = mrOk;
|
|
|
|
if Result then
|
|
|
|
SaveData(AnElement);
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2022-10-03 22:26:21 +00:00
|
|
|
function TfrmEditElement.GetUnitIndex: Integer;
|
|
|
|
begin
|
|
|
|
if rbPixels.Checked then
|
|
|
|
Result := 0
|
|
|
|
else if rbPercent.Checked then
|
|
|
|
Result := 1
|
|
|
|
else if rbInches.Checked then
|
|
|
|
Result := 2
|
|
|
|
else if rbCentimeters.Checked then
|
|
|
|
Result := 3
|
|
|
|
else
|
|
|
|
raise Exception.Create('GetUnitIndex: unknown control');
|
|
|
|
end;
|
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.PosEditEnter(Sender: TObject);
|
|
|
|
begin
|
|
|
|
CurEdit := (Sender as TEdit);
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2022-10-03 22:26:21 +00:00
|
|
|
procedure TfrmEditElement.MeasurementUnitChange(Sender: TObject);
|
|
|
|
begin
|
|
|
|
SetMaxSpin(GetUnitIndex);
|
|
|
|
end;
|
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.PosEditExit(Sender: TObject);
|
|
|
|
var
|
2022-10-03 17:18:42 +00:00
|
|
|
ed: TEdit;
|
|
|
|
Val: Extended;
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
ed := (Sender as TEdit);
|
2022-10-03 17:18:42 +00:00
|
|
|
if TryStrToFloat(ed.Text, Val) then
|
|
|
|
begin
|
2008-02-03 12:05:55 +00:00
|
|
|
if Val > MaxSpin then begin
|
|
|
|
ed.Text := EvalFmt(MaxSpin);
|
|
|
|
end else
|
|
|
|
if Val < 0.0 then begin
|
|
|
|
ed.Text := EvalFmt(0);
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
end else
|
|
|
|
begin
|
|
|
|
ed.SetFocus;
|
|
|
|
MessageDlg(RSPleaseEnterFloat, mtError, [mbOK], 0);
|
2008-02-03 12:05:55 +00:00
|
|
|
end;
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.rgItemTypeClick(Sender: TObject);
|
|
|
|
begin
|
|
|
|
SetItemType(rgItemType.ItemIndex);
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
|
|
|
procedure TfrmEditElement.SaveData(AnElement: TVpPrintFormatElementItem);
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
AnElement.ElementName := edName.Text;
|
|
|
|
|
|
|
|
AnElement.DayOffset := udOffset.Position;
|
|
|
|
|
|
|
|
AnElement.Top := StrToFloat(edTop.Text);
|
|
|
|
AnElement.Left := StrToFloat(edLeft.Text);
|
|
|
|
AnElement.Height:= StrToFloat(edHeight.Text);
|
|
|
|
AnElement.Width := StrToFloat(edWidth.Text);
|
|
|
|
|
|
|
|
AnElement.ItemType := TVpItemType(rgItemType.ItemIndex);
|
|
|
|
|
2016-07-07 20:51:29 +00:00
|
|
|
AnElement.DayOffsetUnits := TVpDayUnits(rgDayOffsetUnit.ItemIndex);
|
2008-02-03 12:05:55 +00:00
|
|
|
AnElement.Rotation := TVpRotationAngle(rgRotation.ItemIndex);
|
2022-10-03 22:26:21 +00:00
|
|
|
AnElement.Measurement := TVpItemMeasurement(GetUnitIndex);
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
AnElement.Visible := chkVisible.Checked;
|
|
|
|
end;
|
2016-07-07 20:51:29 +00:00
|
|
|
|
|
|
|
procedure TfrmEditElement.SetCaptions;
|
|
|
|
begin
|
|
|
|
Caption := RSEditElementCaption;
|
|
|
|
|
|
|
|
lblName.Caption := RSNameLbl;
|
|
|
|
|
|
|
|
rgItemType.Caption := RSElementTypeLbl;
|
|
|
|
rgItemType.Items[0] := RSDayViewElement;
|
|
|
|
rgItemType.Items[1] := RSWeekViewElement;
|
|
|
|
rgItemType.Items[2] := RSMonthViewElement;
|
|
|
|
rgItemType.Items[3] := RSCalendarElement;
|
|
|
|
rgItemType.Items[4] := RSShapeElement;
|
|
|
|
rgItemType.Items[5] := RSCaptionElement;
|
|
|
|
rgItemType.Items[6] := RSTasksElement;
|
|
|
|
rgItemType.Items[7] := RSContactsElement;
|
|
|
|
|
2022-10-03 21:26:03 +00:00
|
|
|
gbDayOffset.Caption := RSDayOffsetCaption;
|
|
|
|
rgDayOffsetUnit.Caption := RSDayOffsetUnits;
|
2016-07-07 20:51:29 +00:00
|
|
|
rgDayOffsetUnit.Items[0] := RSDays;
|
|
|
|
rgDayOffsetUnit.Items[1] := RSWeeks;
|
|
|
|
rgDayOffsetUnit.Items[2] := RSMonths;
|
|
|
|
rgDayOffsetUnit.Items[3] := RSYears;
|
|
|
|
|
|
|
|
rgRotation.Caption := RSRotationCaption;
|
2022-10-03 22:26:21 +00:00
|
|
|
rbPixels.Caption := RSPixels;
|
|
|
|
rbPercent.Caption := RSPercent;
|
|
|
|
rbInches.Caption := RSInches;
|
2016-07-07 20:51:29 +00:00
|
|
|
lblLeft.Caption := RSLeft;
|
|
|
|
lblTop.Caption := RSTop;
|
|
|
|
lblWidth.Caption := RSWidth;
|
|
|
|
lblHeight.Caption := RSHeight;
|
|
|
|
chkVisible.Caption := RSVisible;
|
|
|
|
|
2022-10-03 21:26:03 +00:00
|
|
|
gbCaption.Caption := RSCaptionLbl;
|
2016-07-07 20:51:29 +00:00
|
|
|
lblCaptionText.Caption := RSTextCaption;
|
|
|
|
btnCaptionFont.Caption := RSFontBtn;
|
|
|
|
btnShape.Caption := RSShapeBtn;
|
|
|
|
btnOK.Caption := RSOKBtn;
|
|
|
|
btnCancel.Caption := RSCancelBtn;
|
|
|
|
end;
|
|
|
|
|
2016-07-20 19:29:00 +00:00
|
|
|
procedure TfrmEditElement.PositionControls;
|
2016-07-07 20:51:29 +00:00
|
|
|
begin
|
2017-05-20 20:43:20 +00:00
|
|
|
AlignOKCancel(btnOK, btnCancel, ButtonPanel);
|
2016-07-21 11:15:26 +00:00
|
|
|
|
2017-05-20 20:43:20 +00:00
|
|
|
udOffset.Width := udOffset.Height div 2 + 1;
|
|
|
|
udTop.Width := udTop.Height div 2 + 1;
|
|
|
|
udLeft.Width := udLeft.Height div 2 + 1;
|
|
|
|
udHeight.Width := udHeight.Height div 2 + 1;
|
|
|
|
udWidth.Width := udWidth.Height div 2 + 1;
|
|
|
|
|
|
|
|
BevelTopLeft.Shape := bsSpacer;
|
|
|
|
BevelHeightWidth.Shape := bsSpacer;
|
2022-10-03 22:26:21 +00:00
|
|
|
|
|
|
|
rgRotation.Constraints.MinWidth := gbDayOffset.Width;
|
|
|
|
btnShape.Constraints.MinWidth := MaxValue([btnShape.Width, btnOK.Width, btnCancel.Width]);
|
|
|
|
btnOK.Constraints.MinWidth := btnShape.Constraints.MinWidth;
|
|
|
|
btnCancel.Constraints.MinWidth := btnShape.Constraints.MinWidth;
|
2016-07-07 20:51:29 +00:00
|
|
|
end;
|
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.SetData(AnElement : TVpPrintFormatElementItem);
|
|
|
|
begin
|
|
|
|
edName.Text := AnElement.ElementName;
|
|
|
|
|
|
|
|
udOffset.Position := AnElement.DayOffset;
|
|
|
|
|
|
|
|
rgItemType.ItemIndex := Ord(AnElement.ItemType);
|
|
|
|
TheShape := AnElement.Shape;
|
|
|
|
TheCaption := AnElement.Caption;
|
|
|
|
|
2016-07-07 20:51:29 +00:00
|
|
|
rgDayOffsetUnit.ItemIndex := Ord(AnElement.DayOffsetUnits);
|
2008-02-03 12:05:55 +00:00
|
|
|
rgRotation.ItemIndex := Ord(AnElement.Rotation);
|
2022-10-03 22:26:21 +00:00
|
|
|
case AnElement.Measurement of
|
|
|
|
imAbsolutePixel: rbPixels.Checked := true;
|
|
|
|
imPercent: rbPercent.Checked := true;
|
|
|
|
imInches: rbInches.Checked := true;
|
|
|
|
imCentimeters: rbCentimeters.Checked := true;
|
|
|
|
end;
|
|
|
|
SetMaxSpin(Ord(AnElement.Measurement));
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
edTop.Text := EvalFmt(AnElement.Top);
|
|
|
|
udTop.Position := Trunc(AnElement.Top);
|
|
|
|
edLeft.Text := EvalFmt(AnElement.Left);
|
|
|
|
udLeft.Position := Trunc(AnElement.Left);
|
|
|
|
edHeight.Text := EvalFmt(AnElement.Height);
|
|
|
|
udHeight.Position := Trunc(AnElement.Height);
|
|
|
|
edWidth.Text := EvalFmt(AnElement.Width);
|
|
|
|
udWidth.Position := Trunc(AnElement.Width);
|
|
|
|
|
|
|
|
edCaptionText.Text := AnElement.Caption.Caption;
|
|
|
|
FontDialog1.Font := AnElement.Caption.Font;
|
|
|
|
|
|
|
|
chkVisible.Checked := AnElement.Visible;
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.SetItemType(Index : Integer);
|
2022-10-03 21:26:03 +00:00
|
|
|
var
|
|
|
|
itemType: TVpItemType;
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
rgItemType.ItemIndex := Index;
|
2022-10-03 21:26:03 +00:00
|
|
|
itemType := TVpItemType(Index);
|
2008-02-03 12:05:55 +00:00
|
|
|
|
2022-10-03 21:26:03 +00:00
|
|
|
btnShape.Enabled := itemType = itShape;
|
2008-02-03 12:05:55 +00:00
|
|
|
|
2022-10-03 21:26:03 +00:00
|
|
|
gbCaption.Enabled := itemType = itCaption;
|
2022-10-03 17:18:42 +00:00
|
|
|
edCaptionText.Enabled := gbCaption.Enabled;
|
|
|
|
lblCaptionText.Enabled := gbCaption.Enabled;
|
|
|
|
btnCaptionFont.Enabled := gbCaption.Enabled;
|
2022-10-03 21:26:03 +00:00
|
|
|
|
|
|
|
DayOffsetPanel.Enabled := itemType in [itDayView, itWeekView, itMonthView, itCalendar];
|
2008-02-03 12:05:55 +00:00
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.SetMaxSpin(Spin : Integer);
|
|
|
|
begin
|
|
|
|
case Spin of
|
|
|
|
0: MaxSpin := 2000;
|
|
|
|
1: MaxSpin := 100;
|
|
|
|
2: MaxSpin := 50;
|
|
|
|
end;
|
|
|
|
|
|
|
|
udLeft.Max := MaxSpin;
|
|
|
|
udTop.Max := MaxSpin;
|
|
|
|
udHeight.Max := MaxSpin;
|
|
|
|
udWidth.Max := MaxSpin;
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
2008-02-03 12:05:55 +00:00
|
|
|
procedure TfrmEditElement.UpDownClick(Sender: TObject; Button: TUDBtnType);
|
|
|
|
var
|
|
|
|
Val, Inc : Extended;
|
|
|
|
begin
|
2022-10-03 17:18:42 +00:00
|
|
|
if Sender = udLeft then CurEdit := edLeft;
|
|
|
|
if Sender = udTop then CurEdit := edTop;
|
2008-02-03 12:05:55 +00:00
|
|
|
if Sender = udHeight then CurEdit := edHeight;
|
2022-10-03 17:18:42 +00:00
|
|
|
if Sender = udWidth then CurEdit := edWidth;
|
2008-02-03 12:05:55 +00:00
|
|
|
|
|
|
|
Val := 0.0;
|
2022-10-03 17:18:42 +00:00
|
|
|
if not TryStrToFloat(CurEdit.Text, Val) then
|
|
|
|
begin
|
|
|
|
Val := 0.0;
|
|
|
|
CurEdit.SetFocus;
|
|
|
|
MessageDlg(RSPleaseEnterFloat, mtError, [mbOK], 0);
|
2008-02-03 12:05:55 +00:00
|
|
|
end;
|
|
|
|
|
|
|
|
Inc := udLeft.Increment / 100;
|
|
|
|
case Button of
|
|
|
|
btNext: begin
|
|
|
|
if Trunc(Val + Inc) > Trunc(Val) then
|
|
|
|
(Sender as TUpDown).Position := (Sender as TUpDown).Position + 1;
|
|
|
|
CurEdit.Text := FormatFloat('0.00 ', Val + Inc);
|
|
|
|
end;
|
|
|
|
btPrev: begin
|
|
|
|
if Trunc(Val - Inc) < Trunc(Val) then
|
|
|
|
(Sender as TUpDown).Position := (Sender as TUpDown).Position - 1;
|
|
|
|
CurEdit.Text := FormatFloat('0.00 ', Val - Inc);
|
|
|
|
end;
|
|
|
|
end;
|
|
|
|
end;
|
2022-10-03 17:18:42 +00:00
|
|
|
|
|
|
|
function TfrmEditElement.Validate: Boolean;
|
2008-02-03 12:05:55 +00:00
|
|
|
begin
|
|
|
|
Result := edName.Text <> '';
|
|
|
|
end;
|
|
|
|
|
|
|
|
end.
|
|
|
|
|