tvplanit: Improved layout of Event editor in case of translation. Cosmetic format changes.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4731 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-12 18:11:04 +00:00
parent cdd2584be7
commit fc91764452
3 changed files with 128 additions and 129 deletions

View File

@ -18,17 +18,17 @@ object AlarmNotifyForm: TAlarmNotifyForm
Position = poDefault
LCLVersion = '1.7'
object SnoozeCaption: TLabel
Left = 24
Left = 16
Height = 57
Top = 136
Width = 144
Width = 152
AutoSize = False
Caption = 'SnoozeCaption'
ParentColor = False
WordWrap = True
end
object lSubject: TLabel
Left = 24
Left = 16
Height = 15
Top = 32
Width = 45
@ -38,7 +38,7 @@ object AlarmNotifyForm: TAlarmNotifyForm
ParentFont = False
end
object lTime: TLabel
Left = 24
Left = 16
Height = 15
Top = 8
Width = 30
@ -107,20 +107,20 @@ object AlarmNotifyForm: TAlarmNotifyForm
TabOrder = 3
end
object Panel1: TPanel
Left = 24
Left = 16
Height = 72
Top = 56
Width = 371
Width = 379
BevelInner = bvRaised
BevelOuter = bvLowered
ClientHeight = 72
ClientWidth = 371
ClientWidth = 379
TabOrder = 4
object lNotes: TLabel
Left = 2
Height = 68
Top = 2
Width = 367
Width = 375
Align = alClient
AutoSize = False
Caption = 'lNotes'

View File

@ -105,21 +105,19 @@ object DlgEventEdit: TDlgEventEdit
end
object StartTimeLbl: TLabel
Left = 33
Height = 13
Height = 15
Top = 108
Width = 59
Width = 54
Alignment = taRightJustify
AutoSize = False
Caption = 'Start time:'
ParentColor = False
end
object EndTimeLbl: TLabel
Left = 35
Height = 13
Height = 15
Top = 135
Width = 57
Width = 50
Alignment = taRightJustify
AutoSize = False
Caption = 'End time:'
ParentColor = False
end
@ -154,10 +152,9 @@ object DlgEventEdit: TDlgEventEdit
end
object RecurringLbl: TLabel
Left = 395
Height = 13
Top = 87
Width = 187
AutoSize = False
Height = 15
Top = 85
Width = 136
Caption = 'Appointment Recurrence:'
ParentColor = False
end
@ -168,11 +165,10 @@ object DlgEventEdit: TDlgEventEdit
Width = 2
end
object IntervalLbl: TLabel
Left = 589
Height = 13
Top = 87
Width = 92
AutoSize = False
Left = 583
Height = 15
Top = 85
Width = 77
Caption = 'Interval (days):'
ParentColor = False
end
@ -209,7 +205,7 @@ object DlgEventEdit: TDlgEventEdit
}
end
object SpeedButton1: TSpeedButton
Left = 329
Left = 312
Height = 22
Top = 167
Width = 23
@ -261,12 +257,11 @@ object DlgEventEdit: TDlgEventEdit
}
end
object RecurrenceEndsLbl: TLabel
Left = 368
Height = 13
Left = 424
Height = 15
Top = 135
Width = 88
Width = 28
Alignment = taRightJustify
AutoSize = False
Caption = 'Until:'
ParentColor = False
end
@ -274,7 +269,7 @@ object DlgEventEdit: TDlgEventEdit
Left = 86
Height = 23
Top = 11
Width = 580
Width = 578
Anchors = [akTop, akLeft, akRight]
TabOrder = 0
Text = 'DescriptionEdit'
@ -292,7 +287,7 @@ object DlgEventEdit: TDlgEventEdit
Left = 484
Height = 21
Top = 40
Width = 182
Width = 180
ItemHeight = 15
OnDrawItem = CategoryDrawItem
ReadOnly = True
@ -310,7 +305,7 @@ object DlgEventEdit: TDlgEventEdit
TabOrder = 6
end
object IntervalUpDown: TUpDown
Left = 652
Left = 648
Height = 23
Top = 104
Width = 16
@ -326,7 +321,7 @@ object DlgEventEdit: TDlgEventEdit
Left = 231
Height = 23
Top = 167
Width = 93
Width = 77
ItemHeight = 15
Style = csDropDownList
TabOrder = 13
@ -354,7 +349,7 @@ object DlgEventEdit: TDlgEventEdit
TabOrder = 3
end
object edtUnusedPlaceholder: TEdit
Left = 587
Left = 583
Height = 23
Top = 104
Width = 65

View File

