tvplanit: Improved layout of printformat element editor in VpEdElem

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8512 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-10-03 22:26:21 +00:00
parent f5d94166a0
commit a35403bb3f
4 changed files with 517 additions and 414 deletions

View File

@ -336,7 +336,7 @@ msgstr "Täglich"
#: vpsr.rsdayinclbl
msgid "Day increment:"
msgstr "Datumsänderung"
msgstr "Datumsänderung:"
#: vpsr.rsdayincunits
msgid "Day increment units"

File diff suppressed because it is too large Load Diff

View File

@ -1,17 +1,5 @@
{"version":1,"strings":[
{"hash":9518596,"name":"tfrmeditelement.caption","sourcebytes":[69,100,105,116,32,69,108,101,109,101,110,116],"value":"Edit Element"},
{"hash":218805680,"name":"tfrmeditelement.gbvisual.caption","sourcebytes":[32,86,105,115,117,97,108,32],"value":" Visual "},
{"hash":228085632,"name":"tfrmeditelement.rgmeasurement.caption","sourcebytes":[32,77,101,97,115,117,114,101,109,101,110,116,32],"value":" Measurement "},
{"hash":176733536,"name":"tfrmeditelement.rgrotation.caption","sourcebytes":[32,82,111,116,97,116,105,111,110,32],"value":" Rotation "},
{"hash":247455546,"name":"tfrmeditelement.lblheight.caption","sourcebytes":[72,101,105,103,104,116,58],"value":"Height:"},
{"hash":209200,"name":"tfrmeditelement.edheight.text","sourcebytes":[48,46,48,48],"value":"0.00"},
{"hash":98548410,"name":"tfrmeditelement.lblwidth.caption","sourcebytes":[87,105,100,116,104,58],"value":"Width:"},
{"hash":209200,"name":"tfrmeditelement.edwidth.text","sourcebytes":[48,46,48,48],"value":"0.00"},
{"hash":374330,"name":"tfrmeditelement.lbltop.caption","sourcebytes":[84,111,112,58],"value":"Top:"},
{"hash":209200,"name":"tfrmeditelement.edtop.text","sourcebytes":[48,46,48,48],"value":"0.00"},
{"hash":209200,"name":"tfrmeditelement.edleft.text","sourcebytes":[48,46,48,48],"value":"0.00"},
{"hash":5422458,"name":"tfrmeditelement.lblleft.caption","sourcebytes":[76,101,102,116,58],"value":"Left:"},
{"hash":218757493,"name":"tfrmeditelement.chkvisible.caption","sourcebytes":[86,105,115,105,98,108,101],"value":"Visible"},
{"hash":142271120,"name":"tfrmeditelement.gbcaption.caption","sourcebytes":[32,67,97,112,116,105,111,110,32],"value":" Caption "},
{"hash":95221696,"name":"tfrmeditelement.lblcaptiontext.caption","sourcebytes":[84,101,120,116,58,32],"value":"Text: "},
{"hash":224751950,"name":"tfrmeditelement.btncaptionfont.caption","sourcebytes":[70,111,110,116,46,46,46],"value":"Font..."},
@ -22,5 +10,21 @@
{"hash":243697310,"name":"tfrmeditelement.btnshape.caption","sourcebytes":[83,104,97,112,101,46,46,46],"value":"Shape..."},
{"hash":1339,"name":"tfrmeditelement.btnok.caption","sourcebytes":[79,75],"value":"OK"},
{"hash":77089212,"name":"tfrmeditelement.btncancel.caption","sourcebytes":[67,97,110,99,101,108],"value":"Cancel"},
{"hash":257887424,"name":"tfrmeditelement.rgitemtype.caption","sourcebytes":[73,116,101,109,32,84,121,112,101,32],"value":"Item Type "}
{"hash":257887424,"name":"tfrmeditelement.rgitemtype.caption","sourcebytes":[73,116,101,109,32,84,121,112,101,32],"value":"Item Type "},
{"hash":176733536,"name":"tfrmeditelement.rgrotation.caption","sourcebytes":[32,82,111,116,97,116,105,111,110,32],"value":" Rotation "},
{"hash":111192878,"name":"tfrmeditelement.gbposition.caption","sourcebytes":[80,111,115,105,116,105,111,110],"value":"Position"},
{"hash":374330,"name":"tfrmeditelement.lbltop.caption","sourcebytes":[84,111,112,58],"value":"Top:"},
{"hash":209200,"name":"tfrmeditelement.edtop.text","sourcebytes":[48,46,48,48],"value":"0.00"},
{"hash":209200,"name":"tfrmeditelement.edleft.text","sourcebytes":[48,46,48,48],"value":"0.00"},
{"hash":5422458,"name":"tfrmeditelement.lblleft.caption","sourcebytes":[76,101,102,116,58],"value":"Left:"},
{"hash":247455546,"name":"tfrmeditelement.lblheight.caption","sourcebytes":[72,101,105,103,104,116,58],"value":"Height:"},
{"hash":209200,"name":"tfrmeditelement.edheight.text","sourcebytes":[48,46,48,48],"value":"0.00"},
{"hash":98548410,"name":"tfrmeditelement.lblwidth.caption","sourcebytes":[87,105,100,116,104,58],"value":"Width:"},
{"hash":209200,"name":"tfrmeditelement.edwidth.text","sourcebytes":[48,46,48,48],"value":"0.00"},
{"hash":218757493,"name":"tfrmeditelement.chkvisible.caption","sourcebytes":[86,105,115,105,98,108,101],"value":"Visible"},
{"hash":90721266,"name":"tfrmeditelement.panel2.caption","sourcebytes":[80,97,110,101,108,50],"value":"Panel2"},
{"hash":91286579,"name":"tfrmeditelement.rbpixels.caption","sourcebytes":[80,105,120,101,108,115],"value":"Pixels"},
{"hash":113810436,"name":"tfrmeditelement.rbpercent.caption","sourcebytes":[80,101,114,99,101,110,116],"value":"Percent"},
{"hash":84188867,"name":"tfrmeditelement.rbinches.caption","sourcebytes":[73,110,99,104,101,115],"value":"Inches"},
{"hash":1693,"name":"tfrmeditelement.rbcentimeters.caption","sourcebytes":[99,109],"value":"cm"}
]}

