You've already forked lazarus-ccr
tvplanit: Translate PrintFormat item editor and auto-position controls.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4931 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,45 +1,49 @@
|
||||
object frmEditFormat: TfrmEditFormat
|
||||
Left = 403
|
||||
Height = 199
|
||||
Height = 193
|
||||
Top = 199
|
||||
Width = 329
|
||||
HorzScrollBar.Page = 328
|
||||
VertScrollBar.Page = 188
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Edit Format'
|
||||
ClientHeight = 199
|
||||
ClientHeight = 193
|
||||
ClientWidth = 329
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '1.7'
|
||||
object Label1: TLabel
|
||||
object LblIncrement: TLabel
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 76
|
||||
Top = 72
|
||||
Width = 80
|
||||
Caption = 'Day Increment:'
|
||||
FocusControl = edIncrement
|
||||
ParentColor = False
|
||||
end
|
||||
object Label2: TLabel
|
||||
object LblDescription: TLabel
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 44
|
||||
Width = 66
|
||||
Caption = 'Description: '
|
||||
FocusControl = edDescription
|
||||
ParentColor = False
|
||||
end
|
||||
object Label3: TLabel
|
||||
object LblName: TLabel
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 38
|
||||
Caption = 'Name: '
|
||||
FocusControl = edName
|
||||
ParentColor = False
|
||||
end
|
||||
object btnOk: TButton
|
||||
Left = 157
|
||||
Height = 25
|
||||
Top = 164
|
||||
Top = 160
|
||||
Width = 75
|
||||
Caption = 'OK'
|
||||
Default = True
|
||||
@ -49,7 +53,7 @@ object frmEditFormat: TfrmEditFormat
|
||||
object btnCancel: TButton
|
||||
Left = 237
|
||||
Height = 25
|
||||
Top = 164
|
||||
Top = 160
|
||||
Width = 75
|
||||
Cancel = True
|
||||
Caption = 'Cancel'
|
||||
@ -58,8 +62,8 @@ object frmEditFormat: TfrmEditFormat
|
||||
end
|
||||
object rgDayIncrement: TRadioGroup
|
||||
Left = 16
|
||||
Height = 48
|
||||
Top = 104
|
||||
Height = 51
|
||||
Top = 101
|
||||
Width = 296
|
||||
AutoFill = True
|
||||
Caption = ' Day Increment Unit '
|
||||
@ -71,7 +75,7 @@ object frmEditFormat: TfrmEditFormat
|
||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||
ChildSizing.Layout = cclLeftToRightThenTopToBottom
|
||||
ChildSizing.ControlsPerLine = 4
|
||||
ClientHeight = 28
|
||||
ClientHeight = 31
|
||||
ClientWidth = 292
|
||||
Columns = 4
|
||||
ItemIndex = 0
|
||||
@ -100,7 +104,7 @@ object frmEditFormat: TfrmEditFormat
|
||||
object udIncrement: TUpDown
|
||||
Left = 158
|
||||
Height = 23
|
||||
Top = 72
|
||||
Top = 68
|
||||
Width = 16
|
||||
Associate = edIncrement
|
||||
Max = 365
|
||||
@ -112,7 +116,7 @@ object frmEditFormat: TfrmEditFormat
|
||||
object edIncrement: TEdit
|
||||
Left = 104
|
||||
Height = 23
|
||||
Top = 72
|
||||
Top = 68
|
||||
Width = 54
|
||||
TabOrder = 2
|
||||
Text = '0'
|
||||
|
@ -43,28 +43,32 @@ uses
|
||||
VpPrtFmt;
|
||||
|
||||
type
|
||||
|
||||
{ TfrmEditFormat }
|
||||
|
||||
TfrmEditFormat = class(TForm)
|
||||
btnCancel: TButton;
|
||||
btnOk: TButton;
|
||||
edDescription: TEdit;
|
||||
edName: TEdit;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
LblIncrement: TLabel;
|
||||
LblDescription: TLabel;
|
||||
LblName: TLabel;
|
||||
rgDayIncrement: TRadioGroup;
|
||||
udIncrement: TUpDown;
|
||||
edIncrement: TEdit;
|
||||
procedure btnCancelClick(Sender: TObject);
|
||||
procedure btnOkClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
private
|
||||
procedure SetCaptions;
|
||||
protected
|
||||
procedure SaveData(AFormat: TVpPrintFormatItem);
|
||||
procedure SetData(AFormat: TVpPrintFormatItem);
|
||||
function Validate: Boolean;
|
||||
{ Private declarations }
|
||||
public
|
||||
function Execute(AFormat: TVpPrintFormatItem) : Boolean;
|
||||
{ Public declarations }
|
||||
end;
|
||||
|
||||
|
||||
@ -76,6 +80,9 @@ implementation
|
||||
{$R *.dfm}
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
Math, VpMisc, VpSR;
|
||||
|
||||
{ TfrmEditLayout }
|
||||
|
||||
procedure TfrmEditFormat.FormShow(Sender: TObject);
|
||||
@ -106,6 +113,12 @@ begin
|
||||
if Result then
|
||||
SaveData(AFormat);
|
||||
end;
|
||||
|
||||
procedure TfrmEditFormat.FormCreate(Sender: TObject);
|
||||
begin
|
||||
SetCaptions;
|
||||
end;
|
||||
|
||||
{=====}
|
||||
procedure TfrmEditFormat.SaveData(AFormat: TVpPrintFormatItem);
|
||||
var
|
||||
@ -121,7 +134,54 @@ begin
|
||||
else
|
||||
AFormat.DayIncUnits := duDay;
|
||||
end;
|
||||
{=====}
|
||||
|
||||
procedure TfrmEditFormat.SetCaptions;
|
||||
const
|
||||
DELTA = 8;
|
||||
MARGIN = 16;
|
||||
var
|
||||
cnv: TControlCanvas;
|
||||
w: Integer;
|
||||
begin
|
||||
Caption := RSEditFormatCaption;
|
||||
LblName.Caption := RSNameLbl;
|
||||
LblDescription.Caption := RSDescriptionLbl;
|
||||
LblIncrement.Caption := RsTimeIncLbl;
|
||||
rgDayIncrement.Caption := RsTimeIncUnits;
|
||||
rgDayIncrement.Items[0] := RSDays;
|
||||
rgDayIncrement.Items[1] := RSWeeks;
|
||||
rgDayIncrement.Items[2] := RSMonths;
|
||||
rgDayIncrement.Items[3] := RSYears;
|
||||
btnOK.Caption := RSOKBtn;
|
||||
btnCancel.Caption := RSCancelBtn;
|
||||
|
||||
w := MaxValue([GetLabelWidth(LblName), GetLabelWidth(LblDescription), GetLabelWidth(LblIncrement)]);
|
||||
edName.Left := MARGIN + w + DELTA;
|
||||
edDescription.Left := edName.Left;
|
||||
edDescription.Width := edName.Width;
|
||||
edIncrement.Left := edName.Left;
|
||||
udIncrement.Left := edIncrement.Left + edIncrement.Width;
|
||||
LblName.Left := edName.Left - GetLabelWidth(LblName) - DELTA;
|
||||
LblDescription.Left := edDescription.Left - GetLabelWidth(lblDescription) - DELTA;
|
||||
lblIncrement.Left := edIncrement.Left - GetLabelWidth(lblIncrement) - DELTA;
|
||||
|
||||
ClientWidth := MARGIN + w + DELTA + edName.Width + MARGIN;
|
||||
rgDayIncrement.Width := ClientWidth - 2*MARGIN;
|
||||
|
||||
cnv := TControlCanvas.Create;
|
||||
try
|
||||
cnv.Control := btnOK;
|
||||
cnv.Font.Assign(btnOK.Font);
|
||||
w := Max(cnv.TextWidth(RSOKBtn), cnv.TextWidth(RSCancelBtn));
|
||||
finally
|
||||
cnv.Free;
|
||||
end;
|
||||
btnOK.Width := w + 16;
|
||||
btnCancel.Width := w + 16;
|
||||
btnCancel.Left := ClientWidth - MARGIN - btnCancel.Width;
|
||||
btnOK.Left := btnCancel.Left - 8 - btnOK.Width;
|
||||
end;
|
||||
|
||||
procedure TfrmEditFormat.SetData(AFormat: TVpPrintFormatItem);
|
||||
var
|
||||
IncName : string;
|
||||
|
@ -122,6 +122,9 @@ resourcestring
|
||||
RSMinutes = 'Minutes';
|
||||
RSHours = 'Hours';
|
||||
RSDays = 'Days';
|
||||
RSWeeks = 'Weeks';
|
||||
RSMonths = 'Months';
|
||||
RSYears = 'Years';
|
||||
RSCalendarWeekAbbr = 'CW'; // Abbreviation of "calendar week"
|
||||
|
||||
{WARNINGS}
|
||||
@ -235,7 +238,7 @@ resourcestring
|
||||
{ Event Edit Dialog Captions }
|
||||
RSDlgEventEdit = 'Event';
|
||||
RSAppointmentGroupBox = 'Appointment';
|
||||
RSDescriptionLbl = 'Subject:';
|
||||
RSDescriptionLbl = 'Description:';
|
||||
RSLocationLbl = 'Location:';
|
||||
RSCategoryLbl = 'Category:';
|
||||
RSStartTimeLbl = 'Start time:';
|
||||
@ -416,6 +419,13 @@ resourcestring
|
||||
RSLoadFileBtn = 'Load file...';
|
||||
RSSaveFileBtn = 'Save file...';
|
||||
|
||||
{ Print Format Item Editor }
|
||||
RSEditFormatCaption= 'Edit format';
|
||||
RSNameLbl = 'Name:';
|
||||
RSTimeIncLbl = 'Time increment:';
|
||||
RSTimeIncUnits = 'Time increment units:';
|
||||
|
||||
|
||||
{ Automatic resource adding/selection} {!!.01}
|
||||
RSAddNewResource = 'No resources have been defined. Would you ' + {!!.01}
|
||||
'like to add one now?'; {!!.01}
|
||||
|
Reference in New Issue
Block a user