@ -51,6 +51,7 @@ type
TVpRightAlignedEdit = class(TEdit)
public
constructor Create(AOwner: TComponent); override;
procedure CreateParams(var Params : TCreateParams); override;
end;
@ -145,18 +146,16 @@ type
TVpEventEditDialog = class(TVpBaseDialog)
protected {private}
ceEditDlg : TDlgEventEdit;
FTimeFormat : TVpTimeFormat;
ceEvent : TVpEvent;
ceEditDlg: TDlgEventEdit;
FTimeFormat: TVpTimeFormat;
ceEvent: TVpEvent;
public
constructor Create(AOwner : TComponent); override;
function Execute(Event: TVpEvent;
TimeFormat: TVpTimeFormat = tf12Hour): Boolean; reintroduce;
function Execute(Event: TVpEvent; TimeFormat: TVpTimeFormat = tf12Hour): Boolean; reintroduce;
function AddNewEvent(StartTime, EndTime: TDateTime): Boolean;
published
{properties}
property TimeFormat: TVpTimeFormat
read FTimeFormat write FTimeFormat default tf12Hour;
property TimeFormat: TVpTimeFormat read FTimeFormat write FTimeFormat default tf12Hour;
property DataStore;
property Options;
property Placement;
@ -165,7 +164,7 @@ type
implementation
uses
VpSR, VpWavDlg;
VpSR, VpMisc, VpWavDlg;
{$IFDEF LCL}
{$R *.lfm}
@ -175,6 +174,14 @@ uses
{ TVpRightAlignedEdit }
constructor TVpRightAlignedEdit.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
{$IFDEF LCL}
Alignment := taRightJustify;
{$ENDIF}
end;
procedure TVpRightAlignedEdit.CreateParams(var Params: TCreateParams);
begin
inherited;
@ -188,6 +195,8 @@ end;
{ TDlgEventEdit }
procedure TDlgEventEdit.FormCreate(Sender: TObject);
const
DELTA = 8;
begin
{$IFDEF LCL}
StartTime := TTimeEdit.Create(self);
@ -228,6 +237,13 @@ begin
TabOrder := edtUnusedPlaceholder.TabOrder;
end;
IntervalUpDown.Associate := FCustomInterval;
DescriptionLbl.Left := DescriptionEdit.Left - GetLabelWidth(DescriptionLbl) - DELTA;
LocationLbl.Left := LocationEdit.Left - GetLabelWidth(LocationLbl) - DELTA;
CategoryLbl.Left := Category.Left - GetLabelWidth(CategoryLbl) - DELTA;
StartTimeLbl.Left := StartDate.Left - GetLabelWidth(StartTimeLbl) - DELTA;
EndTimeLbl.Left := EndDate.Left - GetLabelWidth(EndTimeLbl) - DELTA;
RecurrenceEndsLbl.Left := RepeatUntil.Left - GetLabelWidth(RecurrenceEndsLbl) - DELTA;
end;
{=====}
@ -248,45 +264,45 @@ begin
Color := clBlack;
case Index of
0: begin
Color := CatColorMap.Category0.Color;
Name := CatColorMap.Category0.Description;
end;
1: begin
Color := CatColorMap.Category1.Color;
Name := CatColorMap.Category1.Description;
end;
2: begin
Color := CatColorMap.Category2.Color;
Name := CatColorMap.Category2.Description;
end;
3: begin
Color := CatColorMap.Category3.Color;
Name := CatColorMap.Category3.Description;
end;
4: begin
Color := CatColorMap.Category4.Color;
Name := CatColorMap.Category4.Description;
end;
5: begin
Color := CatColorMap.Category5.Color;
Name := CatColorMap.Category5.Description;
end;
6: begin
Color := CatColorMap.Category6.Color;
Name := CatColorMap.Category6.Description;
end;
7: begin
Color := CatColorMap.Category7.Color;
Name := CatColorMap.Category7.Description;
end;
8: begin
Color := CatColorMap.Category8.Color;
Name := CatColorMap.Category8.Description;
end;
9: begin
Color := CatColorMap.Category9.Color;
Name := CatColorMap.Category9.Description;
end;
Color := CatColorMap.Category0.Color;
Name := CatColorMap.Category0.Description;
end;
1: begin
Color := CatColorMap.Category1.Color;
Name := CatColorMap.Category1.Description;
end;
2: begin
Color := CatColorMap.Category2.Color;
Name := CatColorMap.Category2.Description;
end;
3: begin
Color := CatColorMap.Category3.Color;
Name := CatColorMap.Category3.Description;
end;
4: begin
Color := CatColorMap.Category4.Color;
Name := CatColorMap.Category4.Description;
end;
5: begin
Color := CatColorMap.Category5.Color;
Name := CatColorMap.Category5.Description;
end;
6: begin
Color := CatColorMap.Category6.Color;
Name := CatColorMap.Category6.Description;
end;
7: begin
Color := CatColorMap.Category7.Color;
Name := CatColorMap.Category7.Description;
end;
8: begin
Color := CatColorMap.Category8.Color;
Name := CatColorMap.Category8.Description;
end;
9: begin
Color := CatColorMap.Category9.Color;
Name := CatColorMap.Category9.Description;
end;
end; {Case}
SaveColor := Category.Canvas.Brush.Color;
@ -418,11 +434,9 @@ begin
{ follow the start time by 30 minutes }
if ST > StrToTime(EndTime.Text) then begin
if TimeFormat = tf24Hour then
EndTime.Text := FormatDateTime ('h:mm',
ST + (30/MinutesInDay))
EndTime.Text := FormatDateTime('h:mm', ST + 30 / MinutesInDay)
else
EndTime.Text := FormatDateTime ('hh:mm AM/PM',
ST + (30/MinutesInDay));
EndTime.Text := FormatDateTime('hh:mm AM/PM', ST + 30 / MinutesInDay);
end;
end;
@ -430,9 +444,9 @@ end;
procedure TDlgEventEdit.EndTimeChange(Sender: TObject);
function IsMidnight (ATime : TDateTime) : Boolean;
function IsMidnight(ATime: TDateTime) : Boolean;
begin
Result := ATime = Trunc (ATime);
Result := ATime = Trunc(ATime);
end;
var
@ -441,12 +455,11 @@ var
begin
{ Verify the value is valid }
try
ET := StrToTime (EndTime.Text);
if (IsMidnight (ET)) and (not IsMidnight (FLastEndTime)) then
ET := StrToTime(EndTime.Text);
if (IsMidnight(ET)) and (not IsMidnight(FLastEndTime)) then
EndDate.Date := EndDate.Date + 1
else if (not IsMidnight (ET)) and (IsMidnight (FLastEndTime)) then
else if (not IsMidnight(ET)) and (IsMidnight(FLastEndTime)) then
EndDate.Date := EndDate.Date - 1;
FLastEndTime := ET;
except
EndTime.Color := clRed;
@ -459,22 +472,22 @@ begin
{ precede the end time by 30 minutes }
if ET < StrToTime(StartTime.Text) then begin
if TimeFormat = tf24Hour then
StartTime.Text := FormatDateTime ('h:mm',
ET - (30/MinutesInDay))
StartTime.Text := FormatDateTime('h:mm', ET - 30 / MinutesInDay)
else
StartTime.Text := FormatDateTime ('h:mm AM/PM',
ET - (30/MinutesInDay));
StartTime.Text := FormatDateTime('h:mm AM/PM', ET - 30 / MinutesInDay);
end;
end;
{=====}
procedure TDlgEventEdit.PopLists;
{$IFDEF DELPHI}
var
StringList: TStringList;
I, Hour, Minute: Integer;
MinStr, AMPMStr: string;
{$ENDIF}
begin
{$IFDEF DELPHI}
{$IFDEF DELPHI} // No longer needed for Lazarus using a TTimeEdit now.
{ Time Lists }
StringList := TStringList.Create;
try
@ -606,9 +619,7 @@ end;
procedure TDlgEventEdit.RecurringTypeChange(Sender: TObject);
begin
if (RecurringType.ItemIndex > 0)
and (RepeatUntil.Date <= StartDate.Date)
then
if (RecurringType.ItemIndex > 0) and (RepeatUntil.Date <= StartDate.Date) then
RepeatUntil.Date := StartDate.Date + 365;
RecurrenceEndsLbl.Enabled := (RecurringType.ItemIndex > 0);
@ -658,7 +669,7 @@ end;
{ TVpEventEditDialog }
constructor TVpEventEditDialog.Create(AOwner : TComponent);
constructor TVpEventEditDialog.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FPlacement.Position := mpCenterTop;
@ -712,12 +723,10 @@ end;
procedure TDlgEventEdit.StartTimeExit(Sender: TObject);
var
ST : TDateTime;
begin
{ Verify the value is valid }
{ Verify the value is valid }
try
ST := StartDate.Date +
StrToTime (StartTime.Text);
ST := StartDate.Date + StrToTime(StartTime.Text);
except
StartTime.Color := clRed;
StartTime.SetFocus;
@ -725,23 +734,20 @@ begin
end;
StartTime.Color := clWindow;
{ if the end time is less than the start time then change the end }
{ If the end time is less than the start time then change the end }
{ time to follow the start time by 30 minutes }
if ST > EndDate.Date +
StrToTime (EndTime.Text) then begin
EndTime.Text := FormatDateTime('hh:mm',ST + (30/MinutesInDay));
end;
if ST > EndDate.Date + StrToTime (EndTime.Text) then
EndTime.Text := FormatDateTime('hh:mm', ST + 30 / MinutesInDay);
end;
procedure TDlgEventEdit.EndTimeExit(Sender: TObject);
var
ET : TDateTime;
ET: TDateTime;
begin
{ Verify the value is valid }
{ Verify the value is valid }
try
ET := EndDate.Date + StrToTime (EndTime.Text);
ET := EndDate.Date + StrToTime(EndTime.Text);
except
EndTime.Color := clRed;
EndTime.SetFocus;
@ -749,13 +755,11 @@ begin
end;
EndTime.Color := clWindow;
{ if the end time is less than the start time then change the }
{ If the end time is less than the start time then change the }
{ start time to precede the end time by 30 minutes }
if ET < StartDate.Date +
StrToTime (StartTime.Text) then begin
StartTime.Text := FormatDateTime('hh:mm',ET- (30/MinutesInDay));
end;
if ET < StartDate.Date + StrToTime (StartTime.Text) then
StartTime.Text := FormatDateTime('hh:mm', ET - 30 / MinutesInDay);
end;
end.