View File

@ -49,26 +49,32 @@ type
TfrmEditElement = class(TForm)
BevelHeightWidth: TBevel;
BevelTopLeft: TBevel;
BevelTopLeft1: TBevel;
btnCancel: TButton;
btnOk: TButton;
btnShape: TButton;
edName: TEdit;
gbDayOffset: TGroupBox;
gbPosition: TGroupBox;
lblName: TLabel;
Panel1: TPanel;
DayOffsetPanel: TPanel;
ButtonPanel: TPanel;
ItemTypePanel: TPanel;
HeightWidthPanel: TPanel;
Panel2: TPanel;
PositionPanel: TPanel;
rbPixels: TRadioButton;
rbPercent: TRadioButton;
rbInches: TRadioButton;
rbCentimeters: TRadioButton;
TopLeftPanel: TPanel;
rgDayOffsetUnit: TRadioGroup;
rgItemType: TRadioGroup;
gbVisual: TGroupBox;
LblTop: TLabel;
LblLeft: TLabel;
LblHeight: TLabel;
LblWidth: TLabel;
rgMeasurement: TRadioGroup;
rgRotation: TRadioGroup;
edTop: TEdit;
edLeft: TEdit;
@ -89,14 +95,14 @@ type
procedure btnCancelClick(Sender: TObject);
procedure btnOkClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure rgItemTypeClick(Sender: TObject);
procedure btnShapeClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure btnCaptionFontClick(Sender: TObject);
procedure edCaptionTextChange(Sender: TObject);
procedure rgMeasurementClick(Sender: TObject);
procedure PosEditExit(Sender: TObject);
procedure PosEditEnter(Sender: TObject);
procedure MeasurementUnitChange(Sender: TObject);
procedure UpDownClick(Sender: TObject; Button: TUDBtnType);
private
procedure PositionControls;
@ -106,8 +112,8 @@ type
TheShape: TVpPrintShape;
TheCaption: TVpPrintCaption;
CurEdit: TEdit;
MaxSpin: Integer;
function GetUnitIndex: Integer;
procedure SaveData(AnElement: TVpPrintFormatElementItem);
procedure SetData(AnElement: TVpPrintFormatElementItem);
procedure SetItemType(Index: Integer);
@ -122,6 +128,7 @@ type
implementation
uses
Math,
VpMisc, VpEdShape;
{$IFDEF LCL}
@ -149,14 +156,31 @@ begin
lblCaptionText.Enabled := False;
btnCaptionFont.Enabled := False;
for i:=0 to rgDayOffsetUnit.ComponentCount-1 do
TRadioButton(rgDayOffsetUnit.Components[i]).ParentFont := false;
for i:=0 to rgDayOffsetUnit.ControlCount-1 do
TRadioButton(rgDayOffsetUnit.Controls[i]).ParentFont := false;
rgDayOffsetUnit.Font.Style := [fsBold];
for i:=0 to rgItemType.ComponentCount-1 do
TRadioButton(rgItemType.Components[i]).ParentFont := false;
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;
rgItemType.Font.Style := [fsBold];
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];
SetCaptions;
end;
@ -210,11 +234,30 @@ begin
SaveData(AnElement);
end;
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;
procedure TfrmEditElement.PosEditEnter(Sender: TObject);
begin
CurEdit := (Sender as TEdit);
end;
procedure TfrmEditElement.MeasurementUnitChange(Sender: TObject);
begin
SetMaxSpin(GetUnitIndex);
end;
procedure TfrmEditElement.PosEditExit(Sender: TObject);
var
ed: TEdit;
@ -241,11 +284,6 @@ begin
SetItemType(rgItemType.ItemIndex);
end;
procedure TfrmEditElement.rgMeasurementClick(Sender: TObject);
begin
SetMaxSpin(rgMeasurement.ItemIndex);
end;
procedure TfrmEditElement.SaveData(AnElement: TVpPrintFormatElementItem);
begin
AnElement.ElementName := edName.Text;
@ -261,7 +299,7 @@ begin
AnElement.DayOffsetUnits := TVpDayUnits(rgDayOffsetUnit.ItemIndex);
AnElement.Rotation := TVpRotationAngle(rgRotation.ItemIndex);
AnElement.Measurement := TVpItemMeasurement(rgMeasurement.ItemIndex);
AnElement.Measurement := TVpItemMeasurement(GetUnitIndex);
AnElement.Visible := chkVisible.Checked;
end;
@ -289,12 +327,10 @@ begin
rgDayOffsetUnit.Items[2] := RSMonths;
rgDayOffsetUnit.Items[3] := RSYears;
gbVisual.Caption := RSVisualCaption;
rgRotation.Caption := RSRotationCaption;
rgMeasurement.Caption := RSMeasurementCaption;
rgMeasurement.Items[0] := RSPixels;
rgMeasurement.Items[1] := RSPercent;
rgMeasurement.Items[2] := RSInches;
rbPixels.Caption := RSPixels;
rbPercent.Caption := RSPercent;
rbInches.Caption := RSInches;
lblLeft.Caption := RSLeft;
lblTop.Caption := RSTop;
lblWidth.Caption := RSWidth;
@ -321,6 +357,11 @@ begin
BevelTopLeft.Shape := bsSpacer;
BevelHeightWidth.Shape := bsSpacer;
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;
end;
procedure TfrmEditElement.SetData(AnElement : TVpPrintFormatElementItem);
@ -335,8 +376,13 @@ begin
rgDayOffsetUnit.ItemIndex := Ord(AnElement.DayOffsetUnits);
rgRotation.ItemIndex := Ord(AnElement.Rotation);
rgMeasurement.ItemIndex := Ord(AnElement.Measurement);
SetMaxSpin(rgMeasurement.ItemIndex);
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));
edTop.Text := EvalFmt(AnElement.Top);
udTop.Position := Trunc(AnElement.Top);